Add rejection retry flow with configurable wait days

- Backend: DELETE /professionals/me resets rejected state so user can retry
- Backend: findRejected/findPending now filter by pro_state
- Admin settings: rejection_wait_days field (default 7)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-28 18:03:13 -05:00
co-authored by Claude Sonnet 4.6
parent 3fd7a33fc1
commit 0899105a52
3 changed files with 45 additions and 2 deletions
@@ -162,12 +162,22 @@ export class ProfessionalsService {
if (!prof) throw new NotFoundException('Profesional no encontrado');
await this.prisma.$transaction([
this.prisma.professionals.update({ where: { id: professionalId }, data: { is_active: false } }),
this.prisma.professionals.update({ where: { id: professionalId }, data: { is_active: false, updated_at: new Date() } }),
this.prisma.users.update({ where: { id: prof.user_id }, data: { pro_state: 3 } }),
]);
return { message: 'Solicitud rechazada' };
}
async resetRejected(userId: string) {
const prof = await this.prisma.professionals.findUnique({ where: { user_id: userId } });
if (!prof) throw new NotFoundException('No se encontró solicitud');
await this.prisma.$transaction([
this.prisma.professionals.delete({ where: { user_id: userId } }),
this.prisma.users.update({ where: { id: userId }, data: { pro_state: 0 } }),
]);
return { message: 'Solicitud eliminada' };
}
async deactivate(id: string) {
const prof = await this.prisma.professionals.findUnique({ where: { id } });
if (!prof) throw new NotFoundException('Profesional no encontrado');