2026-06-24 10:02:42 +00:00
|
|
|
package usecase
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"haixun-backend/internal/library/placement"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ScanReplySummary struct {
|
|
|
|
|
ExternalID string
|
|
|
|
|
Author string
|
|
|
|
|
Text string
|
|
|
|
|
Permalink string
|
|
|
|
|
LikeCount int
|
|
|
|
|
PostedAt string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ScanPostSummary struct {
|
|
|
|
|
ID string
|
|
|
|
|
BrandID string
|
|
|
|
|
PersonaID string
|
|
|
|
|
Flow string
|
|
|
|
|
GraphNodeID string
|
|
|
|
|
SearchTag string
|
|
|
|
|
QueryDimension string
|
|
|
|
|
ExternalID string
|
|
|
|
|
Permalink string
|
|
|
|
|
Author string
|
|
|
|
|
Text string
|
|
|
|
|
Priority string
|
|
|
|
|
LikeCount int
|
|
|
|
|
ReplyCount int
|
|
|
|
|
EngagementScore int
|
|
|
|
|
PlacementScore int
|
|
|
|
|
ProductFitScore int
|
|
|
|
|
SolvedByProduct bool
|
|
|
|
|
Source string
|
|
|
|
|
ScanJobID string
|
|
|
|
|
OutreachStatus string
|
|
|
|
|
PublishedReplyID string
|
|
|
|
|
PublishedPermalink string
|
|
|
|
|
OutreachUpdateAt int64
|
2026-06-24 16:48:56 +00:00
|
|
|
PostedAt string
|
2026-06-24 10:02:42 +00:00
|
|
|
Replies []ScanReplySummary
|
|
|
|
|
CreateAt int64
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ListRequest struct {
|
|
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
BrandID string
|
2026-06-24 16:48:56 +00:00
|
|
|
TopicID string
|
2026-06-24 10:02:42 +00:00
|
|
|
Priority string
|
|
|
|
|
ProductFitMin int
|
|
|
|
|
Recent7dOnly bool
|
|
|
|
|
Limit int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ReplaceRequest struct {
|
|
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
BrandID string
|
|
|
|
|
GraphID string
|
|
|
|
|
ScanJobID string
|
|
|
|
|
Posts []placement.ScanCandidate
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ViralReplaceRequest struct {
|
|
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
PersonaID string
|
|
|
|
|
ScanJobID string
|
|
|
|
|
Posts []placement.ScanCandidate
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PersonaListRequest struct {
|
|
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
PersonaID string
|
|
|
|
|
Limit int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UpdateOutreachRequest struct {
|
|
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
BrandID string
|
|
|
|
|
PostID string
|
|
|
|
|
Status string
|
|
|
|
|
PublishedReplyID string
|
|
|
|
|
PublishedPermalink string
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-24 16:48:56 +00:00
|
|
|
type CheckpointRequest struct {
|
|
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
BrandID string
|
|
|
|
|
GraphID string
|
|
|
|
|
ScanJobID string
|
|
|
|
|
Posts []placement.ScanCandidate
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-24 10:02:42 +00:00
|
|
|
type UseCase interface {
|
2026-06-24 16:48:56 +00:00
|
|
|
ClearBrandScan(ctx context.Context, tenantID, ownerUID, brandID string) error
|
|
|
|
|
UpsertScanCheckpoint(ctx context.Context, req CheckpointRequest) (int, error)
|
|
|
|
|
FinalizeScan(ctx context.Context, req ReplaceRequest) (int, error)
|
2026-06-24 10:02:42 +00:00
|
|
|
ReplaceFromScan(ctx context.Context, req ReplaceRequest) (int, error)
|
|
|
|
|
ReplaceFromViralScan(ctx context.Context, req ViralReplaceRequest) (int, error)
|
|
|
|
|
Get(ctx context.Context, tenantID, ownerUID, brandID, postID string) (*ScanPostSummary, error)
|
|
|
|
|
GetForPersona(ctx context.Context, tenantID, ownerUID, personaID, postID string) (*ScanPostSummary, error)
|
|
|
|
|
UpdateOutreach(ctx context.Context, req UpdateOutreachRequest) (*ScanPostSummary, error)
|
2026-06-24 16:48:56 +00:00
|
|
|
Delete(ctx context.Context, tenantID, ownerUID, brandID, topicID, postID string) error
|
|
|
|
|
DeleteMany(ctx context.Context, tenantID, ownerUID, brandID, topicID string, postIDs []string) (int, error)
|
2026-06-24 10:02:42 +00:00
|
|
|
List(ctx context.Context, req ListRequest) ([]ScanPostSummary, error)
|
|
|
|
|
ListForPersona(ctx context.Context, req PersonaListRequest) ([]ScanPostSummary, error)
|
|
|
|
|
}
|