F4.7 · endpoints de reincidencia
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { Body, Controller, Get, Param, ParseUUIDPipe, Post, Query, Req } from '@nestjs/common';
|
||||
import { CurrentAuth } from '../auth/decorators/current-auth.decorator';
|
||||
import { RequirePermissions } from '../authorization/decorators/require-permissions.decorator';
|
||||
import type { AuthPrincipal, RequestWithContext } from '../common/http/request-context';
|
||||
import { CreateRecurrentInspectionFindingDto } from './dto/create-recurrent-inspection-finding.dto';
|
||||
import { InspectionFindingRecurrenceService } from './inspection-finding-recurrence.service';
|
||||
|
||||
@Controller('inspection-acts/:actId/findings')
|
||||
export class InspectionFindingRecurrenceController {
|
||||
constructor(private readonly recurrence: InspectionFindingRecurrenceService) {}
|
||||
|
||||
@Get('recurrence-candidates')
|
||||
@RequirePermissions('inspection_findings.read')
|
||||
candidates(
|
||||
@Param('actId', new ParseUUIDPipe({ version: '4' })) actId: string,
|
||||
@Query('assetId', new ParseUUIDPipe({ version: '4' })) assetId: string,
|
||||
) {
|
||||
return this.recurrence.candidates(actId, assetId);
|
||||
}
|
||||
|
||||
@Post('recurrence')
|
||||
@RequirePermissions('inspection_findings.create')
|
||||
create(
|
||||
@Param('actId', new ParseUUIDPipe({ version: '4' })) actId: string,
|
||||
@Body() dto: CreateRecurrentInspectionFindingDto,
|
||||
@CurrentAuth() principal: AuthPrincipal,
|
||||
@Req() request: RequestWithContext,
|
||||
) {
|
||||
return this.recurrence.create(actId, dto, principal, request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user