51 lines
889 B
TypeScript
51 lines
889 B
TypeScript
import { Transform, Type } from 'class-transformer';
|
|
import {
|
|
IsEnum,
|
|
IsInt,
|
|
IsISO8601,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
Max,
|
|
MaxLength,
|
|
Min,
|
|
} from 'class-validator';
|
|
import { AssetInformationStatus } from '../../database/entities';
|
|
|
|
const trim = ({ value }: { value: unknown }) =>
|
|
typeof value === 'string' ? value.trim() : value;
|
|
|
|
export class TemporalAtQueryDto {
|
|
@IsISO8601({ strict: true })
|
|
at!: string;
|
|
}
|
|
|
|
export class ListTemporalAssetsQueryDto extends TemporalAtQueryDto {
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
@Min(1)
|
|
page = 1;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
@Min(1)
|
|
@Max(100)
|
|
pageSize = 25;
|
|
|
|
@Transform(trim)
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(200)
|
|
search?: string;
|
|
|
|
@IsOptional()
|
|
@IsUUID('4')
|
|
typeId?: string;
|
|
|
|
@IsOptional()
|
|
@IsEnum(AssetInformationStatus)
|
|
status?: AssetInformationStatus;
|
|
}
|