memos/store/reaction.go

40 lines
865 B
Go
Raw Normal View History

2024-02-07 23:40:23 +08:00
package store
import (
"context"
storepb "github.com/usememos/memos/proto/gen/store"
)
2024-04-13 11:54:37 +08:00
type Reaction struct {
ID int32
CreatedTs int64
CreatorID int32
// ContentID is the id of the content that the reaction is for.
// This can be a memo. e.g. memos/101
ContentID string
ReactionType storepb.ReactionType
}
2024-02-07 23:40:23 +08:00
type FindReaction struct {
ID *int32
CreatorID *int32
ContentID *string
}
type DeleteReaction struct {
ID int32
}
2024-04-13 11:54:37 +08:00
func (s *Store) UpsertReaction(ctx context.Context, upsert *Reaction) (*Reaction, error) {
2024-02-08 11:54:59 +08:00
return s.driver.UpsertReaction(ctx, upsert)
2024-02-07 23:40:23 +08:00
}
2024-04-13 11:54:37 +08:00
func (s *Store) ListReactions(ctx context.Context, find *FindReaction) ([]*Reaction, error) {
2024-02-07 23:40:23 +08:00
return s.driver.ListReactions(ctx, find)
}
func (s *Store) DeleteReaction(ctx context.Context, delete *DeleteReaction) error {
return s.driver.DeleteReaction(ctx, delete)
}