feat(api): SessionRepository, session/song schemas with tags

Adds RehearsalSessionRepository (get_or_create, list_for_band with
counts, get_with_songs). Adds RehearsalSession schemas (Read, Detail,
Update). Extends SongRead/SongUpdate with tags and session_id fields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Steffen Schuhmann
2026-03-29 13:36:52 +02:00
parent f1f4dc5a88
commit f930bb061c
3 changed files with 99 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import uuid
from datetime import datetime
from pydantic import BaseModel, ConfigDict
from rehearsalhub.schemas.song import SongRead
class RehearsalSessionRead(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: uuid.UUID
band_id: uuid.UUID
date: datetime
nc_folder_path: str | None = None
label: str | None = None
notes: str | None = None
created_at: datetime
recording_count: int = 0
class RehearsalSessionDetail(RehearsalSessionRead):
songs: list[SongRead] = []
class RehearsalSessionUpdate(BaseModel):
label: str | None = None
notes: str | None = None

View File

@@ -15,6 +15,7 @@ class SongUpdate(BaseModel):
title: str | None = None
status: Literal["jam", "wip", "arranged", "recorded", "released"] | None = None
notes: str | None = None
tags: list[str] | None = None
global_key: str | None = None
global_bpm: float | None = None
@@ -23,8 +24,10 @@ class SongRead(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: uuid.UUID
band_id: uuid.UUID
session_id: uuid.UUID | None = None
title: str
status: str
tags: list[str] = []
global_key: str | None = None
global_bpm: float | None = None
notes: str | None = None