]>
Commit | Line | Data |
---|---|---|
9d9597df C |
1 | import { VideoDetails } from './video-details.model' |
2 | ||
404b54e1 C |
3 | export class VideoEdit { |
4 | category: number | |
5 | licence: number | |
6 | language: number | |
7 | description: string | |
8 | name: string | |
9 | tags: string[] | |
10 | nsfw: boolean | |
11 | channel: number | |
12 | uuid?: string | |
13 | id?: number | |
14 | ||
9d9597df C |
15 | constructor (videoDetails: VideoDetails) { |
16 | this.id = videoDetails.id | |
17 | this.uuid = videoDetails.uuid | |
18 | this.category = videoDetails.category | |
19 | this.licence = videoDetails.licence | |
20 | this.language = videoDetails.language | |
21 | this.description = videoDetails.description | |
22 | this.name = videoDetails.name | |
23 | this.tags = videoDetails.tags | |
24 | this.nsfw = videoDetails.nsfw | |
25 | this.channel = videoDetails.channel.id | |
26 | } | |
27 | ||
404b54e1 C |
28 | patch (values: Object) { |
29 | Object.keys(values).forEach((key) => { | |
30 | this[key] = values[key] | |
31 | }) | |
32 | } | |
33 | ||
34 | toJSON () { | |
35 | return { | |
36 | category: this.category, | |
37 | licence: this.licence, | |
38 | language: this.language, | |
39 | description: this.description, | |
40 | name: this.name, | |
41 | tags: this.tags, | |
42 | nsfw: this.nsfw, | |
43 | channel: this.channel | |
44 | } | |
45 | } | |
46 | } |