Adding fits

This commit is contained in:
Ian Roddis committed 2026-07-14 15:24:05 -03:00
1 parent 8185f1f8b3
commit ab39191af5
19 files changed
+1253 -1

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
from sqlalchemy.ext.asyncio import AsyncSession
from app.models.fit import Fit, FitNote
from app.models.user import User
async def create(db: AsyncSession, *, fit: Fit, author: User, body: str) -> FitNote:
note = FitNote(
fit_id=fit.id,
user_id=author.id,
username=author.full_name or author.email,
body=body,
)
db.add(note)
await db.commit()
await db.refresh(note)
return note