aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/users/user.model.ts
blob: 52d89e0049f53991d6686fcc99d68fe3537ab802 (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: 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';
  }
}