Files
backend/src/power-clamp/dto/get-power-clamp.dto.ts

46 lines
1.1 KiB
TypeScript

import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsOptional, IsDateString, Matches, IsNotEmpty } from 'class-validator';
export class GetPowerClampDto {
@ApiPropertyOptional({
description: 'Input date in ISO format (YYYY-MM-DD) to filter the data',
example: '2025-04-23',
required: false,
})
@IsOptional()
@IsDateString()
dayDate?: string;
@ApiPropertyOptional({
description: 'Month and year in format YYYY-MM',
example: '2025-03',
required: false,
})
@Matches(/^\d{4}-(0[1-9]|1[0-2])$/, {
message: 'monthDate must be in YYYY-MM format',
})
@IsOptional()
monthDate?: string;
@ApiPropertyOptional({
description: 'Input year in YYYY format to filter the data',
example: '2025',
required: false,
})
@IsOptional()
@Matches(/^\d{4}$/, {
message: 'Year must be in YYYY format',
})
year?: string;
}
export class GetPowerClampBySpaceDto {
@ApiPropertyOptional({
description: 'monthDate must be in YYYY-MM format',
example: '2025-04',
required: true,
})
@IsDateString()
@IsNotEmpty()
public monthDate: string;
}