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

23 lines
1.1 KiB
Go

package domain
import "context"
type Repository interface {
// Contact unique key: owner_uid + source_platform + author_handle
UpsertContactByIdentity(ctx context.Context, c *Contact) (*Contact, error)
GetContact(ctx context.Context, id string) (*Contact, error)
SaveContact(ctx context.Context, c *Contact) error
// RemoveContact hides a contact and closes active follow-ups while retaining history.
RemoveContact(ctx context.Context, ownerUID int64, id string, at int64) error
ListContacts(ctx context.Context, ownerUID int64, f ContactListFilter) ([]*Contact, int64, error)
CountByStage(ctx context.Context, ownerUID int64) (map[string]int, error)
InsertTouch(ctx context.Context, t *ContactTouch) error
ListTouches(ctx context.Context, ownerUID int64, contactID string, page, pageSize int) ([]*ContactTouch, int64, error)
SaveFollowUp(ctx context.Context, f *FollowUp) error
GetFollowUp(ctx context.Context, id string) (*FollowUp, error)
ListFollowUps(ctx context.Context, ownerUID int64, f FollowUpListFilter) ([]*FollowUp, int64, error)
ListDueFollowUps(ctx context.Context, now int64, limit int) ([]*FollowUp, error)
}