mirror of
https://github.com/immich-app/immich.git
synced 2026-03-22 23:38:59 +03:00
refactor: use GET/Query for report fetch
Signed-off-by: izzy <me@insrt.uk>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user