]>
Commit | Line | Data |
---|---|---|
8165d00a | 1 | import { VideoChannel as ServerVideoChannel, viewsPerTime } from '../../../../../shared/models/videos' |
d3e91a5f | 2 | import { Actor } from '../actor/actor.model' |
a4f99a76 | 3 | import { Account } from '../../../../../shared/models/actors' |
d3e91a5f C |
4 | |
5 | export class VideoChannel extends Actor implements ServerVideoChannel { | |
6 | displayName: string | |
7 | description: string | |
8 | support: string | |
9 | isLocal: boolean | |
8a19bee1 | 10 | nameWithHost: string |
288c78ea | 11 | nameWithHostForced: string |
a4f99a76 C |
12 | ownerAccount?: Account |
13 | ownerBy?: string | |
14 | ownerAvatarUrl?: string | |
8165d00a | 15 | viewsPerDay?: viewsPerTime[] |
d3e91a5f C |
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 | |
8a19bee1 | 24 | this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host) |
288c78ea | 25 | this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true) |
a4f99a76 | 26 | |
8165d00a | 27 | if (hash.viewsPerDay) { |
747c5628 | 28 | this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date) })) |
8165d00a RK |
29 | } |
30 | ||
a4f99a76 C |
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 | } | |
d3e91a5f C |
36 | } |
37 | } |