negyedik gyakorlat + megoldasok
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
export class User {
|
||||
constructor(data) {
|
||||
this.id = data.id;
|
||||
this.email = data.email;
|
||||
this.username = data.username;
|
||||
this.password = data.password;
|
||||
this.role = data.role;
|
||||
this.createdAt = data.createdAt;
|
||||
this.updatedAt = data.updatedAt;
|
||||
}
|
||||
|
||||
isAdmin() {
|
||||
return this.role === 'ADMIN';
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
const { password, ...userWithoutPassword } = this;
|
||||
return userWithoutPassword;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user