Skip to content

Commit

Permalink
Merge pull request #153 from 2024-SummerBootcamp-Team/feat/#64
Browse files Browse the repository at this point in the history
[feat/#64] Voice, Image 목록 정렬 최신순으로 변경
  • Loading branch information
dlwhsk0 authored Jul 29, 2024
2 parents 9d0dcdb + c5e6b3f commit 129a2b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/services/image_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions app/services/voice_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 간의 관계 조인
Expand Down

0 comments on commit 129a2b5

Please sign in to comment.