2024-03-20 19:32:04 +01:00
|
|
|
import { Body, Controller, Get, Post, Query } from '@nestjs/common';
|
|
|
|
import { ApiTags } from '@nestjs/swagger';
|
2023-10-14 19:12:59 +02:00
|
|
|
import {
|
|
|
|
AuditDeletesDto,
|
|
|
|
AuditDeletesResponseDto,
|
|
|
|
FileChecksumDto,
|
|
|
|
FileChecksumResponseDto,
|
|
|
|
FileReportDto,
|
|
|
|
FileReportFixDto,
|
2024-03-20 19:32:04 +01:00
|
|
|
} from 'src/domain/audit/audit.dto';
|
|
|
|
import { AuditService } from 'src/domain/audit/audit.service';
|
|
|
|
import { AuthDto } from 'src/domain/auth/auth.dto';
|
2024-03-20 21:15:01 +01:00
|
|
|
import { AdminRoute, Auth, Authenticated } from 'src/middleware/auth.guard';
|
2023-08-24 21:28:50 +02:00
|
|
|
|
|
|
|
@ApiTags('Audit')
|
|
|
|
@Controller('audit')
|
|
|
|
@Authenticated()
|
|
|
|
export class AuditController {
|
|
|
|
constructor(private service: AuditService) {}
|
|
|
|
|
|
|
|
@Get('deletes')
|
2023-12-10 05:34:12 +01:00
|
|
|
getAuditDeletes(@Auth() auth: AuthDto, @Query() dto: AuditDeletesDto): Promise<AuditDeletesResponseDto> {
|
|
|
|
return this.service.getDeletes(auth, dto);
|
2023-08-24 21:28:50 +02:00
|
|
|
}
|
2023-10-14 19:12:59 +02:00
|
|
|
|
|
|
|
@AdminRoute()
|
|
|
|
@Get('file-report')
|
|
|
|
getAuditFiles(): Promise<FileReportDto> {
|
|
|
|
return this.service.getFileReport();
|
|
|
|
}
|
|
|
|
|
|
|
|
@AdminRoute()
|
|
|
|
@Post('file-report/checksum')
|
|
|
|
getFileChecksums(@Body() dto: FileChecksumDto): Promise<FileChecksumResponseDto[]> {
|
|
|
|
return this.service.getChecksums(dto);
|
|
|
|
}
|
|
|
|
|
|
|
|
@AdminRoute()
|
|
|
|
@Post('file-report/fix')
|
|
|
|
fixAuditFiles(@Body() dto: FileReportFixDto): Promise<void> {
|
|
|
|
return this.service.fixItems(dto.items);
|
|
|
|
}
|
2023-08-24 21:28:50 +02:00
|
|
|
}
|