Validador de classe Typeorm
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"
import {
Contains,
IsInt,
Length,
IsEmail,
IsFQDN,
IsDate,
Min,
Max,
} from "class-validator"
@Entity()
export class Post {
@PrimaryGeneratedColumn()
id: number
@Column()
@Length(10, 20)
title: string
@Column()
@Contains("hello")
text: string
@Column()
@IsInt()
@Min(0)
@Max(10)
rating: number
@Column()
@IsEmail()
email: string
@Column()
@IsFQDN()
site: string
@Column()
@IsDate()
createDate: Date
}
Puzzled Puffin