O2Sound_ver2_final/backend/app/repositories/photo_repository.py

17 lines
636 B
Python

from sqlalchemy.orm import Session
from app.domain.models.photo import Photo
from app.repositories.base_repository import BaseRepository
from uuid import UUID
from typing import List
class PhotoRepository(BaseRepository[Photo]):
'''사진 레포지토리'''
def __init__(self, db: Session):
super().__init__(Photo, db)
def get_by_order_id(self, order_id: UUID) -> List[Photo]:
'''주문 ID로 사진들 조회 (video_index 순서대로)'''
return self.db.query(Photo).filter(
Photo.order_id == order_id,
Photo.deleted == False
).order_by(Photo.video_index).all()