]>
Commit | Line | Data |
---|---|---|
9d9597df | 1 | import { VideoDetails } from './video-details.model' |
fd45e8f4 | 2 | import { VideoPrivacy } from '../../../../../shared/models/videos/video-privacy.enum' |
2186386c | 3 | import { VideoUpdate } from '../../../../../shared/models/videos' |
9d9597df | 4 | |
2186386c | 5 | export class VideoEdit implements VideoUpdate { |
404b54e1 C |
6 | category: number |
7 | licence: number | |
9d3ef9fe | 8 | language: string |
404b54e1 C |
9 | description: string |
10 | name: string | |
11 | tags: string[] | |
12 | nsfw: boolean | |
47564bbe | 13 | commentsEnabled: boolean |
2186386c | 14 | waitTranscoding: boolean |
0f320037 | 15 | channelId: number |
fd45e8f4 | 16 | privacy: VideoPrivacy |
07fa4c97 | 17 | support: string |
6de36768 C |
18 | thumbnailfile?: any |
19 | previewfile?: any | |
20 | thumbnailUrl: string | |
21 | previewUrl: string | |
404b54e1 C |
22 | uuid?: string |
23 | id?: number | |
24 | ||
cadb46d8 C |
25 | constructor (videoDetails?: VideoDetails) { |
26 | if (videoDetails) { | |
27 | this.id = videoDetails.id | |
28 | this.uuid = videoDetails.uuid | |
09700934 C |
29 | this.category = videoDetails.category.id |
30 | this.licence = videoDetails.licence.id | |
31 | this.language = videoDetails.language.id | |
cadb46d8 C |
32 | this.description = videoDetails.description |
33 | this.name = videoDetails.name | |
34 | this.tags = videoDetails.tags | |
35 | this.nsfw = videoDetails.nsfw | |
47564bbe | 36 | this.commentsEnabled = videoDetails.commentsEnabled |
2186386c | 37 | this.waitTranscoding = videoDetails.waitTranscoding |
0f320037 | 38 | this.channelId = videoDetails.channel.id |
09700934 | 39 | this.privacy = videoDetails.privacy.id |
07fa4c97 | 40 | this.support = videoDetails.support |
6de36768 C |
41 | this.thumbnailUrl = videoDetails.thumbnailUrl |
42 | this.previewUrl = videoDetails.previewUrl | |
cadb46d8 | 43 | } |
9d9597df C |
44 | } |
45 | ||
404b54e1 C |
46 | patch (values: Object) { |
47 | Object.keys(values).forEach((key) => { | |
2186386c | 48 | this[ key ] = values[ key ] |
404b54e1 C |
49 | }) |
50 | } | |
51 | ||
52 | toJSON () { | |
53 | return { | |
54 | category: this.category, | |
55 | licence: this.licence, | |
56 | language: this.language, | |
57 | description: this.description, | |
07fa4c97 | 58 | support: this.support, |
404b54e1 C |
59 | name: this.name, |
60 | tags: this.tags, | |
61 | nsfw: this.nsfw, | |
47564bbe | 62 | commentsEnabled: this.commentsEnabled, |
2186386c | 63 | waitTranscoding: this.waitTranscoding, |
0f320037 | 64 | channelId: this.channelId, |
fd45e8f4 | 65 | privacy: this.privacy |
404b54e1 C |
66 | } |
67 | } | |
68 | } |