]>
Commit | Line | Data |
---|---|---|
7da18e44 C |
1 | export class User { |
2 | id: string; | |
3 | username: string; | |
4 | role: string; | |
b539c9b3 | 5 | createdDate: Date; |
7da18e44 | 6 | |
44c5275e | 7 | constructor(hash: { id: string, username: string, role: string, createdDate?: Date }) { |
7da18e44 C |
8 | this.id = hash.id; |
9 | this.username = hash.username; | |
10 | this.role = hash.role; | |
44c5275e C |
11 | |
12 | if (hash.createdDate) { | |
13 | this.createdDate = hash.createdDate; | |
14 | } | |
7da18e44 C |
15 | } |
16 | ||
17 | isAdmin() { | |
18 | return this.role === 'admin'; | |
19 | } | |
20 | } |