thread-master/apps/backend/internal/module/scout/domain/repository.go

44 lines
2.2 KiB
Go
Raw Permalink Normal View History

2026-07-13 01:15:30 +00:00
package domain
import "context"
type Repository interface {
2026-08-13 02:22:24 +00:00
CreateRun(ctx context.Context, r *Run) error
GetRun(ctx context.Context, ownerUID int64, id string) (*Run, error)
ListRuns(ctx context.Context, filter RunFilter) (RunPage, error)
ListRunPosts(ctx context.Context, ownerUID int64, runID string, page, pageSize int) (RunPostPage, error)
ReplaceRunGuarded(ctx context.Context, ownerUID int64, id string, expected []string, replacement *Run) error
DeleteRun(ctx context.Context, ownerUID int64, id string) error
PublishRunPosts(ctx context.Context, ownerUID int64, runID string, posts []*Post) error
HasSeenIdentity(ctx context.Context, ownerUID int64, identity string) (bool, error)
MarkSeenIdentity(ctx context.Context, ownerUID int64, identity, postID string, seenAt int64) error
2026-07-13 01:15:30 +00:00
SaveBrand(ctx context.Context, b *Brand) error
GetBrand(ctx context.Context, id string) (*Brand, error)
ListBrands(ctx context.Context, ownerUID int64) ([]*Brand, error)
DeleteBrand(ctx context.Context, id string) error
SaveProduct(ctx context.Context, p *Product) error
GetProduct(ctx context.Context, id string) (*Product, error)
ListProducts(ctx context.Context, ownerUID int64, brandID string) ([]*Product, error)
DeleteProduct(ctx context.Context, id string) error
GetActiveBrandID(ctx context.Context, ownerUID int64) (string, error)
SetActiveBrandID(ctx context.Context, ownerUID int64, brandID string) error
SavePost(ctx context.Context, p *Post) error
GetPost(ctx context.Context, id string) (*Post, error)
ListPosts(ctx context.Context, ownerUID int64, brandID string) ([]*Post, error)
DeletePost(ctx context.Context, id string) error
DeletePostsByTheme(ctx context.Context, ownerUID int64, themeKey string) error
SaveHomework(ctx context.Context, h *Homework) error
GetHomework(ctx context.Context, ownerUID int64, themeKey string) (*Homework, error)
ListHomework(ctx context.Context, ownerUID int64) ([]*Homework, error)
DeleteHomework(ctx context.Context, ownerUID int64, themeKey string) error
GetCrawlerSession(ctx context.Context, ownerUID int64) (*CrawlerSession, error)
SetCrawlerSession(ctx context.Context, sess *CrawlerSession) error
ClearCrawlerSession(ctx context.Context, ownerUID int64) error
}