Files
67/services/internal/service/store.go
2026-06-22 22:39:08 +03:00

45 lines
1.8 KiB
Go

package service
import "context"
type ContentFilter struct {
Term string
Category string
ContentType string
SortMode string
Status string
AuthorID string
Mine bool
User UserProfile
Exclude string
Limit int
OnlyEvents bool
OnlyMedia bool
}
type Store interface {
Ping(ctx context.Context) error
UserByLogin(ctx context.Context, login string) (UserProfile, bool, error)
UserByID(ctx context.Context, id string) (UserProfile, bool, error)
AddUser(ctx context.Context, login, name, password string) (UserProfile, error)
UpdatePassword(ctx context.Context, userID, password string) error
ListUsers(ctx context.Context) ([]UserProfile, error)
ListContent(ctx context.Context, filter ContentFilter) ([]ContentItem, error)
ContentByID(ctx context.Context, id string) (ContentItem, bool, error)
AddContent(ctx context.Context, item ContentItem) (ContentItem, error)
PatchContent(ctx context.Context, id string, patch ContentItem) (ContentItem, bool, error)
DeleteContent(ctx context.Context, id string) (bool, error)
ListCategories(ctx context.Context) ([]string, error)
ListTags(ctx context.Context) ([]string, error)
ListSpeakers(ctx context.Context) ([]Speaker, error)
AddFile(ctx context.Context, file StoredFile) (StoredFile, error)
FileByID(ctx context.Context, id string) (StoredFile, bool, error)
UpsertSubscription(ctx context.Context, userID, target string) ([]string, error)
ListNotifications(ctx context.Context) ([]NotificationItem, error)
MarkNotificationRead(ctx context.Context, id string) (*NotificationItem, error)
ListComments(ctx context.Context, contentID string) ([]CommentItem, error)
AddComment(ctx context.Context, contentID string, user UserProfile, text string) (CommentItem, error)
CountComments(ctx context.Context) (int, error)
ListAudit(ctx context.Context) ([]AuditItem, error)
}