diff options
Diffstat (limited to 'client/src/app/shared/shared-main/video-channel/video-channel.model.ts')
-rw-r--r-- | client/src/app/shared/shared-main/video-channel/video-channel.model.ts | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts new file mode 100644 index 000000000..123389afb --- /dev/null +++ b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts | |||
@@ -0,0 +1,42 @@ | |||
1 | import { VideoChannel as ServerVideoChannel, ViewsPerDate, Account } from '@shared/models' | ||
2 | import { Actor } from '../account/actor.model' | ||
3 | |||
4 | export class VideoChannel extends Actor implements ServerVideoChannel { | ||
5 | displayName: string | ||
6 | description: string | ||
7 | support: string | ||
8 | isLocal: boolean | ||
9 | nameWithHost: string | ||
10 | nameWithHostForced: string | ||
11 | |||
12 | ownerAccount?: Account | ||
13 | ownerBy?: string | ||
14 | ownerAvatarUrl?: string | ||
15 | |||
16 | videosCount?: number | ||
17 | |||
18 | viewsPerDay?: ViewsPerDate[] | ||
19 | |||
20 | constructor (hash: ServerVideoChannel) { | ||
21 | super(hash) | ||
22 | |||
23 | this.displayName = hash.displayName | ||
24 | this.description = hash.description | ||
25 | this.support = hash.support | ||
26 | this.isLocal = hash.isLocal | ||
27 | this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host) | ||
28 | this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true) | ||
29 | |||
30 | this.videosCount = hash.videosCount | ||
31 | |||
32 | if (hash.viewsPerDay) { | ||
33 | this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date) })) | ||
34 | } | ||
35 | |||
36 | if (hash.ownerAccount) { | ||
37 | this.ownerAccount = hash.ownerAccount | ||
38 | this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host) | ||
39 | this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount) | ||
40 | } | ||
41 | } | ||
42 | } | ||