28 lines
646 B
TypeScript
28 lines
646 B
TypeScript
import { IsString, IsOptional, IsInt, IsBoolean } from 'class-validator';
|
|
import { Type, Transform } from 'class-transformer';
|
|
|
|
export class SearchProjectDto {
|
|
@IsString()
|
|
@IsOptional()
|
|
search?: string; // ค้นหาจาก Project Code หรือ Name
|
|
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
@Transform(({ value }) => {
|
|
if (value === 'true') return true;
|
|
if (value === 'false') return false;
|
|
return value;
|
|
})
|
|
isActive?: boolean; // กรองตามสถานะ Active
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Type(() => Number)
|
|
page: number = 1;
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Type(() => Number)
|
|
limit: number = 20;
|
|
}
|