aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/app/shared/users/user.model.ts
blob: 52d89e0049f53991d6686fcc99d68fe3537ab802 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                   
             

                   
                  
 
                                                                                       


                                  
 

                                      
     





                                 
export class User {
  id: number;
  username: string;
  role: string;
  createdAt: Date;

  constructor(hash: { id: number, username: string, role: string, createdAt?: Date }) {
    this.id = hash.id;
    this.username = hash.username;
    this.role = hash.role;

    if (hash.createdAt) {
      this.createdAt = hash.createdAt;
    }
  }

  isAdmin() {
    return this.role === 'admin';
  }
}