2023-06-25 18:04:06 +00:00
|
|
|
package repository
|
|
|
|
|
2023-07-06 17:36:24 +00:00
|
|
|
import (
|
|
|
|
"owl-blogs/domain/model"
|
|
|
|
"time"
|
|
|
|
)
|
2023-06-25 18:04:06 +00:00
|
|
|
|
|
|
|
type EntryRepository interface {
|
2023-07-06 17:36:24 +00:00
|
|
|
Create(entry model.Entry, publishedAt *time.Time, metaData model.EntryMetaData) error
|
2023-06-25 18:04:06 +00:00
|
|
|
Update(entry model.Entry) error
|
|
|
|
Delete(entry model.Entry) error
|
|
|
|
FindById(id string) (model.Entry, error)
|
|
|
|
FindAll(types *[]string) ([]model.Entry, error)
|
|
|
|
}
|
2023-07-08 09:08:55 +00:00
|
|
|
|
|
|
|
type BinaryRepository interface {
|
2023-07-09 17:09:54 +00:00
|
|
|
// Create creates a new binary file
|
|
|
|
// The name is the original file name, and is not unique
|
|
|
|
// BinaryFile.Id is a unique identifier
|
2023-07-09 19:27:59 +00:00
|
|
|
Create(name string, data []byte, entry model.Entry) (*model.BinaryFile, error)
|
2023-07-08 09:08:55 +00:00
|
|
|
FindById(id string) (*model.BinaryFile, error)
|
2023-07-09 19:27:59 +00:00
|
|
|
FindByNameForEntry(name string, entry model.Entry) (*model.BinaryFile, error)
|
2023-07-08 09:08:55 +00:00
|
|
|
}
|
2023-07-08 11:28:06 +00:00
|
|
|
|
|
|
|
type AuthorRepository interface {
|
2023-07-09 17:09:54 +00:00
|
|
|
// Create creates a new author
|
|
|
|
// It returns an error if the name is already taken
|
2023-07-08 11:28:06 +00:00
|
|
|
Create(name string, passwordHash string) (*model.Author, error)
|
2023-07-09 17:09:54 +00:00
|
|
|
// FindByName finds an author by name
|
|
|
|
// It returns an error if the author is not found
|
2023-07-08 11:28:06 +00:00
|
|
|
FindByName(name string) (*model.Author, error)
|
|
|
|
}
|