fix: fix 204 response in titles.py and voices.py delete endpoints
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled
Deploy / Build Production Runtime Images (push) Has been cancelled
Deploy / Deploy Production (push) Has been cancelled
Deploy / Production Browser E2E (push) Has been cancelled

This commit is contained in:
CI Test
2026-06-28 17:14:17 +08:00
parent f782e49829
commit be102d0088
2 changed files with 8 additions and 6 deletions
+4 -3
View File
@@ -3,7 +3,7 @@ from __future__ import annotations
from typing import Optional
from fastapi import APIRouter, Depends, HTTPException, Query, status
from fastapi import APIRouter, Depends, HTTPException, Query, Response, status
from app.auth import AuthenticatedUser, get_current_user
from app.dependencies import get_db_session, get_user_repository
@@ -142,14 +142,15 @@ def update_title(
return _to_response(item)
@router.delete("/{title_id}", status_code=status.HTTP_204_NO_CONTENT)
@router.delete("/{title_id}", status_code=status.HTTP_204_NO_CONTENT, response_class=Response)
def delete_title(
title_id: str,
authenticated_user: AuthenticatedUser = Depends(get_current_user),
title_repository: SQLAlchemyTitleLibraryRepository = Depends(_get_title_repository),
) -> None:
) -> Response:
user_id = authenticated_user.user.id
use_case = DeleteTitleLibraryUseCase(title_repository)
deleted = use_case.execute(title_id, user_id)
if not deleted:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Title not found")
return Response(status_code=204)
+4 -3
View File
@@ -3,7 +3,7 @@ from __future__ import annotations
from typing import Optional
from fastapi import APIRouter, Depends, HTTPException, Query, status
from fastapi import APIRouter, Depends, HTTPException, Query, Response, status
from app.auth import AuthenticatedUser, get_current_user
from app.dependencies import get_db_session, get_user_repository
@@ -157,14 +157,15 @@ def update_voice(
return _to_response(item)
@router.delete("/{voice_id}", status_code=status.HTTP_204_NO_CONTENT)
@router.delete("/{voice_id}", status_code=status.HTTP_204_NO_CONTENT, response_class=Response)
def delete_voice(
voice_id: str,
authenticated_user: AuthenticatedUser = Depends(get_current_user),
voice_repository: SQLAlchemyVoiceLibraryRepository = Depends(_get_voice_repository),
) -> None:
) -> Response:
user_id = authenticated_user.user.id
use_case = DeleteVoiceLibraryUseCase(voice_repository)
deleted = use_case.execute(voice_id, user_id)
if not deleted:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Voice not found")
return Response(status_code=204)