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