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:
co-authored by
Claude Sonnet 4.6
parent
e7afbf6d7b
commit
abc19505ae
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user