diff options
Diffstat (limited to 'client/src/app/shared/video/video-edit.model.ts')
-rw-r--r-- | client/src/app/shared/video/video-edit.model.ts | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts new file mode 100644 index 000000000..955255bfa --- /dev/null +++ b/client/src/app/shared/video/video-edit.model.ts | |||
@@ -0,0 +1,52 @@ | |||
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 | channel: number | ||
13 | privacy: VideoPrivacy | ||
14 | uuid?: string | ||
15 | id?: number | ||
16 | |||
17 | constructor (videoDetails?: VideoDetails) { | ||
18 | if (videoDetails) { | ||
19 | this.id = videoDetails.id | ||
20 | this.uuid = videoDetails.uuid | ||
21 | this.category = videoDetails.category | ||
22 | this.licence = videoDetails.licence | ||
23 | this.language = videoDetails.language | ||
24 | this.description = videoDetails.description | ||
25 | this.name = videoDetails.name | ||
26 | this.tags = videoDetails.tags | ||
27 | this.nsfw = videoDetails.nsfw | ||
28 | this.channel = videoDetails.channel.id | ||
29 | this.privacy = videoDetails.privacy | ||
30 | } | ||
31 | } | ||
32 | |||
33 | patch (values: Object) { | ||
34 | Object.keys(values).forEach((key) => { | ||
35 | this[key] = values[key] | ||
36 | }) | ||
37 | } | ||
38 | |||
39 | toJSON () { | ||
40 | return { | ||
41 | category: this.category, | ||
42 | licence: this.licence, | ||
43 | language: this.language, | ||
44 | description: this.description, | ||
45 | name: this.name, | ||
46 | tags: this.tags, | ||
47 | nsfw: this.nsfw, | ||
48 | channel: this.channel, | ||
49 | privacy: this.privacy | ||
50 | } | ||
51 | } | ||
52 | } | ||