From 404b54e14f6623c1644a8c87ca22f4bab98d5484 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Oct 2017 16:43:19 +0200 Subject: Adapt client with video channels --- client/src/app/shared/users/user.model.ts | 40 +++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'client/src/app/shared/users') 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 @@ -import { User as UserServerModel, UserRole } from '../../../../../shared' +import { + User as UserServerModel, + UserRole, + VideoChannel +} from '../../../../../shared' +export type UserConstructorHash = { + id: number, + username: string, + email: string, + role: UserRole, + videoQuota?: number, + displayNSFW?: boolean, + createdAt?: Date, + author?: { + id: number + uuid: string + }, + videoChannels?: VideoChannel[] +} export class User implements UserServerModel { id: number username: string @@ -7,21 +25,23 @@ export class User implements UserServerModel { role: UserRole displayNSFW: boolean videoQuota: number + author: { + id: number + uuid: string + } + videoChannels: VideoChannel[] createdAt: Date - constructor (hash: { - id: number, - username: string, - email: string, - role: UserRole, - videoQuota?: number, - displayNSFW?: boolean, - createdAt?: Date - }) { + constructor (hash: UserConstructorHash) { this.id = hash.id this.username = hash.username this.email = hash.email this.role = hash.role + this.author = hash.author + + if (hash.videoChannels !== undefined) { + this.videoChannels = hash.videoChannels + } if (hash.videoQuota !== undefined) { this.videoQuota = hash.videoQuota -- cgit v1.2.3