Story/chapter/comment repos + started on story service.
the build was successful

This commit is contained in:
2019-08-18 08:59:38 +02:00
parent 8fbaea2078
commit 8c4670580c
12 changed files with 493 additions and 4 deletions
+14
View File
@@ -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
}
+14
View File
@@ -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
}
+6
View File
@@ -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")
+16
View File
@@ -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
}