aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/users/user.model.ts
blob: 726495d1182721d095bcca3e11ee72da5b782cb5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
export class User {
  id: string;
  username: string;
  role: string;
  createdDate: Date;

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

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

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