File size: 1,446 Bytes
f5957a1
 
 
aa3bec5
f5957a1
 
 
aa3bec5
 
 
 
f5957a1
 
 
 
aa3bec5
 
 
 
f5957a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { IsOptional, IsNumber, IsDateString, IsEnum, IsString, Min } from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { ApiPropertyStringEnumOptional } from '../../../common/swagger/string-enum.schema';
import { ErrorType, ErrorSeverity } from '../entities/system-error.entity';

export class ErrorQueryDto {
  @ApiPropertyStringEnumOptional({
    description: 'Filter by error type',
    enumObject: ErrorType,
  })
  @IsOptional()
  @IsEnum(ErrorType)
  errorType?: ErrorType;

  @ApiPropertyStringEnumOptional({
    description: 'Filter by severity',
    enumObject: ErrorSeverity,
  })
  @IsOptional()
  @IsEnum(ErrorSeverity)
  severity?: ErrorSeverity;

  @ApiPropertyOptional({ description: 'Filter by resolved status (0 or 1)' })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  isResolved?: number;

  @ApiPropertyOptional({ description: 'Start date (ISO format)' })
  @IsOptional()
  @IsDateString()
  startDate?: string;

  @ApiPropertyOptional({ description: 'End date (ISO format)' })
  @IsOptional()
  @IsDateString()
  endDate?: string;

  @ApiPropertyOptional({ description: 'Page number', default: 1 })
  @IsOptional()
  @IsNumber()
  @Min(1)
  @Type(() => Number)
  page?: number = 1;

  @ApiPropertyOptional({ description: 'Items per page', default: 20 })
  @IsOptional()
  @IsNumber()
  @Min(1)
  @Type(() => Number)
  limit?: number = 20;
}