From b0e34675652536959b69be6630340d899d3ecfac Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Mon, 29 Jun 2026 10:03:31 -0500 Subject: [PATCH] Fix resetRejected: always reset pro_state even without professional record Previous code deleted the professional record; if pro_state=3 but no record exists, the 404 blocked the retry. Now we unconditionally reset pro_state=0. Co-Authored-By: Claude Sonnet 4.6 --- backend/src/professionals/professionals.service.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/backend/src/professionals/professionals.service.ts b/backend/src/professionals/professionals.service.ts index add597e..7f15ff8 100644 --- a/backend/src/professionals/professionals.service.ts +++ b/backend/src/professionals/professionals.service.ts @@ -179,9 +179,7 @@ export class ProfessionalsService { } async resetRejected(userId: string) { - const prof = await this.prisma.professionals.findUnique({ where: { user_id: userId } }); - if (!prof) throw new NotFoundException('No se encontrĂ³ solicitud'); - // Reset to 0 without deleting — avoids FK constraint errors from services/reputations + // Always reset pro_state regardless of whether a professional record exists await this.prisma.users.update({ where: { id: userId }, data: { pro_state: 0 } }); return { message: 'Solicitud reiniciada' }; }