|
|
package database
import ( "context" "git.aiterp.net/stufflog3/stufflog3-api/internal/models" "time" )
type Database interface { Scopes() ScopeRepository Stats(scopeID int) StatRepository Items(scopeID int) ItemRepository }
type ScopeRepository interface { Find(ctx context.Context, id int) (*models.Scope, error) List(ctx context.Context) ([]models.ScopeEntry, error) ListByUser(ctx context.Context, userID string) ([]models.ScopeEntry, error) Create(ctx context.Context, scope models.ScopeEntry, owner models.ScopeMember) (*models.Scope, error) Update(ctx context.Context, scope models.ScopeEntry) error Delete(ctx context.Context, scope models.Scope) error UpdateMember(ctx context.Context, scope models.Scope, member models.ScopeMember) (*models.Scope, error) DeleteMember(ctx context.Context, scope models.Scope, userID string) (*models.Scope, error) }
type StatRepository interface { Find(ctx context.Context, id int) (*models.Stat, error) List(ctx context.Context) ([]models.Stat, error) Create(ctx context.Context, stat models.Stat) (*models.Stat, error) Update(ctx context.Context, stat models.Stat) error Delete(ctx context.Context, stat models.Stat) error }
type ItemRepository interface { Find(ctx context.Context, id int) (*models.Item, error) List(ctx context.Context) ([]models.Item, error) ListAcquired(ctx context.Context, from, to time.Time) ([]models.Item, error) Create(ctx context.Context, stat models.Stat) (*models.Item, error) }
|