feat(kol): workspace KOL cards + article source type
This commit is contained in:
@@ -148,3 +148,27 @@ func (s *WorkspaceService) TemplateCards(ctx context.Context) ([]TemplateCard, e
|
||||
return cards, nil
|
||||
})
|
||||
}
|
||||
|
||||
func (s *WorkspaceService) KolCards(ctx context.Context) ([]domain.KolWorkspaceCard, error) {
|
||||
actor := auth.MustActor(ctx)
|
||||
return sharedcache.LoadJSON(ctx, s.cache, &s.cacheGroup, workspaceKolCardsCacheKey(actor.TenantID), defaultCacheTTL(), func(loadCtx context.Context) ([]domain.KolWorkspaceCard, error) {
|
||||
rows, err := s.repo.ListKolCards(loadCtx, actor.TenantID)
|
||||
if err != nil {
|
||||
return nil, response.ErrInternal(50010, "query_failed", "failed to fetch KOL cards")
|
||||
}
|
||||
|
||||
cards := make([]domain.KolWorkspaceCard, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
cards = append(cards, domain.KolWorkspaceCard{
|
||||
SubscriptionPromptID: row.SubscriptionPromptID,
|
||||
GrantedAt: row.GrantedAt,
|
||||
PromptName: row.PromptName,
|
||||
PlatformHint: row.PlatformHint,
|
||||
PackageName: row.PackageName,
|
||||
PackageCover: row.PackageCover,
|
||||
KolDisplayName: row.KolDisplayName,
|
||||
})
|
||||
}
|
||||
return cards, nil
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user