]>
Commit | Line | Data |
---|---|---|
67ed6552 C |
1 | import { VideoChannel as ServerVideoChannel, ViewsPerDate, Account } from '@shared/models' |
2 | import { Actor } from '../account/actor.model' | |
d3e91a5f C |
3 | |
4 | export class VideoChannel extends Actor implements ServerVideoChannel { | |
5 | displayName: string | |
6 | description: string | |
7 | support: string | |
8 | isLocal: boolean | |
8a19bee1 | 9 | nameWithHost: string |
288c78ea | 10 | nameWithHostForced: string |
1ba471c5 | 11 | |
a4f99a76 C |
12 | ownerAccount?: Account |
13 | ownerBy?: string | |
14 | ownerAvatarUrl?: string | |
1ba471c5 C |
15 | |
16 | videosCount?: number | |
17 | ||
3d527ba1 | 18 | viewsPerDay?: ViewsPerDate[] |
d3e91a5f C |
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 | |
8a19bee1 | 27 | this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host) |
288c78ea | 28 | this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true) |
a4f99a76 | 29 | |
1ba471c5 C |
30 | this.videosCount = hash.videosCount |
31 | ||
8165d00a | 32 | if (hash.viewsPerDay) { |
747c5628 | 33 | this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date) })) |
8165d00a RK |
34 | } |
35 | ||
a4f99a76 C |
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 | } | |
d3e91a5f C |
41 | } |
42 | } |