2024-04-20 02:35:54 +02:00
|
|
|
import { Body, Controller, Get, Post } from '@nestjs/common';
|
|
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
|
|
import { FileChecksumDto, FileChecksumResponseDto, FileReportDto, FileReportFixDto } from 'src/dtos/audit.dto';
|
2024-05-09 19:58:44 +02:00
|
|
|
import { Authenticated } from 'src/middleware/auth.guard';
|
2024-04-20 02:35:54 +02:00
|
|
|
import { AuditService } from 'src/services/audit.service';
|
|
|
|
|
2024-05-30 00:26:57 +02:00
|
|
|
@ApiTags('File Reports')
|
2024-05-22 19:24:57 +02:00
|
|
|
@Controller('reports')
|
2024-04-20 02:35:54 +02:00
|
|
|
export class ReportController {
|
|
|
|
constructor(private service: AuditService) {}
|
|
|
|
|
|
|
|
@Get()
|
2024-05-09 19:58:44 +02:00
|
|
|
@Authenticated({ admin: true })
|
2024-04-20 02:35:54 +02:00
|
|
|
getAuditFiles(): Promise<FileReportDto> {
|
|
|
|
return this.service.getFileReport();
|
|
|
|
}
|
|
|
|
|
2024-05-09 19:58:44 +02:00
|
|
|
@Post('checksum')
|
|
|
|
@Authenticated({ admin: true })
|
2024-04-20 02:35:54 +02:00
|
|
|
getFileChecksums(@Body() dto: FileChecksumDto): Promise<FileChecksumResponseDto[]> {
|
|
|
|
return this.service.getChecksums(dto);
|
|
|
|
}
|
|
|
|
|
2024-05-09 19:58:44 +02:00
|
|
|
@Post('fix')
|
|
|
|
@Authenticated({ admin: true })
|
2024-04-20 02:35:54 +02:00
|
|
|
fixAuditFiles(@Body() dto: FileReportFixDto): Promise<void> {
|
|
|
|
return this.service.fixItems(dto.items);
|
|
|
|
}
|
|
|
|
}
|