Merge remote-tracking branch 'origin/main' into feat/apps-in-toss

This commit is contained in:
minaChoi committed 2026-10-26 15:33:39 +09:00
commit 2627dd2685
200 files changed
+2956 -843

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
from typing import Optional
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import defer
from common.database.model.models import Reel
class ReelCRUD:
async def create(self, s: AsyncSession, reel: Reel) -> Reel:
s.add(reel)
await s.flush()
return reel
async def get(self, s: AsyncSession, reel_id: int) -> Optional[Reel]:
return await s.get(Reel, reel_id)
async def recent(self, s: AsyncSession, limit: int) -> list[Reel]:
"""만든 순서 역순. 영상·표지 바이트는 안 읽는다."""
return list((await s.scalars(select(Reel).options(defer(Reel.video), defer(Reel.cover)).order_by(Reel.reel_id.desc()).limit(limit))).all())
async def video(self, s: AsyncSession, reel_id: int) -> Optional[bytes]:
return await s.scalar(select(Reel.video).where(Reel.reel_id == reel_id))
async def cover(self, s: AsyncSession, reel_id: int) -> Optional[bytes]:
return await s.scalar(select(Reel.cover).where(Reel.reel_id == reel_id))