From 08c1efbe32244c321de28b0f2a6aaa3f99f46b58 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 26 Apr 2018 16:11:38 +0200 Subject: Add video channel management --- .../shared/video-channel/video-channel.service.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'client/src/app/shared/video-channel/video-channel.service.ts') diff --git a/client/src/app/shared/video-channel/video-channel.service.ts b/client/src/app/shared/video-channel/video-channel.service.ts index d8efcc171..3533a0e9c 100644 --- a/client/src/app/shared/video-channel/video-channel.service.ts +++ b/client/src/app/shared/video-channel/video-channel.service.ts @@ -5,12 +5,14 @@ import { Observable } from 'rxjs/Observable' import { RestExtractor } from '../rest/rest-extractor.service' import { RestService } from '../rest/rest.service' import { HttpClient } from '@angular/common/http' -import { VideoChannel as VideoChannelServer } from '../../../../../shared/models/videos' +import { VideoChannel as VideoChannelServer, VideoChannelCreate, VideoChannelUpdate } from '../../../../../shared/models/videos' import { AccountService } from '../account/account.service' import { ResultList } from '../../../../../shared' import { VideoChannel } from './video-channel.model' import { ReplaySubject } from 'rxjs/ReplaySubject' import { environment } from '../../../environments/environment' +import { UserService } from '@app/+admin/users/shared/user.service' +import { User } from '@app/shared' @Injectable() export class VideoChannelService { @@ -37,6 +39,24 @@ export class VideoChannelService { .catch((res) => this.restExtractor.handleError(res)) } + createVideoChannel (videoChannel: VideoChannelCreate) { + return this.authHttp.post(VideoChannelService.BASE_VIDEO_CHANNEL_URL, videoChannel) + .map(this.restExtractor.extractDataBool) + .catch(err => this.restExtractor.handleError(err)) + } + + updateVideoChannel (videoChannelUUID: string, videoChannel: VideoChannelUpdate) { + return this.authHttp.put(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelUUID, videoChannel) + .map(this.restExtractor.extractDataBool) + .catch(err => this.restExtractor.handleError(err)) + } + + removeVideoChannel (videoChannel: VideoChannel) { + return this.authHttp.delete(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.uuid) + .map(this.restExtractor.extractDataBool) + .catch(err => this.restExtractor.handleError(err)) + } + private extractVideoChannels (result: ResultList) { const videoChannels: VideoChannel[] = [] -- cgit v1.2.3