Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // class validators
- class CreateUserDto {
- @IsStromg
- name: string;
- }
- class AdminCreateUserDto extends CreateUserDto {
- @IsStromg
- disabled: boolean;
- }
- // disabled whaitelist
- async adminCreateUser(
- @Body({ validate: { whitelist: false } }) user: AdminCreateUserDto
- ) {
- /*
- * POST /users
- * body: { name: "as", disabled: true }
- */
- console.log(user); // { name: "as", disabled: true }
- }
- // avtived whitelist
- async adminCreateUser(
- @Body({ validate: { whitelist: true } }) user: AdminCreateUserDto
- ) {
- /*
- * POST /users
- * body: { name: "as", disabled: true }
- */
- console.log(user); // { disabled: true }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement