Files
flashcards-api/src/modules/decks/dto/create-deck.dto.ts
2023-07-16 14:59:03 +02:00

19 lines
368 B
TypeScript

import { IsBoolean, IsOptional, Length } from 'class-validator'
import { Transform } from 'class-transformer'
export class CreateDeckDto {
@Length(3, 30)
name: string
@IsOptional()
@Length(0, 0)
cover?: string
@IsOptional()
@IsBoolean()
@Transform((val: string) => [true, 'true', 1, '1'].indexOf(val) > -1)
isPrivate?: boolean
userId: string
}