Begin videos of an account
[oweals/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   channel: number
13   privacy: VideoPrivacy
14   uuid?: string
15   id?: number
16
17   constructor (videoDetails: VideoDetails) {
18     this.id = videoDetails.id
19     this.uuid = videoDetails.uuid
20     this.category = videoDetails.category
21     this.licence = videoDetails.licence
22     this.language = videoDetails.language
23     this.description = videoDetails.description
24     this.name = videoDetails.name
25     this.tags = videoDetails.tags
26     this.nsfw = videoDetails.nsfw
27     this.channel = videoDetails.channel.id
28     this.privacy = videoDetails.privacy
29   }
30
31   patch (values: Object) {
32     Object.keys(values).forEach((key) => {
33       this[key] = values[key]
34     })
35   }
36
37   toJSON () {
38     return {
39       category: this.category,
40       licence: this.licence,
41       language: this.language,
42       description: this.description,
43       name: this.name,
44       tags: this.tags,
45       nsfw: this.nsfw,
46       channel: this.channel,
47       privacy: this.privacy
48     }
49   }
50 }