From 69f616ab3aeefd6ce330600604df90f2f48bfe3b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 11 Jun 2017 11:02:35 +0200 Subject: Use shared models --- client/src/app/shared/users/user.model.ts | 7 ++++++- client/src/app/videos/shared/video.model.ts | 21 ++++++++++++--------- .../video-list/video-miniature.component.html | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) (limited to 'client') diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index f7859f495..09722704a 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts @@ -1,6 +1,9 @@ -export class User { +import { User as UserServerModel } from '../../../../../shared'; + +export class User implements UserServerModel { id: number; username: string; + email: string; role: string; displayNSFW: boolean; createdAt: Date; @@ -8,12 +11,14 @@ export class User { constructor(hash: { id: number, username: string, + email: string, role: string, displayNSFW?: boolean, createdAt?: Date, }) { this.id = hash.id; this.username = hash.username; + this.email = hash.email; this.role = hash.role; this.displayNSFW = hash.displayNSFW; diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts index fafdb4ac4..0cf4039df 100644 --- a/client/src/app/videos/shared/video.model.ts +++ b/client/src/app/videos/shared/video.model.ts @@ -1,17 +1,19 @@ +import { Video as VideoServerModel } from '../../../../../shared'; import { User } from '../../shared'; -export class Video { +export class Video implements VideoServerModel { author: string; by: string; createdAt: Date; categoryLabel: string; - category: string; + category: number; licenceLabel: string; - licence: string; + licence: number; languageLabel: string; - language: string; + language: number; description: string; - duration: string; + duration: number; + durationLabel: string; id: string; isLocal: boolean; magnetUri: string; @@ -41,11 +43,11 @@ export class Video { author: string, createdAt: string, categoryLabel: string, - category: string, + category: number, licenceLabel: string, - licence: string, + licence: number, languageLabel: string; - language: string; + language: number; description: string, duration: number; id: string, @@ -69,7 +71,8 @@ export class Video { this.languageLabel = hash.languageLabel; this.language = hash.language; this.description = hash.description; - this.duration = Video.createDurationString(hash.duration); + this.duration = hash.duration; + this.durationLabel = Video.createDurationString(hash.duration); this.id = hash.id; this.isLocal = hash.isLocal; this.magnetUri = hash.magnetUri; diff --git a/client/src/app/videos/video-list/video-miniature.component.html b/client/src/app/videos/video-list/video-miniature.component.html index 648ef61b1..b1b881fea 100644 --- a/client/src/app/videos/video-list/video-miniature.component.html +++ b/client/src/app/videos/video-list/video-miniature.component.html @@ -10,7 +10,7 @@
{{ video.views }} views - {{ video.duration }} + {{ video.durationLabel }}
-- cgit v1.2.3