62 lines
1.3 KiB
TypeScript
62 lines
1.3 KiB
TypeScript
import {
|
|
IsDateString,
|
|
IsEnum,
|
|
IsIn,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString,
|
|
Min,
|
|
} from 'class-validator';
|
|
import { Type } from 'class-transformer';
|
|
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { CashShiftStatus } from '../interface/cash-shift.interface';
|
|
|
|
const sortOrderOptions = ['asc', 'desc'] as const;
|
|
type SortOrder = (typeof sortOrderOptions)[number];
|
|
|
|
export class FindCashShiftsDto {
|
|
@ApiPropertyOptional({ default: 1, minimum: 1 })
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsNumber()
|
|
@Min(1)
|
|
page: number = 1;
|
|
|
|
@ApiPropertyOptional({ default: 10, minimum: 1 })
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsNumber()
|
|
@Min(1)
|
|
limit: number = 10;
|
|
|
|
@ApiPropertyOptional({ enum: CashShiftStatus })
|
|
@IsOptional()
|
|
@IsEnum(CashShiftStatus)
|
|
status?: CashShiftStatus;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
adminId?: string;
|
|
|
|
@ApiPropertyOptional({ format: 'date-time' })
|
|
@IsOptional()
|
|
@IsDateString()
|
|
startDate?: string;
|
|
|
|
@ApiPropertyOptional({ format: 'date-time' })
|
|
@IsOptional()
|
|
@IsDateString()
|
|
endDate?: string;
|
|
|
|
@ApiPropertyOptional({ default: 'openedAt' })
|
|
@IsOptional()
|
|
@IsString()
|
|
orderBy: string = 'openedAt';
|
|
|
|
@ApiPropertyOptional({ enum: sortOrderOptions, default: 'desc' })
|
|
@IsOptional()
|
|
@IsIn(sortOrderOptions)
|
|
order: SortOrder = 'desc';
|
|
}
|