-
Hi I've a User model as defined below and I want to hide password in response for all cases. How to do so ? enum Roles {
SUPERADMIN = "superadmin",
ADMIN = "admin",
TEACHER = "teacher",
STUDENT = "student",
}
export class User {
@Groups("!creation")
@ObjectID("id")
_id: string;
@MinLength(3)
@MaxLength(50)
@Trim()
username: string;
@Indexed()
@Required()
@Email()
@Unique()
@Trim()
email: string;
@Groups("creation")
@Required()
@MinLength(4)
@MaxLength(20)
password: string;
@Enum(Roles)
@Default("admin")
role: Roles;
@Optional()
@Default(true)
isActive: boolean;
@Optional()
@Default(true)
isVerified: boolean;
token: string;
} |
Beta Was this translation helpful? Give feedback.
Answered by
Romakita
Aug 5, 2021
Replies: 1 comment 4 replies
-
Using group the password won’t be serialised. |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
xinhash
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using group the password won’t be serialised.