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:
parent
78eca0d546
commit
a9e3572573
3 changed files with 9 additions and 0 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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] = {}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue