2024-11-26 21:36:40 +00:00
|
|
|
package datastore
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
|
2024-11-26 21:38:45 +00:00
|
|
|
"git.itzana.me/strafesnet/maps-service/internal/model"
|
2024-11-26 21:36:40 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
ErrNotExist = errors.New("resource does not exist")
|
|
|
|
)
|
|
|
|
|
|
|
|
type Datastore interface {
|
|
|
|
Users() Users
|
2024-11-26 22:37:18 +00:00
|
|
|
Submissions() Submissions
|
2024-11-26 21:36:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type Users interface {
|
|
|
|
Get(ctx context.Context, id int64) (model.User, error)
|
|
|
|
GetList(ctx context.Context, id []int64) ([]model.User, error)
|
|
|
|
Create(ctx context.Context, user model.User) (model.User, error)
|
|
|
|
Update(ctx context.Context, id int64, values OptionalMap) error
|
|
|
|
Delete(ctx context.Context, id int64) error
|
|
|
|
List(ctx context.Context, filters OptionalMap, page model.Page) ([]model.User, error)
|
|
|
|
}
|
|
|
|
|
2024-11-26 22:37:18 +00:00
|
|
|
type Submissions interface {
|
|
|
|
Get(ctx context.Context, id int64) (model.Submission, error)
|
|
|
|
GetList(ctx context.Context, id []int64) ([]model.Submission, error)
|
|
|
|
Create(ctx context.Context, time model.Submission) (model.Submission, error)
|
2024-11-26 21:36:40 +00:00
|
|
|
Update(ctx context.Context, id int64, values OptionalMap) error
|
|
|
|
Delete(ctx context.Context, id int64) error
|
2024-11-26 22:37:18 +00:00
|
|
|
List(ctx context.Context, filters OptionalMap, page model.Page) ([]model.Submission, error)
|
2024-11-26 21:36:40 +00:00
|
|
|
}
|