diff --git a/backend/src/professionals/professionals.service.ts b/backend/src/professionals/professionals.service.ts index cc31842..0236776 100644 --- a/backend/src/professionals/professionals.service.ts +++ b/backend/src/professionals/professionals.service.ts @@ -68,8 +68,12 @@ export class ProfessionalsService { } async upsert(userId: string, data: any) { - const prof = await this.prisma.professionals.findUnique({ where: { user_id: userId } }); - if (!prof) throw new NotFoundException('Debes solicitar ser profesional primero'); + const existing = await this.prisma.professionals.findUnique({ where: { user_id: userId } }); + + if (!existing) { + await this.prisma.users.update({ where: { id: userId }, data: { pro_state: 1 } }); + return this.prisma.professionals.create({ data: { user_id: userId, ...data } }); + } return this.prisma.professionals.update({ where: { user_id: userId }, data }); }