This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.aiterp.net/rpdata/api/models"
|
||||
)
|
||||
|
||||
type ChapterRepository interface {
|
||||
Find(ctx context.Context, id string) (*models.Chapter, error)
|
||||
List(ctx context.Context, filter models.ChapterFilter) ([]*models.Chapter, error)
|
||||
Insert(ctx context.Context, chapter models.Chapter) (*models.Chapter, error)
|
||||
Update(ctx context.Context, chapter models.Chapter, update models.ChapterUpdate) (*models.Story, error)
|
||||
Delete(ctx context.Context, chapter models.Chapter) error
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.aiterp.net/rpdata/api/models"
|
||||
)
|
||||
|
||||
type CommentRepository interface {
|
||||
Find(ctx context.Context, id string) (*models.Comment, error)
|
||||
List(ctx context.Context, filter models.CommentFilter) ([]*models.Comment, error)
|
||||
Insert(ctx context.Context, comment models.Comment) (*models.Comment, error)
|
||||
Update(ctx context.Context, comment models.Comment, update models.CommentUpdate) (*models.Story, error)
|
||||
Delete(ctx context.Context, comment models.Comment) error
|
||||
}
|
||||
@@ -10,3 +10,9 @@ var ErrInvalidPosition = errors.New("position is out of bounds")
|
||||
|
||||
// ErrParentMismatch is returned if the list refer to different parent objects when it shouldn't.
|
||||
var ErrParentMismatch = errors.New("parent resource is not the same for the entire list")
|
||||
|
||||
// ErrTagExists is returned if an existing tag is added again.
|
||||
var ErrTagExists = errors.New("tag already exists")
|
||||
|
||||
// ErrTagDoesNotExist is returned if a non-existing tag is attempted removed.
|
||||
var ErrTagDoesNotExist = errors.New("tag already exists")
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.aiterp.net/rpdata/api/models"
|
||||
)
|
||||
|
||||
type StoryRepository interface {
|
||||
Find(ctx context.Context, id string) (*models.Story, error)
|
||||
List(ctx context.Context, filter models.StoryFilter) ([]*models.Story, error)
|
||||
Insert(ctx context.Context, story models.Story) (*models.Story, error)
|
||||
Update(ctx context.Context, story models.Story, update models.StoryUpdate) (*models.Story, error)
|
||||
AddTag(ctx context.Context, story models.Story, tag models.Tag) error
|
||||
RemoveTag(ctx context.Context, story models.Story, tag models.Tag) error
|
||||
Delete(ctx context.Context, story models.Story) error
|
||||
}
|
||||
Reference in New Issue
Block a user