2026-06-30 07:09:44 +00:00
|
|
|
package usecase
|
|
|
|
|
|
|
|
|
|
import "context"
|
|
|
|
|
|
|
|
|
|
type QueueItemSummary struct {
|
2026-06-30 09:10:23 +00:00
|
|
|
ID string
|
|
|
|
|
AccountID string
|
|
|
|
|
PersonaID string
|
|
|
|
|
CopyMissionID string
|
|
|
|
|
CopyDraftID string
|
|
|
|
|
Text string
|
2026-07-03 14:42:19 +00:00
|
|
|
TopicTag string
|
2026-06-30 09:10:23 +00:00
|
|
|
ScheduledAt int64
|
|
|
|
|
Status string
|
|
|
|
|
MediaID string
|
|
|
|
|
Permalink string
|
|
|
|
|
PublishedAt int64
|
|
|
|
|
ErrorMessage string
|
|
|
|
|
RetryCount int
|
|
|
|
|
LastAttemptAt int64
|
|
|
|
|
NextAttemptAt int64
|
|
|
|
|
MissedAt int64
|
|
|
|
|
PausedReason string
|
|
|
|
|
CreateAt int64
|
|
|
|
|
UpdateAt int64
|
2026-06-30 07:09:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type CreateRequest struct {
|
2026-06-30 09:10:23 +00:00
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
AccountID string
|
|
|
|
|
PersonaID string
|
|
|
|
|
CopyMissionID string
|
|
|
|
|
CopyDraftID string
|
|
|
|
|
Text string
|
2026-07-03 14:42:19 +00:00
|
|
|
TopicTag string
|
2026-06-30 09:10:23 +00:00
|
|
|
ScheduledAt int64
|
2026-06-30 07:09:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UpdateRequest struct {
|
|
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
AccountID string
|
|
|
|
|
QueueID string
|
|
|
|
|
Text *string
|
2026-07-03 14:42:19 +00:00
|
|
|
TopicTag *string
|
2026-06-30 07:09:44 +00:00
|
|
|
ScheduledAt *int64
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ListRequest struct {
|
|
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
AccountID string
|
|
|
|
|
Status string
|
|
|
|
|
Page int
|
|
|
|
|
PageSize int
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-30 09:10:23 +00:00
|
|
|
type RangeRequest struct {
|
|
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
AccountID string
|
|
|
|
|
Status string
|
|
|
|
|
StartAt int64
|
|
|
|
|
EndAt int64
|
|
|
|
|
Page int
|
|
|
|
|
PageSize int
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-30 07:09:44 +00:00
|
|
|
type ListResult struct {
|
|
|
|
|
Items []QueueItemSummary
|
|
|
|
|
Total int64
|
|
|
|
|
Page int
|
|
|
|
|
PageSize int
|
|
|
|
|
TotalPages int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PublishHealthSummary struct {
|
|
|
|
|
PendingScheduled int64
|
|
|
|
|
FailedCount int64
|
|
|
|
|
Published7d int64
|
|
|
|
|
TotalLikes7d int
|
|
|
|
|
TotalReplies7d int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PublishHealthCheckpoint struct {
|
|
|
|
|
Checkpoint string
|
|
|
|
|
LikeCount int
|
|
|
|
|
ReplyCount int
|
|
|
|
|
RepostCount int
|
|
|
|
|
QuoteCount int
|
|
|
|
|
Views int
|
|
|
|
|
CheckedAt int64
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PublishHealthItem struct {
|
|
|
|
|
MediaID string
|
|
|
|
|
Permalink string
|
|
|
|
|
Text string
|
|
|
|
|
PublishedAt int64
|
|
|
|
|
LikeCount int
|
|
|
|
|
ReplyCount int
|
|
|
|
|
RepostCount int
|
|
|
|
|
QuoteCount int
|
|
|
|
|
Views int
|
|
|
|
|
Shares int
|
|
|
|
|
Checkpoints []PublishHealthCheckpoint
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PublishHealthResult struct {
|
|
|
|
|
Summary PublishHealthSummary
|
|
|
|
|
Items []PublishHealthItem
|
|
|
|
|
Total int64
|
|
|
|
|
Page int
|
|
|
|
|
PageSize int
|
|
|
|
|
TotalPages int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type RecordPublishedRequest struct {
|
2026-06-30 09:10:23 +00:00
|
|
|
TenantID string
|
|
|
|
|
OwnerUID string
|
|
|
|
|
AccountID string
|
|
|
|
|
PersonaID string
|
|
|
|
|
CopyMissionID string
|
|
|
|
|
CopyDraftID string
|
|
|
|
|
Text string
|
2026-07-03 14:42:19 +00:00
|
|
|
TopicTag string
|
2026-06-30 09:10:23 +00:00
|
|
|
MediaID string
|
|
|
|
|
Permalink string
|
|
|
|
|
PublishedAt int64
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SlotInsight struct {
|
|
|
|
|
Weekday int
|
|
|
|
|
Time string
|
|
|
|
|
AvgLikes1h int
|
|
|
|
|
AvgReplies1h int
|
|
|
|
|
AvgLikes24h int
|
|
|
|
|
AvgReplies24h int
|
|
|
|
|
AvgLikes7d int
|
|
|
|
|
AvgReplies7d int
|
|
|
|
|
SampleSize int
|
|
|
|
|
Recommendation string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Alert struct {
|
|
|
|
|
Type string
|
|
|
|
|
Severity string
|
|
|
|
|
Message string
|
|
|
|
|
QueueID string
|
|
|
|
|
AccountID string
|
|
|
|
|
CreateAt int64
|
2026-06-30 07:09:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UseCase interface {
|
|
|
|
|
Create(ctx context.Context, req CreateRequest) (*QueueItemSummary, error)
|
|
|
|
|
RecordPublished(ctx context.Context, req RecordPublishedRequest) (*QueueItemSummary, error)
|
|
|
|
|
Get(ctx context.Context, tenantID, ownerUID, accountID, queueID string) (*QueueItemSummary, error)
|
2026-07-01 08:42:51 +00:00
|
|
|
ListByIDs(ctx context.Context, tenantID, ownerUID string, ids []string) ([]QueueItemSummary, error)
|
2026-06-30 07:09:44 +00:00
|
|
|
List(ctx context.Context, req ListRequest) (*ListResult, error)
|
2026-06-30 09:10:23 +00:00
|
|
|
ListRange(ctx context.Context, req RangeRequest) (*ListResult, error)
|
2026-06-30 07:09:44 +00:00
|
|
|
Update(ctx context.Context, req UpdateRequest) (*QueueItemSummary, error)
|
|
|
|
|
Cancel(ctx context.Context, tenantID, ownerUID, accountID, queueID string) (*QueueItemSummary, error)
|
2026-06-30 09:10:23 +00:00
|
|
|
Retry(ctx context.Context, tenantID, ownerUID, accountID, queueID string) (*QueueItemSummary, error)
|
2026-06-30 07:09:44 +00:00
|
|
|
Delete(ctx context.Context, tenantID, ownerUID, accountID, queueID string) error
|
|
|
|
|
DispatchDue(ctx context.Context, limit int) (int, error)
|
2026-06-30 09:10:23 +00:00
|
|
|
MarkMissed(ctx context.Context, graceNs int64, limit int) (int, error)
|
|
|
|
|
ListAlerts(ctx context.Context, tenantID, ownerUID, accountID string) ([]Alert, error)
|
|
|
|
|
ListSlotInsights(ctx context.Context, tenantID, ownerUID, accountID, timezone string) ([]SlotInsight, error)
|
2026-06-30 07:09:44 +00:00
|
|
|
ListPublishHealth(ctx context.Context, tenantID, ownerUID, accountID string, page, pageSize int) (*PublishHealthResult, error)
|
|
|
|
|
}
|