]>
Commit | Line | Data |
---|---|---|
9d9597df | 1 | import { VideoDetails } from './video-details.model' |
fd45e8f4 | 2 | import { VideoPrivacy } from '../../../../../shared/models/videos/video-privacy.enum' |
9d9597df | 3 | |
404b54e1 C |
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 | |
fd45e8f4 | 13 | privacy: VideoPrivacy |
404b54e1 C |
14 | uuid?: string |
15 | id?: number | |
16 | ||
9d9597df C |
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 | |
fd45e8f4 | 28 | this.privacy = videoDetails.privacy |
9d9597df C |
29 | } |
30 | ||
404b54e1 C |
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, | |
fd45e8f4 C |
46 | channel: this.channel, |
47 | privacy: this.privacy | |
404b54e1 C |
48 | } |
49 | } | |
50 | } |