]>
Commit | Line | Data |
---|---|---|
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 | uuid?: string | |
16 | id?: number | |
17 | ||
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 | |
29 | this.commentsEnabled = videoDetails.commentsEnabled | |
30 | this.channel = videoDetails.channel.id | |
31 | this.privacy = videoDetails.privacy | |
32 | } | |
33 | } | |
34 | ||
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, | |
50 | commentsEnabled: this.commentsEnabled, | |
51 | channelId: this.channel, | |
52 | privacy: this.privacy | |
53 | } | |
54 | } | |
55 | } |