Spaces:
Sleeping
Sleeping
feat: update router delete
Browse files
src/expon/presentation/interfaces/rest/controllers/presentation_controller.py
CHANGED
|
@@ -20,8 +20,6 @@ from src.expon.presentation.interfaces.rest.responses.presentation_response impo
|
|
| 20 |
PresentationSummaryResponse
|
| 21 |
)
|
| 22 |
|
| 23 |
-
from src.expon.feedback.infrastructure.persistence.jpa.feedback_repository import FeedbackRepository
|
| 24 |
-
|
| 25 |
router = APIRouter()
|
| 26 |
|
| 27 |
|
|
@@ -125,22 +123,15 @@ def delete_presentation(
|
|
| 125 |
db: Session = Depends(get_db),
|
| 126 |
current_user=Depends(get_current_user)
|
| 127 |
):
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
presentation = presentation_repo.get_by_id_and_user(presentation_id, current_user.id)
|
| 132 |
|
| 133 |
if presentation is None:
|
| 134 |
raise HTTPException(status_code=404, detail="Presentaci贸n no encontrada")
|
| 135 |
|
| 136 |
-
#
|
| 137 |
-
feedback = feedback_repo.get_by_presentation(presentation_id)
|
| 138 |
-
if feedback:
|
| 139 |
-
feedback_repo.delete(feedback)
|
| 140 |
-
|
| 141 |
-
# 馃Ч Eliminar archivo de audio
|
| 142 |
storage_service = LocalStorageService()
|
| 143 |
storage_service.delete(presentation.filename)
|
| 144 |
|
| 145 |
-
#
|
| 146 |
-
|
|
|
|
| 20 |
PresentationSummaryResponse
|
| 21 |
)
|
| 22 |
|
|
|
|
|
|
|
| 23 |
router = APIRouter()
|
| 24 |
|
| 25 |
|
|
|
|
| 123 |
db: Session = Depends(get_db),
|
| 124 |
current_user=Depends(get_current_user)
|
| 125 |
):
|
| 126 |
+
repository = PresentationRepository(db)
|
| 127 |
+
presentation = repository.get_by_id_and_user(presentation_id, current_user.id)
|
|
|
|
|
|
|
| 128 |
|
| 129 |
if presentation is None:
|
| 130 |
raise HTTPException(status_code=404, detail="Presentaci贸n no encontrada")
|
| 131 |
|
| 132 |
+
# Eliminar archivo local
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
storage_service = LocalStorageService()
|
| 134 |
storage_service.delete(presentation.filename)
|
| 135 |
|
| 136 |
+
# Eliminar de base de datos
|
| 137 |
+
repository.delete(presentation)
|