memos/store/reaction.go
Copilot b685ffacdf refactor: memo filter
- Updated memo and reaction filtering logic to use a unified engine for compiling filter expressions into SQL statements.
- Removed redundant filter parsing and conversion code from ListMemoRelations, ListReactions, and ListAttachments methods.
- Introduced IDList and UIDList fields in FindMemo and FindReaction structs to support filtering by multiple IDs.
- Removed old filter test files for reactions and attachments, as the filtering logic has been centralized.
- Updated tests for memo filtering to reflect the new SQL statement compilation approach.
- Ensured that unsupported user filters return an error in ListUsers method.
2025-10-16 09:22:52 +08:00

37 lines
794 B
Go

package store
import (
"context"
)
type Reaction struct {
ID int32
CreatedTs int64
CreatorID int32
// ContentID is the id of the content that the reaction is for.
ContentID string
ReactionType string
}
type FindReaction struct {
ID *int32
CreatorID *int32
ContentID *string
ContentIDList []string
}
type DeleteReaction struct {
ID int32
}
func (s *Store) UpsertReaction(ctx context.Context, upsert *Reaction) (*Reaction, error) {
return s.driver.UpsertReaction(ctx, upsert)
}
func (s *Store) ListReactions(ctx context.Context, find *FindReaction) ([]*Reaction, error) {
return s.driver.ListReactions(ctx, find)
}
func (s *Store) DeleteReaction(ctx context.Context, delete *DeleteReaction) error {
return s.driver.DeleteReaction(ctx, delete)
}