diff options
Diffstat (limited to 'client/src/app/videos/shared')
-rw-r--r-- | client/src/app/videos/shared/video.model.ts | 3 | ||||
-rw-r--r-- | client/src/app/videos/shared/video.service.ts | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts index b5d96f63a..5ed622dce 100644 --- a/client/src/app/videos/shared/video.model.ts +++ b/client/src/app/videos/shared/video.model.ts | |||
@@ -3,6 +3,7 @@ export class Video { | |||
3 | by: string; | 3 | by: string; |
4 | createdAt: Date; | 4 | createdAt: Date; |
5 | categoryLabel: string; | 5 | categoryLabel: string; |
6 | licenceLabel: string; | ||
6 | description: string; | 7 | description: string; |
7 | duration: string; | 8 | duration: string; |
8 | id: string; | 9 | id: string; |
@@ -33,6 +34,7 @@ export class Video { | |||
33 | author: string, | 34 | author: string, |
34 | createdAt: string, | 35 | createdAt: string, |
35 | categoryLabel: string, | 36 | categoryLabel: string, |
37 | licenceLabel: string, | ||
36 | description: string, | 38 | description: string, |
37 | duration: number; | 39 | duration: number; |
38 | id: string, | 40 | id: string, |
@@ -49,6 +51,7 @@ export class Video { | |||
49 | this.author = hash.author; | 51 | this.author = hash.author; |
50 | this.createdAt = new Date(hash.createdAt); | 52 | this.createdAt = new Date(hash.createdAt); |
51 | this.categoryLabel = hash.categoryLabel; | 53 | this.categoryLabel = hash.categoryLabel; |
54 | this.licenceLabel = hash.licenceLabel; | ||
52 | this.description = hash.description; | 55 | this.description = hash.description; |
53 | this.duration = Video.createDurationString(hash.duration); | 56 | this.duration = Video.createDurationString(hash.duration); |
54 | this.id = hash.id; | 57 | this.id = hash.id; |
diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts index debc114aa..15f017e33 100644 --- a/client/src/app/videos/shared/video.service.ts +++ b/client/src/app/videos/shared/video.service.ts | |||
@@ -23,6 +23,7 @@ export class VideoService { | |||
23 | private static BASE_VIDEO_URL = '/api/v1/videos/'; | 23 | private static BASE_VIDEO_URL = '/api/v1/videos/'; |
24 | 24 | ||
25 | videoCategories: Array<{ id: number, label: string }> = []; | 25 | videoCategories: Array<{ id: number, label: string }> = []; |
26 | videoLicences: Array<{ id: number, label: string }> = []; | ||
26 | 27 | ||
27 | constructor( | 28 | constructor( |
28 | private authService: AuthService, | 29 | private authService: AuthService, |
@@ -45,6 +46,19 @@ export class VideoService { | |||
45 | }); | 46 | }); |
46 | } | 47 | } |
47 | 48 | ||
49 | loadVideoLicences() { | ||
50 | return this.http.get(VideoService.BASE_VIDEO_URL + 'licences') | ||
51 | .map(this.restExtractor.extractDataGet) | ||
52 | .subscribe(data => { | ||
53 | Object.keys(data).forEach(licenceKey => { | ||
54 | this.videoLicences.push({ | ||
55 | id: parseInt(licenceKey), | ||
56 | label: data[licenceKey] | ||
57 | }); | ||
58 | }); | ||
59 | }); | ||
60 | } | ||
61 | |||
48 | getVideo(id: string): Observable<Video> { | 62 | getVideo(id: string): Observable<Video> { |
49 | return this.http.get(VideoService.BASE_VIDEO_URL + id) | 63 | return this.http.get(VideoService.BASE_VIDEO_URL + id) |
50 | .map(this.restExtractor.extractDataGet) | 64 | .map(this.restExtractor.extractDataGet) |