]>
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 | |
47564bbe | 12 | commentsEnabled: boolean |
404b54e1 | 13 | channel: number |
fd45e8f4 | 14 | privacy: VideoPrivacy |
404b54e1 C |
15 | uuid?: string |
16 | id?: number | |
17 | ||
cadb46d8 C |
18 | constructor (videoDetails?: VideoDetails) { |
19 | if (videoDetails) { | |
20 | this.id = videoDetails.id | |
21 | this.uuid = videoDetails.uuid | |
22 | this.category = videoDetails.category | |
23 | this.licence = videoDetails.licence | |
24 | this.language = videoDetails.language | |
25 | this.description = videoDetails.description | |
26 | this.name = videoDetails.name | |
27 | this.tags = videoDetails.tags | |
28 | this.nsfw = videoDetails.nsfw | |
47564bbe | 29 | this.commentsEnabled = videoDetails.commentsEnabled |
cadb46d8 C |
30 | this.channel = videoDetails.channel.id |
31 | this.privacy = videoDetails.privacy | |
32 | } | |
9d9597df C |
33 | } |
34 | ||
404b54e1 C |
35 | patch (values: Object) { |
36 | Object.keys(values).forEach((key) => { | |
37 | this[key] = values[key] | |
38 | }) | |
39 | } | |
40 | ||
41 | toJSON () { | |
42 | return { | |
43 | category: this.category, | |
44 | licence: this.licence, | |
45 | language: this.language, | |
46 | description: this.description, | |
47 | name: this.name, | |
48 | tags: this.tags, | |
49 | nsfw: this.nsfw, | |
47564bbe | 50 | commentsEnabled: this.commentsEnabled, |
15a7387d | 51 | channelId: this.channel, |
fd45e8f4 | 52 | privacy: this.privacy |
404b54e1 C |
53 | } |
54 | } | |
55 | } |