UNPKG

pl4y-data-library

Version:

This library contains the dtos, enums, schemas, and other data objects needed in the pl4y ecosystem.

24 lines (18 loc) 613 B
import { IsDate, IsEnum, IsNotEmpty, IsOptional, IsString } from "class-validator"; import { Type } from "class-transformer"; import { ProductStatus } from "../../../enums/product-status.enum"; export class ValidityDTO { @IsOptional() id?: string; @IsString() @IsNotEmpty() productId: string; @Type(() => Date) @IsDate({ message: "startDate must be a valid ISO date" }) startDate: Date; @Type(() => Date) @IsDate({ message: "endDate must be a valid ISO date" }) endDate: Date; @IsEnum(ProductStatus, { message: "Invalid status" }) status: ProductStatus; }