From c5e6b3f2a641655fbea0a54db1b9df1f848555f4 Mon Sep 17 00:00:00 2001 From: dlwhsk0 Date: Tue, 30 Jul 2024 03:49:12 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Voice,=20Image=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC=20=EC=B5=9C=EC=8B=A0=EC=88=9C=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/image_service.py | 2 +- app/services/voice_service.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/image_service.py b/app/services/image_service.py index 9c75f2a..0146fd3 100644 --- a/app/services/image_service.py +++ b/app/services/image_service.py @@ -12,7 +12,7 @@ # 저장된 모든 발췌 이미지 목록 조회 def get_images(db: Session, skip: int = 0, limit: int = 100): - images = db.query(Image).filter(Image.is_deleted == False).offset(skip).limit(limit).all() + images = db.query(Image).filter(Image.is_deleted == False).order_by(desc(Image.created_at)).offset(skip).limit(limit).all() images_details = [ImageDetail( id=image.id, chat_id=image.bubble.chat_id, diff --git a/app/services/voice_service.py b/app/services/voice_service.py index 677c1f8..3f6bdb0 100644 --- a/app/services/voice_service.py +++ b/app/services/voice_service.py @@ -14,7 +14,7 @@ # 저장된 모든 목소리 목록 조회 def get_voices(db: Session, skip: int = 0, limit: int = 100): - voices = db.query(Voice).filter(Voice.is_deleted == False).offset(skip).limit(limit).all() + voices = db.query(Voice).filter(Voice.is_deleted == False).order_by(desc(Voice.created_at)).offset(skip).limit(limit).all() return [VoiceDetail( id=voice.id, chat_id=voice.bubble.chat_id, @@ -106,7 +106,7 @@ def get_voice_count(db: Session, voice_id: int): db.refresh(voice) -# 다운로드 횟수 기준으로 10개 출력 +# 캐릭터 별 다운로드 횟수 기준으로 10개 출력 def get_top_voices_by_character(db: Session, character_id: int): return (db.query(Voice) .join(Voice.bubble) # Image와 Bubble 간의 관계 조인