]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/video/video-edit.model.ts
Add ability to update thumbnail and preview on client
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video / video-edit.model.ts
1 import { VideoDetails } from './video-details.model'
2 import { VideoPrivacy } from '../../../../../shared/models/videos/video-privacy.enum'
3
4 export class VideoEdit {
5 category: number
6 licence: number
7 language: number
8 description: string
9 name: string
10 tags: string[]
11 nsfw: boolean
12 commentsEnabled: boolean
13 channel: number
14 privacy: VideoPrivacy
15 thumbnailfile?: any
16 previewfile?: any
17 thumbnailUrl: string
18 previewUrl: string
19 uuid?: string
20 id?: number
21
22 constructor (videoDetails?: VideoDetails) {
23 if (videoDetails) {
24 this.id = videoDetails.id
25 this.uuid = videoDetails.uuid
26 this.category = videoDetails.category
27 this.licence = videoDetails.licence
28 this.language = videoDetails.language
29 this.description = videoDetails.description
30 this.name = videoDetails.name
31 this.tags = videoDetails.tags
32 this.nsfw = videoDetails.nsfw
33 this.commentsEnabled = videoDetails.commentsEnabled
34 this.channel = videoDetails.channel.id
35 this.privacy = videoDetails.privacy
36 this.thumbnailUrl = videoDetails.thumbnailUrl
37 this.previewUrl = videoDetails.previewUrl
38 }
39 }
40
41 patch (values: Object) {
42 Object.keys(values).forEach((key) => {
43 this[key] = values[key]
44 })
45 }
46
47 toJSON () {
48 return {
49 category: this.category,
50 licence: this.licence,
51 language: this.language,
52 description: this.description,
53 name: this.name,
54 tags: this.tags,
55 nsfw: this.nsfw,
56 commentsEnabled: this.commentsEnabled,
57 channelId: this.channel,
58 privacy: this.privacy
59 }
60 }
61 }