feat: 인스타 릴스 — 릴스 mp4 저장·공개 주소(/v1/reel)·REELS 게시 API, 관리자 relay, 소개 릴스 HyperFrames 프로젝트·배경 5장, 인스타 올리기 nginx 타임아웃 600s
This commit is contained in:
1 parent
70fe14ae39
commit
7469e58a89
64 files changed
+928
-11
No files matched your search
@@ -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))
|
||||
Reference in new issue
Block a user