feat(kol): workspace KOL cards + article source type
This commit is contained in:
@@ -28,6 +28,16 @@ type WorkspacePlan struct {
|
||||
EndAt time.Time
|
||||
}
|
||||
|
||||
type WorkspaceKolCard struct {
|
||||
SubscriptionPromptID int64
|
||||
GrantedAt time.Time
|
||||
PromptName string
|
||||
PlatformHint *string
|
||||
PackageName string
|
||||
PackageCover *string
|
||||
KolDisplayName string
|
||||
}
|
||||
|
||||
type WorkspaceRepository interface {
|
||||
CountArticlesByTenant(ctx context.Context, tenantID int64) (int64, error)
|
||||
CountPublishedArticlesByTenant(ctx context.Context, tenantID int64) (int64, error)
|
||||
@@ -35,6 +45,7 @@ type WorkspaceRepository interface {
|
||||
GetRecentArticles(ctx context.Context, tenantID int64) ([]WorkspaceRecentArticle, error)
|
||||
GetQuotaSummary(ctx context.Context, tenantID int64) (int, error)
|
||||
GetActivePlanForTenant(ctx context.Context, tenantID int64) (*WorkspacePlan, error)
|
||||
ListKolCards(ctx context.Context, tenantID int64) ([]WorkspaceKolCard, error)
|
||||
}
|
||||
|
||||
type workspaceRepository struct {
|
||||
@@ -104,3 +115,25 @@ func (r *workspaceRepository) GetActivePlanForTenant(ctx context.Context, tenant
|
||||
EndAt: timeFromTimestamp(row.EndAt),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *workspaceRepository) ListKolCards(ctx context.Context, tenantID int64) ([]WorkspaceKolCard, error) {
|
||||
rows, err := r.q.ListKolCardsForTenant(ctx, tenantID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cards := make([]WorkspaceKolCard, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
cards = append(cards, WorkspaceKolCard{
|
||||
SubscriptionPromptID: row.SubscriptionPromptID,
|
||||
GrantedAt: timeFromTimestamp(row.GrantedAt),
|
||||
PromptName: row.PromptName,
|
||||
PlatformHint: nullableText(row.PlatformHint),
|
||||
PackageName: row.PackageName,
|
||||
PackageCover: nullableText(row.PackageCover),
|
||||
KolDisplayName: row.KolDisplayName,
|
||||
})
|
||||
}
|
||||
|
||||
return cards, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user