]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/video/video-edit.model.ts
a8bbb63eb2c48b37422d26e4249765c84cedc977
[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 support: string
16 thumbnailfile?: any
17 previewfile?: any
18 thumbnailUrl: string
19 previewUrl: string
20 uuid?: string
21 id?: number
22
23 constructor (videoDetails?: VideoDetails) {
24 if (videoDetails) {
25 this.id = videoDetails.id
26 this.uuid = videoDetails.uuid
27 this.category = videoDetails.category
28 this.licence = videoDetails.licence
29 this.language = videoDetails.language
30 this.description = videoDetails.description
31 this.name = videoDetails.name
32 this.tags = videoDetails.tags
33 this.nsfw = videoDetails.nsfw
34 this.commentsEnabled = videoDetails.commentsEnabled
35 this.channel = videoDetails.channel.id
36 this.privacy = videoDetails.privacy
37 this.support = videoDetails.support
38 this.thumbnailUrl = videoDetails.thumbnailUrl
39 this.previewUrl = videoDetails.previewUrl
40 }
41 }
42
43 patch (values: Object) {
44 Object.keys(values).forEach((key) => {
45 this[key] = values[key]
46 })
47 }
48
49 toJSON () {
50 return {
51 category: this.category,
52 licence: this.licence,
53 language: this.language,
54 description: this.description,
55 support: this.support,
56 name: this.name,
57 tags: this.tags,
58 nsfw: this.nsfw,
59 commentsEnabled: this.commentsEnabled,
60 channelId: this.channel,
61 privacy: this.privacy
62 }
63 }
64 }