chore: import DH V2 D5.6.4 production baseline
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Param,
|
||||
ParseUUIDPipe,
|
||||
Patch,
|
||||
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 { CloseInspectionFindingDto } from './dto/close-inspection-finding.dto';
|
||||
import { CreateInspectionFindingDto } from './dto/create-inspection-finding.dto';
|
||||
import { ListInspectionFindingsQueryDto } from './dto/list-inspection-findings-query.dto';
|
||||
import { UpdateInspectionFindingFollowUpDto } from './dto/update-inspection-finding-follow-up.dto';
|
||||
import { UpdateInspectionFindingDto } from './dto/update-inspection-finding.dto';
|
||||
import { InspectionFindingsService } from './inspection-findings.service';
|
||||
|
||||
@Controller('inspection-acts/:actId/findings')
|
||||
export class InspectionActFindingsController {
|
||||
constructor(private readonly findings: InspectionFindingsService) {}
|
||||
|
||||
@Get()
|
||||
@RequirePermissions('inspection_findings.read')
|
||||
list(@Param('actId', new ParseUUIDPipe({ version: '4' })) actId: string) {
|
||||
return this.findings.listForAct(actId);
|
||||
}
|
||||
|
||||
@Post()
|
||||
@RequirePermissions('inspection_findings.create')
|
||||
create(
|
||||
@Param('actId', new ParseUUIDPipe({ version: '4' })) actId: string,
|
||||
@Body() dto: CreateInspectionFindingDto,
|
||||
@CurrentAuth() principal: AuthPrincipal,
|
||||
@Req() request: RequestWithContext,
|
||||
) {
|
||||
return this.findings.create(actId, dto, principal, request);
|
||||
}
|
||||
}
|
||||
|
||||
@Controller('inspection-findings')
|
||||
export class InspectionFindingsController {
|
||||
constructor(private readonly findings: InspectionFindingsService) {}
|
||||
|
||||
@Get()
|
||||
@RequirePermissions('inspection_findings.read')
|
||||
list(@Query() query: ListInspectionFindingsQueryDto) {
|
||||
return this.findings.listGlobal(query);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@RequirePermissions('inspection_findings.read')
|
||||
get(@Param('id', new ParseUUIDPipe({ version: '4' })) id: string) {
|
||||
return this.findings.getById(id);
|
||||
}
|
||||
|
||||
@Get(':id/verification-history')
|
||||
@RequirePermissions('inspection_findings.read')
|
||||
getVerificationHistory(@Param('id', new ParseUUIDPipe({ version: '4' })) id: string) {
|
||||
return this.findings.getVerificationHistory(id);
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
@RequirePermissions('inspection_findings.update')
|
||||
update(
|
||||
@Param('id', new ParseUUIDPipe({ version: '4' })) id: string,
|
||||
@Body() dto: UpdateInspectionFindingDto,
|
||||
@CurrentAuth() principal: AuthPrincipal,
|
||||
@Req() request: RequestWithContext,
|
||||
) {
|
||||
return this.findings.update(id, dto, principal, request);
|
||||
}
|
||||
|
||||
@Patch(':id/close')
|
||||
@RequirePermissions('inspection_findings.close')
|
||||
close(
|
||||
@Param('id', new ParseUUIDPipe({ version: '4' })) id: string,
|
||||
@Body() dto: CloseInspectionFindingDto,
|
||||
@CurrentAuth() principal: AuthPrincipal,
|
||||
@Req() request: RequestWithContext,
|
||||
) {
|
||||
return this.findings.close(id, dto, principal, request);
|
||||
}
|
||||
|
||||
@Patch(':id/follow-up')
|
||||
@RequirePermissions('inspection_findings.follow_up')
|
||||
updateFollowUp(
|
||||
@Param('id', new ParseUUIDPipe({ version: '4' })) id: string,
|
||||
@Body() dto: UpdateInspectionFindingFollowUpDto,
|
||||
@CurrentAuth() principal: AuthPrincipal,
|
||||
@Req() request: RequestWithContext,
|
||||
) {
|
||||
return this.findings.updateFollowUp(id, dto, principal, request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user