]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/video-channel/video-channel.model.ts
provide specific engine boundaries for nodejs and yarn
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video-channel / video-channel.model.ts
CommitLineData
3d527ba1 1import { VideoChannel as ServerVideoChannel, ViewsPerDate } from '../../../../../shared/models/videos'
d3e91a5f 2import { Actor } from '../actor/actor.model'
a4f99a76 3import { Account } from '../../../../../shared/models/actors'
d3e91a5f
C
4
5export 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
1ba471c5 12
a4f99a76
C
13 ownerAccount?: Account
14 ownerBy?: string
15 ownerAvatarUrl?: string
1ba471c5
C
16
17 videosCount?: number
18
3d527ba1 19 viewsPerDay?: ViewsPerDate[]
d3e91a5f
C
20
21 constructor (hash: ServerVideoChannel) {
22 super(hash)
23
24 this.displayName = hash.displayName
25 this.description = hash.description
26 this.support = hash.support
27 this.isLocal = hash.isLocal
8a19bee1 28 this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host)
288c78ea 29 this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true)
a4f99a76 30
1ba471c5
C
31 this.videosCount = hash.videosCount
32
8165d00a 33 if (hash.viewsPerDay) {
747c5628 34 this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date) }))
8165d00a
RK
35 }
36
a4f99a76
C
37 if (hash.ownerAccount) {
38 this.ownerAccount = hash.ownerAccount
39 this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host)
40 this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount)
41 }
d3e91a5f
C
42 }
43}