Add Verifik RETHUS integration: backend module, settings auth flow, admin query button
- verifik.service.ts: email OTP auth, token storage/refresh, RETHUS query by professional - verifik.controller.ts: send-otp, confirm, refresh, rethus/professional/:id endpoints - settings/page.tsx: Verifik connection section (email→OTP→token) - professionals/[id]/page.tsx: Consultar RETHUS button with inline result display Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
66bc47b6e1
commit
0a67f5d80a
@@ -0,0 +1,43 @@
|
||||
import { Controller, Post, Get, Body, Param, Query, UseGuards } from '@nestjs/common';
|
||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { VerifikService } from './verifik.service';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
|
||||
@ApiTags('Verifik')
|
||||
@Controller('verifik')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
export class VerifikController {
|
||||
constructor(private verifik: VerifikService) {}
|
||||
|
||||
@Get('status')
|
||||
status() { return this.verifik.getStatus(); }
|
||||
|
||||
@Post('send-otp')
|
||||
sendOtp(@Body() body: { email: string }) {
|
||||
return this.verifik.sendOtp(body.email);
|
||||
}
|
||||
|
||||
@Post('confirm')
|
||||
confirm(@Body() body: { email: string; otp: string }) {
|
||||
return this.verifik.confirmOtp(body.email, body.otp);
|
||||
}
|
||||
|
||||
@Post('refresh')
|
||||
refresh() { return this.verifik.refreshToken(); }
|
||||
|
||||
// Query by professional ID — looks up cedula from DB
|
||||
@Get('rethus/professional/:id')
|
||||
rethusByProfessional(@Param('id') id: string) {
|
||||
return this.verifik.queryRethusByProfessional(id);
|
||||
}
|
||||
|
||||
// Direct query by document
|
||||
@Get('rethus')
|
||||
rethus(
|
||||
@Query('documentType') documentType: string,
|
||||
@Query('documentNumber') documentNumber: string,
|
||||
) {
|
||||
return this.verifik.queryRethus(documentType, documentNumber);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user