File
id
|
Type : number
|
Decorators :
@ApiProperty()
|
|
name
|
Type : string
|
Decorators :
@ApiProperty() @IsUnique({tableName: 'category', column: 'name'}) @IsNotEmpty({message: undefined})
|
|
slug
|
Type : string
|
Decorators :
@ApiProperty() @IsUnique({tableName: 'category', column: 'slug'}) @IsNotEmpty({message: undefined})
|
|
status
|
Type : boolean
|
Decorators :
@ApiProperty({type: Boolean}) @IsBoolean({message: undefined}) @IsNotEmpty({message: undefined})
|
|
import { IsBoolean, IsEnum, IsNotEmpty, Validate } from 'class-validator';
import { IsUnique } from 'src/validation/is-unique';
import { MessaeSendResponseIsBoolean, MessaeSendResponseIsNotEmpty, StatusEnumTable } from 'src/validation/validation.exception';
import { ApiProperty } from '@nestjs/swagger/dist';
export class CategoryValidation {
@ApiProperty()
id:number;
@ApiProperty()
@IsUnique({tableName:'category',column:'name'})
@IsNotEmpty({ message: MessaeSendResponseIsNotEmpty('El nombre')})
name:string;
//@ApiProperty({ enum: ['active', 'disabled']})
//@IsEnum(StatusEnumTable,{message:"El estado puede ser activo o disabled"})
@ApiProperty()
@IsUnique({tableName:'category',column:'slug'})
@IsNotEmpty({ message: MessaeSendResponseIsNotEmpty('El slug')})
slug:string;
@ApiProperty({type:Boolean})
@IsBoolean({message:MessaeSendResponseIsBoolean('El estado')})
@IsNotEmpty({ message: MessaeSendResponseIsNotEmpty('El estado')})
status:boolean;
createdAt:Date;
}