]>
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 |
07fa4c97 | 15 | support: string |
6de36768 C |
16 | thumbnailfile?: any |
17 | previewfile?: any | |
18 | thumbnailUrl: string | |
19 | previewUrl: string | |
404b54e1 C |
20 | uuid?: string |
21 | id?: number | |
22 | ||
cadb46d8 C |
23 | constructor (videoDetails?: VideoDetails) { |
24 | if (videoDetails) { | |
25 | this.id = videoDetails.id | |
26 | this.uuid = videoDetails.uuid | |
09700934 C |
27 | this.category = videoDetails.category.id |
28 | this.licence = videoDetails.licence.id | |
29 | this.language = videoDetails.language.id | |
cadb46d8 C |
30 | this.description = videoDetails.description |
31 | this.name = videoDetails.name | |
32 | this.tags = videoDetails.tags | |
33 | this.nsfw = videoDetails.nsfw | |
47564bbe | 34 | this.commentsEnabled = videoDetails.commentsEnabled |
cadb46d8 | 35 | this.channel = videoDetails.channel.id |
09700934 | 36 | this.privacy = videoDetails.privacy.id |
07fa4c97 | 37 | this.support = videoDetails.support |
6de36768 C |
38 | this.thumbnailUrl = videoDetails.thumbnailUrl |
39 | this.previewUrl = videoDetails.previewUrl | |
cadb46d8 | 40 | } |
9d9597df C |
41 | } |
42 | ||
404b54e1 C |
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, | |
07fa4c97 | 55 | support: this.support, |
404b54e1 C |
56 | name: this.name, |
57 | tags: this.tags, | |
58 | nsfw: this.nsfw, | |
47564bbe | 59 | commentsEnabled: this.commentsEnabled, |
15a7387d | 60 | channelId: this.channel, |
fd45e8f4 | 61 | privacy: this.privacy |
404b54e1 C |
62 | } |
63 | } | |
64 | } |