]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/users/user.model.ts
Move to HttpClient and PrimeNG data table
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / users / user.model.ts
1 import { User as UserServerModel, UserRole } from '../../../../../shared'
2
3 export class User implements UserServerModel {
4 id: number
5 username: string
6 email: string
7 role: UserRole
8 displayNSFW: boolean
9 videoQuota: number
10 createdAt: Date
11
12 constructor (hash: {
13 id: number,
14 username: string,
15 email: string,
16 role: UserRole,
17 videoQuota?: number,
18 displayNSFW?: boolean,
19 createdAt?: Date
20 }) {
21 this.id = hash.id
22 this.username = hash.username
23 this.email = hash.email
24 this.role = hash.role
25
26 if (hash.videoQuota !== undefined) {
27 this.videoQuota = hash.videoQuota
28 }
29
30 if (hash.displayNSFW !== undefined) {
31 this.displayNSFW = hash.displayNSFW
32 }
33
34 if (hash.createdAt !== undefined) {
35 this.createdAt = hash.createdAt
36 }
37 }
38
39 isAdmin () {
40 return this.role === 'admin'
41 }
42 }