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 Projects(scopeID int) ProjectRepository ItemsMultiScope(scopeIDs []int) ItemMultiScopeRepository } type ScopeRepository interface { Find(ctx context.Context, id int, full bool) (*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, update models.StatUpdate) (*models.Stat, error) Delete(ctx context.Context, stat models.Stat) error } type ItemRepository interface { Find(ctx context.Context, id int) (*models.Item, error) ListCreated(ctx context.Context, from, to time.Time) ([]models.Item, error) ListAcquired(ctx context.Context, from, to time.Time) ([]models.Item, error) ListScheduled(ctx context.Context, from, to models.Date) ([]models.Item, error) ListLoose(ctx context.Context, from, to time.Time) ([]models.Item, error) Create(ctx context.Context, item models.Item) (*models.Item, error) Update(ctx context.Context, item models.Item, update models.ItemUpdate) (*models.Item, error) Delete(ctx context.Context, item models.Item) error } type ItemMultiScopeRepository interface { ListCreated(ctx context.Context, from, to time.Time) ([]models.Item, error) ListAcquired(ctx context.Context, from, to time.Time) ([]models.Item, error) ListScheduled(ctx context.Context, from, to models.Date) ([]models.Item, error) ListLoose(ctx context.Context, from, to time.Time) ([]models.Item, error) } type ProjectRepository interface { Find(ctx context.Context, id int) (*models.Project, error) List(ctx context.Context) ([]models.ProjectEntry, error) Create(ctx context.Context, project models.Project) (*models.Project, error) Update(ctx context.Context, project models.Project, update models.ProjectUpdate) (*models.Project, error) Delete(ctx context.Context, project models.ProjectEntry, deleteItems bool) error AddRequirement(ctx context.Context, project models.ProjectEntry, requirement models.ProjectRequirement) (*models.Project, error) UpdateRequirement(ctx context.Context, project models.ProjectEntry, requirement models.ProjectRequirement, update models.ProjectRequirementUpdate) (*models.Project, error) DeleteRequirement(ctx context.Context, project models.ProjectEntry, requirement models.ProjectRequirement, deleteItems bool) (*models.Project, error) }