Spaces:
Sleeping
Sleeping
update new router delete
Browse files
src/expon/presentation/interfaces/rest/controllers/presentation_controller.py
CHANGED
@@ -20,6 +20,8 @@ from src.expon.presentation.interfaces.rest.responses.presentation_response impo
|
|
20 |
PresentationSummaryResponse
|
21 |
)
|
22 |
|
|
|
|
|
23 |
router = APIRouter()
|
24 |
|
25 |
|
@@ -123,15 +125,22 @@ def delete_presentation(
|
|
123 |
db: Session = Depends(get_db),
|
124 |
current_user=Depends(get_current_user)
|
125 |
):
|
126 |
-
|
127 |
-
|
|
|
|
|
128 |
|
129 |
if presentation is None:
|
130 |
raise HTTPException(status_code=404, detail="Presentaci贸n no encontrada")
|
131 |
|
132 |
-
# Eliminar
|
|
|
|
|
|
|
|
|
|
|
133 |
storage_service = LocalStorageService()
|
134 |
storage_service.delete(presentation.filename)
|
135 |
|
136 |
-
# Eliminar
|
137 |
-
|
|
|
20 |
PresentationSummaryResponse
|
21 |
)
|
22 |
|
23 |
+
from src.expon.feedback.infrastructure.persistence.jpa.feedback_repository import FeedbackRepository
|
24 |
+
|
25 |
router = APIRouter()
|
26 |
|
27 |
|
|
|
125 |
db: Session = Depends(get_db),
|
126 |
current_user=Depends(get_current_user)
|
127 |
):
|
128 |
+
presentation_repo = PresentationRepository(db)
|
129 |
+
feedback_repo = FeedbackRepository(db)
|
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 |
+
# 馃Ч Eliminar feedback relacionado
|
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 |
+
# 馃Ч Eliminar presentaci贸n
|
146 |
+
presentation_repo.delete(presentation)
|