When I generate a model with loopback cli (lb4 model
) I get a model with some properties. I am specifically trying to make a setter to hash a user entity password.
Initially, I get the following code :
@property({
type: 'string',
required: true,
})
password: string;
I want to know if I can change the code to this :
@property({
type: 'string',
required: true,
})
private _password: string;
set password(password: string) {
this._password = Password.hash(password);
}