]>
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 | support: string | |
16 | thumbnailfile?: any | |
17 | previewfile?: any | |
18 | thumbnailUrl: string | |
19 | previewUrl: string | |
20 | uuid?: string | |
21 | id?: number | |
22 | ||
23 | constructor (videoDetails?: VideoDetails) { | |
24 | if (videoDetails) { | |
25 | this.id = videoDetails.id | |
26 | this.uuid = videoDetails.uuid | |
27 | this.category = videoDetails.category.id | |
28 | this.licence = videoDetails.licence.id | |
29 | this.language = videoDetails.language.id | |
30 | this.description = videoDetails.description | |
31 | this.name = videoDetails.name | |
32 | this.tags = videoDetails.tags | |
33 | this.nsfw = videoDetails.nsfw | |
34 | this.commentsEnabled = videoDetails.commentsEnabled | |
35 | this.channel = videoDetails.channel.id | |
36 | this.privacy = videoDetails.privacy.id | |
37 | this.support = videoDetails.support | |
38 | this.thumbnailUrl = videoDetails.thumbnailUrl | |
39 | this.previewUrl = videoDetails.previewUrl | |
40 | } | |
41 | } | |
42 | ||
43 | patch (values: Object) { | |
44 | Object.keys(values).forEach((key) => { | |
45 | this[key] = values[key] | |
46 | }) | |
47 | } | |
48 | ||
49 | toJSON () { | |
50 | return { | |
51 | category: this.category, | |
52 | licence: this.licence, | |
53 | language: this.language, | |
54 | description: this.description, | |
55 | support: this.support, | |
56 | name: this.name, | |
57 | tags: this.tags, | |
58 | nsfw: this.nsfw, | |
59 | commentsEnabled: this.commentsEnabled, | |
60 | channelId: this.channel, | |
61 | privacy: this.privacy | |
62 | } | |
63 | } | |
64 | } |