mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
refac: better error handling & moved IsOnline logic to cleaner place
This commit is contained in:
@@ -2,9 +2,15 @@ package article
|
||||
|
||||
import (
|
||||
domain "RenewCMS/internal/domain/image"
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrArticleNotFound = errors.New("article not found")
|
||||
ErrArticleOffline = errors.New("article is offline")
|
||||
)
|
||||
|
||||
type Article struct {
|
||||
ID uint32 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package article
|
||||
|
||||
type Filters struct {
|
||||
IsOnline *bool
|
||||
}
|
||||
|
||||
type Repository interface {
|
||||
FindByFilters(filters Filters) ([]Article, error)
|
||||
Get(id uint32) (Article, error)
|
||||
GetByName(name string) (Article, error)
|
||||
GetAll() []Article
|
||||
|
||||
Reference in New Issue
Block a user