aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/users/user.model.ts40
1 files changed, 30 insertions, 10 deletions
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index bf12876c7..7beea5910 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -1,5 +1,23 @@
1import { User as UserServerModel, UserRole } from '../../../../../shared' 1import {
2 User as UserServerModel,
3 UserRole,
4 VideoChannel
5} from '../../../../../shared'
2 6
7export type UserConstructorHash = {
8 id: number,
9 username: string,
10 email: string,
11 role: UserRole,
12 videoQuota?: number,
13 displayNSFW?: boolean,
14 createdAt?: Date,
15 author?: {
16 id: number
17 uuid: string
18 },
19 videoChannels?: VideoChannel[]
20}
3export class User implements UserServerModel { 21export class User implements UserServerModel {
4 id: number 22 id: number
5 username: string 23 username: string
@@ -7,21 +25,23 @@ export class User implements UserServerModel {
7 role: UserRole 25 role: UserRole
8 displayNSFW: boolean 26 displayNSFW: boolean
9 videoQuota: number 27 videoQuota: number
28 author: {
29 id: number
30 uuid: string
31 }
32 videoChannels: VideoChannel[]
10 createdAt: Date 33 createdAt: Date
11 34
12 constructor (hash: { 35 constructor (hash: UserConstructorHash) {
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 36 this.id = hash.id
22 this.username = hash.username 37 this.username = hash.username
23 this.email = hash.email 38 this.email = hash.email
24 this.role = hash.role 39 this.role = hash.role
40 this.author = hash.author
41
42 if (hash.videoChannels !== undefined) {
43 this.videoChannels = hash.videoChannels
44 }
25 45
26 if (hash.videoQuota !== undefined) { 46 if (hash.videoQuota !== undefined) {
27 this.videoQuota = hash.videoQuota 47 this.videoQuota = hash.videoQuota