Add status management and documents view to pro detail page
- Backend: deactivate and set-pending endpoints for status control - Admin detail: Aprobar/Rechazar/Desactivar/En revisión buttons based on current state - Admin detail: Documentos section showing ID photo and certificate - Admin detail: deny now confirms before deleting Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
efb48e017f
commit
7935e48fae
@@ -82,6 +82,20 @@ export class ProfessionalsController {
|
||||
return this.pros.upsert(req.user.sub, dto);
|
||||
}
|
||||
|
||||
@Post(':id/deactivate')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
deactivate(@Param('id') id: string) {
|
||||
return this.pros.deactivate(id);
|
||||
}
|
||||
|
||||
@Post(':id/set-pending')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
setPending(@Param('id') id: string) {
|
||||
return this.pros.setPending(id);
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
|
||||
@@ -155,6 +155,26 @@ export class ProfessionalsService {
|
||||
return { message: 'Solicitud rechazada' };
|
||||
}
|
||||
|
||||
async deactivate(id: string) {
|
||||
const prof = await this.prisma.professionals.findUnique({ where: { id } });
|
||||
if (!prof) throw new NotFoundException('Profesional no encontrado');
|
||||
await this.prisma.$transaction([
|
||||
this.prisma.professionals.update({ where: { id }, data: { is_active: false } }),
|
||||
this.prisma.users.update({ where: { id: prof.user_id }, data: { pro_state: 3 } }),
|
||||
]);
|
||||
return { message: 'Profesional desactivado' };
|
||||
}
|
||||
|
||||
async setPending(id: string) {
|
||||
const prof = await this.prisma.professionals.findUnique({ where: { id } });
|
||||
if (!prof) throw new NotFoundException('Profesional no encontrado');
|
||||
await this.prisma.$transaction([
|
||||
this.prisma.professionals.update({ where: { id }, data: { is_active: false } }),
|
||||
this.prisma.users.update({ where: { id: prof.user_id }, data: { pro_state: 1 } }),
|
||||
]);
|
||||
return { message: 'Profesional puesto en revisión' };
|
||||
}
|
||||
|
||||
async validateRethus(id: string) {
|
||||
const prof = await this.prisma.professionals.findUnique({ where: { id } });
|
||||
if (!prof) throw new NotFoundException('Profesional no encontrado');
|
||||
|
||||
Reference in New Issue
Block a user