Logs and posts are now on the new architecture.
the build was successful

This commit is contained in:
2019-06-18 20:34:58 +02:00
parent e194b6536e
commit 73a1c79903
37 changed files with 1575 additions and 922 deletions
+14
View File
@@ -0,0 +1,14 @@
package repositories
import (
"context"
"git.aiterp.net/rpdata/api/models"
)
type LogRepository interface {
Find(ctx context.Context, id string) (*models.Log, error)
List(ctx context.Context, filter models.LogFilter) ([]*models.Log, error)
Insert(ctx context.Context, log models.Log) (*models.Log, error)
Update(ctx context.Context, log models.Log, update models.LogUpdate) (*models.Log, error)
Delete(ctx context.Context, log models.Log) error
}
+16
View File
@@ -0,0 +1,16 @@
package repositories
import (
"context"
"git.aiterp.net/rpdata/api/models"
)
type PostRepository interface {
Find(ctx context.Context, id string) (*models.Post, error)
List(ctx context.Context, filter models.PostFilter) ([]*models.Post, error)
Insert(ctx context.Context, post models.Post) (*models.Post, error)
InsertMany(ctx context.Context, posts ...*models.Post) ([]*models.Post, error)
Update(ctx context.Context, post models.Post, update models.PostUpdate) (*models.Post, error)
Move(ctx context.Context, post models.Post, position int) ([]*models.Post, error)
Delete(ctx context.Context, post models.Post) error
}
+7 -1
View File
@@ -3,4 +3,10 @@ package repositories
import "errors"
// ErrNotFound should be returned instead of any database-specific not found error.
var ErrNotFound = errors.New("Resource not found")
var ErrNotFound = errors.New("resource not found")
// ErrInvalidPosition is returned when the log post is attempted moved outside of the range.
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")