feat: campo RETHUS con validación manual desde el admin
- Prisma schema: rethus_code y rethus_validated en tabla professionals - Migración 0001: ALTER TABLE agrega ambas columnas - DTO: rethus_code y rethus_validated en CreateProfessionalDto y UpdateProfessionalDto - Service: nuevo método validateRethus, rethus_code incluido en requestProfessional - Controller: endpoint POST /professionals/:id/validate-rethus (JWT protegido) - Admin listado pendientes: columna RETHUS con ícono verde/amarillo y enlace al detalle - Admin detalle profesional: card de validación RETHUS con botón consultar Minsalud y marcar como validado Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
46fcb57edf
commit
c1e9dba2d1
@@ -15,6 +15,10 @@ export class CreateProfessionalDto {
|
||||
@IsString()
|
||||
additional_address?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
rethus_code?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
identification_picture?: string;
|
||||
@@ -41,6 +45,14 @@ export class UpdateProfessionalDto {
|
||||
@IsString()
|
||||
profession?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
rethus_code?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
rethus_validated?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
rate?: number;
|
||||
|
||||
@@ -43,6 +43,13 @@ export class ProfessionalsController {
|
||||
return this.pros.deny(id);
|
||||
}
|
||||
|
||||
@Post(':id/validate-rethus')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
validateRethus(@Param('id') id: string) {
|
||||
return this.pros.validateRethus(id);
|
||||
}
|
||||
|
||||
@Get('me')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
|
||||
@@ -149,6 +149,13 @@ export class ProfessionalsService {
|
||||
return { message: 'Solicitud rechazada' };
|
||||
}
|
||||
|
||||
async validateRethus(id: string) {
|
||||
const prof = await this.prisma.professionals.findUnique({ where: { id } });
|
||||
if (!prof) throw new NotFoundException('Profesional no encontrado');
|
||||
await this.prisma.professionals.update({ where: { id }, data: { rethus_validated: true } });
|
||||
return { message: 'RETHUS validado correctamente' };
|
||||
}
|
||||
|
||||
async requestProfessional(userId: string, data: any) {
|
||||
const existing = await this.prisma.professionals.findUnique({ where: { user_id: userId } });
|
||||
if (existing) throw new BadRequestException('Ya tienes una solicitud de profesional');
|
||||
@@ -161,6 +168,7 @@ export class ProfessionalsService {
|
||||
profession: data.profession,
|
||||
address: data.address,
|
||||
additional_address: data.additional_address,
|
||||
rethus_code: data.rethus_code ?? null,
|
||||
identification_picture: data.identification_picture,
|
||||
certificate_picture: data.certificate_picture,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user