]>
Commit | Line | Data |
---|---|---|
1 | import { VideoChannel as ServerVideoChannel, ViewsPerDate } from '../../../../../shared/models/videos' | |
2 | import { Actor } from '../actor/actor.model' | |
3 | import { Account } from '../../../../../shared/models/actors' | |
4 | ||
5 | export class VideoChannel extends Actor implements ServerVideoChannel { | |
6 | displayName: string | |
7 | description: string | |
8 | support: string | |
9 | isLocal: boolean | |
10 | nameWithHost: string | |
11 | nameWithHostForced: string | |
12 | ownerAccount?: Account | |
13 | ownerBy?: string | |
14 | ownerAvatarUrl?: string | |
15 | viewsPerDay?: ViewsPerDate[] | |
16 | ||
17 | constructor (hash: ServerVideoChannel) { | |
18 | super(hash) | |
19 | ||
20 | this.displayName = hash.displayName | |
21 | this.description = hash.description | |
22 | this.support = hash.support | |
23 | this.isLocal = hash.isLocal | |
24 | this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host) | |
25 | this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true) | |
26 | ||
27 | if (hash.viewsPerDay) { | |
28 | this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date) })) | |
29 | } | |
30 | ||
31 | if (hash.ownerAccount) { | |
32 | this.ownerAccount = hash.ownerAccount | |
33 | this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host) | |
34 | this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount) | |
35 | } | |
36 | } | |
37 | } |