35 lines
634 B
TypeScript
35 lines
634 B
TypeScript
import { Transform } from 'class-transformer';
|
|
import { IsDate, IsNotEmpty, IsNumber, IsOptional, IsPositive, IsString, MaxLength } from 'class-validator';
|
|
|
|
export class CreateBookDto {
|
|
@IsString()
|
|
@IsOptional()
|
|
providerSeriesId: string;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
providerBookId: string;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@MaxLength(128)
|
|
title: string;
|
|
|
|
@IsString()
|
|
@MaxLength(512)
|
|
desc: string;
|
|
|
|
@IsNumber()
|
|
@IsOptional()
|
|
@IsPositive()
|
|
volume: number | null;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
provider: string;
|
|
|
|
@IsDate()
|
|
@IsNotEmpty()
|
|
@Transform(({ value }) => new Date(value))
|
|
publishedAt: Date
|
|
} |