refactor: use GET/Query for report fetch

Signed-off-by: izzy <me@insrt.uk>
This commit is contained in:
izzy
2026-02-12 10:54:19 +00:00
parent 5ed0ff41e3
commit fbdeb0409e
12 changed files with 103 additions and 227 deletions

View File

@@ -1,4 +1,4 @@
import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Next, Param, Post, Res } from '@nestjs/common';
import { Controller, Delete, Get, HttpCode, HttpStatus, Next, Param, Query, Res } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { NextFunction, Response } from 'express';
import { Endpoint, HistoryBuilder } from 'src/decorators';
@@ -34,7 +34,7 @@ export class IntegrityController {
return this.service.getIntegrityReportSummary();
}
@Post('report')
@Get('report')
@HttpCode(HttpStatus.OK)
@Endpoint({
summary: 'Get integrity report by type',
@@ -42,7 +42,7 @@ export class IntegrityController {
history: new HistoryBuilder().added('v2.6.0').alpha('v2.6.0'),
})
@Authenticated({ permission: Permission.Maintenance, admin: true })
getIntegrityReport(@Body() dto: IntegrityGetReportDto): Promise<IntegrityReportResponseDto> {
getIntegrityReport(@Query() dto: IntegrityGetReportDto): Promise<IntegrityReportResponseDto> {
return this.service.getIntegrityReport(dto);
}

View File

@@ -1,4 +1,4 @@
import { ApiProperty } from '@nestjs/swagger';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsInt, IsOptional, IsUUID, Min } from 'class-validator';
import { IntegrityReportType } from 'src/enum';
@@ -17,10 +17,12 @@ export class IntegrityGetReportDto {
@ValidateEnum({ enum: IntegrityReportType, name: 'IntegrityReportType' })
type!: IntegrityReportType;
@ApiPropertyOptional({ description: 'Cursor for pagination', default: 1 })
@IsOptional()
@IsUUID()
cursor?: string;
@ApiPropertyOptional({ description: 'Number of items per page', default: 500 })
@IsInt()
@Min(1)
@IsOptional()