feat: Added moment_count field to CreatorDetail schema, router query (K…

- "backend/schemas.py"
- "backend/routers/creators.py"
- "frontend/src/api/public-client.ts"

GSD-Task: S02/T01
This commit is contained in:
jlightner 2026-04-03 08:58:05 +00:00
parent 78eca0d546
commit a9e3572573
3 changed files with 9 additions and 0 deletions

View file

@ -129,6 +129,13 @@ async def get_creator(
.where(SourceVideo.creator_id == creator.id)
)).scalar() or 0
# Moment count (key moments across all creator's videos)
moment_count = (await db.execute(
select(func.count()).select_from(KeyMoment)
.join(SourceVideo, KeyMoment.source_video_id == SourceVideo.id)
.where(SourceVideo.creator_id == creator.id)
)).scalar() or 0
# Technique pages for this creator
technique_rows = (await db.execute(
select(

View file

@ -58,6 +58,7 @@ class CreatorDetail(CreatorRead):
featured: bool = False
video_count: int = 0
technique_count: int = 0
moment_count: int = 0
techniques: list[CreatorTechniqueItem] = []
genre_breakdown: dict[str, int] = {}

View file

@ -196,6 +196,7 @@ export interface CreatorDetailResponse {
featured: boolean;
avatar_url: string | null;
technique_count: number;
moment_count: number;
techniques: CreatorTechniqueItem[];
genre_breakdown: Record<string, number>;
}