aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/users/user.model.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/users/user.model.ts')
-rw-r--r--client/src/app/shared/users/user.model.ts38
1 files changed, 13 insertions, 25 deletions
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 877f1bf3a..c15f1de8c 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -1,38 +1,20 @@
1import { 1import { hasUserRight, User as UserServerModel, UserNotificationSetting, UserRight, UserRole, VideoChannel } from '../../../../../shared'
2 Account as AccountServerModel,
3 hasUserRight,
4 User as UserServerModel,
5 UserRight,
6 UserRole,
7 VideoChannel
8} from '../../../../../shared'
9import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' 2import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type'
10import { Account } from '@app/shared/account/account.model' 3import { Account } from '@app/shared/account/account.model'
11import { Avatar } from '../../../../../shared/models/avatars/avatar.model' 4import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
12 5
13export type UserConstructorHash = {
14 id: number,
15 username: string,
16 email: string,
17 role: UserRole,
18 videoQuota?: number,
19 videoQuotaDaily?: number,
20 nsfwPolicy?: NSFWPolicyType,
21 autoPlayVideo?: boolean,
22 createdAt?: Date,
23 account?: AccountServerModel,
24 videoChannels?: VideoChannel[]
25
26 blocked?: boolean
27 blockedReason?: string
28}
29export class User implements UserServerModel { 6export class User implements UserServerModel {
30 id: number 7 id: number
31 username: string 8 username: string
32 email: string 9 email: string
10 emailVerified: boolean
33 role: UserRole 11 role: UserRole
34 nsfwPolicy: NSFWPolicyType 12 nsfwPolicy: NSFWPolicyType
13
14 webTorrentEnabled: boolean
35 autoPlayVideo: boolean 15 autoPlayVideo: boolean
16 videosHistoryEnabled: boolean
17
36 videoQuota: number 18 videoQuota: number
37 videoQuotaDaily: number 19 videoQuotaDaily: number
38 account: Account 20 account: Account
@@ -42,7 +24,9 @@ export class User implements UserServerModel {
42 blocked: boolean 24 blocked: boolean
43 blockedReason?: string 25 blockedReason?: string
44 26
45 constructor (hash: UserConstructorHash) { 27 notificationSettings?: UserNotificationSetting
28
29 constructor (hash: Partial<UserServerModel>) {
46 this.id = hash.id 30 this.id = hash.id
47 this.username = hash.username 31 this.username = hash.username
48 this.email = hash.email 32 this.email = hash.email
@@ -52,11 +36,15 @@ export class User implements UserServerModel {
52 this.videoQuota = hash.videoQuota 36 this.videoQuota = hash.videoQuota
53 this.videoQuotaDaily = hash.videoQuotaDaily 37 this.videoQuotaDaily = hash.videoQuotaDaily
54 this.nsfwPolicy = hash.nsfwPolicy 38 this.nsfwPolicy = hash.nsfwPolicy
39 this.webTorrentEnabled = hash.webTorrentEnabled
40 this.videosHistoryEnabled = hash.videosHistoryEnabled
55 this.autoPlayVideo = hash.autoPlayVideo 41 this.autoPlayVideo = hash.autoPlayVideo
56 this.createdAt = hash.createdAt 42 this.createdAt = hash.createdAt
57 this.blocked = hash.blocked 43 this.blocked = hash.blocked
58 this.blockedReason = hash.blockedReason 44 this.blockedReason = hash.blockedReason
59 45
46 this.notificationSettings = hash.notificationSettings
47
60 if (hash.account !== undefined) { 48 if (hash.account !== undefined) {
61 this.account = new Account(hash.account) 49 this.account = new Account(hash.account)
62 } 50 }