Unified property decorator of swagger, class-validator, and class-transformer decorators.
pnpm add @vnodes/property
import { Prop } from '@vnodes/property'
export class Status {
Active = 'Active',
Passive = 'Passive'
}
export class UserReadDto {
@Prop({ type: Number, format:"int32" })
id:number;
@Prop({ type: Date })
createdAt: Date;
@Prop({ type: Date })
updatedAt?: Date;
@Prop({ type: Date })
deletedAt?: Date;
@Prop({ type: String , maxLength: 255, minLength:3})
firstName:string;
@Prop({ type: String , maxLength: 255, minLength:3})
lastName:string;
@Prop({ type: String , maxLength: 255, minLength:3 })
middleName?:string;
@Prop({ type: String , format:"email" })
username:string;
@Prop({ type: String , format:"password" })
password:string;
@Pro({ type: [String], maxItems: 10, minItems: 1 })
tags: String[]
@Prop({ type: String, enum: Status })
status?: Status
}
export class UserCreateDto {
@Prop({ type: String , maxLength: 255, minLength:3 })
firstName:string;
@Prop({ type: String , maxLength: 255, minLength:3 })
lastName:string;
@Prop({ type: String , maxLength: 255, minLength:3, required: false })
middleName?:string;
@Prop({ type: String , format:"email" })
username: string;
@Prop({ type: String , format:"password" })
password: string;
@Pro({ type: [String], maxItems: 10, minItems: 1, required: false })
tags?: String[]
@Prop({ type: String, enum: Status, required:false })
status?: Status
}
If you find my open-source contributions or the @vnodes/property project helpful, consider supporting my work. Your sponsorship helps me maintain these projects and explore new enterprise patterns.