feat: edicion de usuarios y profesionales desde el admin

Backend: agrega PATCH /users/:id y PATCH /professionals/:id (protegidos).
Admin: pagina de usuario con edicion de nombre/telefono/ciudad/genero;
pagina de profesional con dos secciones editables independientes
(datos personales y perfil profesional).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-27 08:22:40 -05:00
co-authored by Claude Sonnet 4.6
parent e7afbf6d7b
commit abc19505ae
5 changed files with 338 additions and 197 deletions
@@ -52,6 +52,13 @@ export class ProfessionalsController {
return this.pros.findByUserId(req.user.sub);
}
@Patch(':id')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
updateById(@Param('id') id: string, @Body() dto: UpdateProfessionalDto) {
return this.pros.updateById(id, dto);
}
@Get(':id')
findById(@Param('id') id: string) {
return this.pros.findById(id);
@@ -59,6 +59,12 @@ export class ProfessionalsService {
return prof;
}
async updateById(id: string, data: any) {
const prof = await this.prisma.professionals.findUnique({ where: { id } });
if (!prof) throw new NotFoundException('Profesional no encontrado');
return this.prisma.professionals.update({ where: { id }, data });
}
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');
+7
View File
@@ -37,6 +37,13 @@ export class UsersController {
return this.users.updateFcmToken(req.user.sub, dto.token);
}
@Patch(':id')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
updateById(@Param('id') id: string, @Body() dto: UpdateUserDto) {
return this.users.update(id, dto);
}
@Get(':id')
findById(@Param('id') id: string) {
return this.users.findById(id);