From 99bb49ee181e7956ec579be9463ec39f39219726 Mon Sep 17 00:00:00 2001 From: alwil17 Date: Thu, 5 Jun 2025 12:03:46 +0000 Subject: [PATCH] fix: update remove_comment method to use DTO for rating update --- app/application/services/rating_service.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/application/services/rating_service.py b/app/application/services/rating_service.py index 20586b4..72c5803 100644 --- a/app/application/services/rating_service.py +++ b/app/application/services/rating_service.py @@ -56,8 +56,10 @@ def remove_comment(self, rating_id: int): if not rating: return None - # Remove the comment but keep the score - rating.comment = None - self.repository.update(rating_id, rating) + # Créer un DTO de mise à jour avec seulement le commentaire à null + update_dto = RatingUpdateDTO(value=rating.value, comment=None) - return rating + # Mettre à jour le rating + updated_rating = self.repository.update(rating_id, update_dto) + + return updated_rating