]>
Commit | Line | Data |
---|---|---|
69f616ab C |
1 | import { User as UserServerModel } from '../../../../../shared'; |
2 | ||
3 | export class User implements UserServerModel { | |
feb4bdfd | 4 | id: number; |
7da18e44 | 5 | username: string; |
69f616ab | 6 | email: string; |
7da18e44 | 7 | role: string; |
92fb909c | 8 | displayNSFW: boolean; |
feb4bdfd | 9 | createdAt: Date; |
7da18e44 | 10 | |
92fb909c C |
11 | constructor(hash: { |
12 | id: number, | |
13 | username: string, | |
69f616ab | 14 | email: string, |
92fb909c C |
15 | role: string, |
16 | displayNSFW?: boolean, | |
17 | createdAt?: Date, | |
18 | }) { | |
7da18e44 C |
19 | this.id = hash.id; |
20 | this.username = hash.username; | |
69f616ab | 21 | this.email = hash.email; |
7da18e44 | 22 | this.role = hash.role; |
92fb909c | 23 | this.displayNSFW = hash.displayNSFW; |
44c5275e | 24 | |
feb4bdfd C |
25 | if (hash.createdAt) { |
26 | this.createdAt = hash.createdAt; | |
44c5275e | 27 | } |
7da18e44 C |
28 | } |
29 | ||
30 | isAdmin() { | |
31 | return this.role === 'admin'; | |
32 | } | |
33 | } |