refactor: entity not found exceptions handler

This commit is contained in:
2025-09-16 16:56:10 +04:00
parent 276626d6f7
commit 98d3026e0d
24 changed files with 56 additions and 49 deletions

View File

@ -53,14 +53,8 @@ class DealProductService(ServiceGetAllMixin[DealProduct, DealProductSchema]):
) -> DealProductAddKitResponse:
services_kit_repo = ServicesKitRepository(self.repository.session)
services_kit = await services_kit_repo.get_by_id(request.kit_id)
if not services_kit:
raise HTTPException(status_code=404, detail="Набор услуг не найден")
deal_product = await self.repository.get_by_id(
request.deal_id, request.product_id
)
if not deal_product:
raise HTTPException(status_code=404, detail=self.entity_not_found_msg)
deal_product = await self.repository.get_by_id(request.deal_id, request.product_id)
product_service_repo = ProductServiceRepository(self.repository.session)
await product_service_repo.delete_product_services(