2018-06-06 16:46:42 +02:00
|
|
|
import { catchError, map, switchMap } from 'rxjs/operators'
|
2017-10-31 16:37:37 +01:00
|
|
|
import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http'
|
2017-12-01 18:56:26 +01:00
|
|
|
import { Injectable } from '@angular/core'
|
2018-05-15 11:55:51 +02:00
|
|
|
import { Observable } from 'rxjs'
|
2017-12-01 18:56:26 +01:00
|
|
|
import { Video as VideoServerModel, VideoDetails as VideoDetailsServerModel } from '../../../../../shared'
|
|
|
|
import { ResultList } from '../../../../../shared/models/result-list.model'
|
2018-09-04 16:21:07 +02:00
|
|
|
import {
|
|
|
|
UserVideoRate,
|
|
|
|
UserVideoRateUpdate,
|
|
|
|
VideoConstant,
|
|
|
|
VideoFilter,
|
|
|
|
VideoPrivacy,
|
|
|
|
VideoRateType,
|
|
|
|
VideoUpdate
|
|
|
|
} from '../../../../../shared/models/videos'
|
2018-04-17 00:49:04 +02:00
|
|
|
import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
|
2017-12-11 17:36:46 +01:00
|
|
|
import { environment } from '../../../environments/environment'
|
2017-12-27 16:11:53 +01:00
|
|
|
import { ComponentPagination } from '../rest/component-pagination.model'
|
2017-12-01 18:56:26 +01:00
|
|
|
import { RestExtractor } from '../rest/rest-extractor.service'
|
|
|
|
import { RestService } from '../rest/rest.service'
|
|
|
|
import { UserService } from '../users/user.service'
|
2018-04-17 10:56:27 +02:00
|
|
|
import { VideoSortField } from './sort-field.type'
|
2017-10-25 16:43:19 +02:00
|
|
|
import { VideoDetails } from './video-details.model'
|
|
|
|
import { VideoEdit } from './video-edit.model'
|
2017-12-01 18:56:26 +01:00
|
|
|
import { Video } from './video.model'
|
2018-02-16 16:35:32 +01:00
|
|
|
import { objectToFormData } from '@app/shared/misc/utils'
|
2018-04-24 15:10:54 +02:00
|
|
|
import { Account } from '@app/shared/account/account.model'
|
|
|
|
import { AccountService } from '@app/shared/account/account.service'
|
2018-04-25 16:56:13 +02:00
|
|
|
import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
|
2018-06-06 16:46:42 +02:00
|
|
|
import { ServerService } from '@app/core'
|
2018-09-26 09:39:41 +02:00
|
|
|
import { UserSubscriptionService } from '@app/shared/user-subscription/user-subscription.service'
|
2018-08-24 11:04:02 +02:00
|
|
|
import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
|
2018-09-04 16:21:07 +02:00
|
|
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
2016-03-14 13:50:19 +01:00
|
|
|
|
2018-08-31 17:19:21 +02:00
|
|
|
export interface VideosProvider {
|
|
|
|
getVideos (
|
|
|
|
videoPagination: ComponentPagination,
|
|
|
|
sort: VideoSortField,
|
|
|
|
filter?: VideoFilter,
|
|
|
|
categoryOneOf?: number
|
|
|
|
): Observable<{ videos: Video[], totalVideos: number }>
|
|
|
|
}
|
|
|
|
|
2016-03-14 13:50:19 +01:00
|
|
|
@Injectable()
|
2018-08-31 17:19:21 +02:00
|
|
|
export class VideoService implements VideosProvider {
|
2018-07-12 19:02:00 +02:00
|
|
|
static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/'
|
|
|
|
static BASE_FEEDS_URL = environment.apiUrl + '/feeds/videos.'
|
2016-03-14 13:50:19 +01:00
|
|
|
|
2017-06-16 14:32:15 +02:00
|
|
|
constructor (
|
2017-09-14 11:57:49 +02:00
|
|
|
private authHttp: HttpClient,
|
2016-08-23 16:54:21 +02:00
|
|
|
private restExtractor: RestExtractor,
|
2018-06-06 16:46:42 +02:00
|
|
|
private restService: RestService,
|
2018-09-04 16:21:07 +02:00
|
|
|
private serverService: ServerService,
|
|
|
|
private i18n: I18n
|
2016-05-27 17:49:18 +02:00
|
|
|
) {}
|
|
|
|
|
2018-02-14 17:16:32 +01:00
|
|
|
getVideoViewUrl (uuid: string) {
|
|
|
|
return VideoService.BASE_VIDEO_URL + uuid + '/views'
|
|
|
|
}
|
|
|
|
|
2018-10-05 11:15:06 +02:00
|
|
|
getUserWatchingVideoUrl (uuid: string) {
|
|
|
|
return VideoService.BASE_VIDEO_URL + uuid + '/watching'
|
|
|
|
}
|
|
|
|
|
2017-10-26 15:01:47 +02:00
|
|
|
getVideo (uuid: string): Observable<VideoDetails> {
|
2018-06-06 16:46:42 +02:00
|
|
|
return this.serverService.localeObservable
|
2018-05-15 11:55:51 +02:00
|
|
|
.pipe(
|
2018-06-06 16:46:42 +02:00
|
|
|
switchMap(translations => {
|
2018-06-06 17:37:13 +02:00
|
|
|
return this.authHttp.get<VideoDetailsServerModel>(VideoService.BASE_VIDEO_URL + uuid)
|
|
|
|
.pipe(map(videoHash => ({ videoHash, translations })))
|
2018-06-06 16:46:42 +02:00
|
|
|
}),
|
|
|
|
map(({ videoHash, translations }) => new VideoDetails(videoHash, translations)),
|
2018-07-09 15:56:02 +02:00
|
|
|
catchError(err => this.restExtractor.handleError(err))
|
2018-05-15 11:55:51 +02:00
|
|
|
)
|
2016-05-27 17:49:18 +02:00
|
|
|
}
|
2016-03-14 13:50:19 +01:00
|
|
|
|
2017-10-25 16:43:19 +02:00
|
|
|
updateVideo (video: VideoEdit) {
|
2018-05-09 11:23:14 +02:00
|
|
|
const language = video.language || null
|
|
|
|
const licence = video.licence || null
|
|
|
|
const category = video.category || null
|
|
|
|
const description = video.description || null
|
|
|
|
const support = video.support || null
|
2018-06-18 10:24:53 +02:00
|
|
|
const scheduleUpdate = video.scheduleUpdate || null
|
2017-05-05 14:29:58 +02:00
|
|
|
|
2017-07-10 19:43:21 +02:00
|
|
|
const body: VideoUpdate = {
|
2017-04-10 21:15:28 +02:00
|
|
|
name: video.name,
|
2017-12-08 08:39:15 +01:00
|
|
|
category,
|
|
|
|
licence,
|
2017-05-05 14:29:58 +02:00
|
|
|
language,
|
2018-02-21 08:49:05 +01:00
|
|
|
support,
|
2017-12-08 08:39:15 +01:00
|
|
|
description,
|
2018-05-11 15:10:13 +02:00
|
|
|
channelId: video.channelId,
|
2017-10-31 11:52:52 +01:00
|
|
|
privacy: video.privacy,
|
2017-07-10 19:43:21 +02:00
|
|
|
tags: video.tags,
|
2018-01-03 10:12:36 +01:00
|
|
|
nsfw: video.nsfw,
|
2018-06-12 20:04:58 +02:00
|
|
|
waitTranscoding: video.waitTranscoding,
|
2018-02-16 16:35:32 +01:00
|
|
|
commentsEnabled: video.commentsEnabled,
|
|
|
|
thumbnailfile: video.thumbnailfile,
|
2018-06-15 16:52:15 +02:00
|
|
|
previewfile: video.previewfile,
|
2018-06-18 10:24:53 +02:00
|
|
|
scheduleUpdate
|
2017-06-16 14:32:15 +02:00
|
|
|
}
|
2017-05-05 14:29:58 +02:00
|
|
|
|
2018-02-16 16:35:32 +01:00
|
|
|
const data = objectToFormData(body)
|
|
|
|
|
|
|
|
return this.authHttp.put(VideoService.BASE_VIDEO_URL + video.id, data)
|
2018-05-15 11:55:51 +02:00
|
|
|
.pipe(
|
|
|
|
map(this.restExtractor.extractDataBool),
|
2018-07-09 15:56:02 +02:00
|
|
|
catchError(err => this.restExtractor.handleError(err))
|
2018-05-15 11:55:51 +02:00
|
|
|
)
|
2017-04-10 21:15:28 +02:00
|
|
|
}
|
|
|
|
|
2017-10-09 19:12:40 +02:00
|
|
|
uploadVideo (video: FormData) {
|
2017-10-13 08:14:40 +02:00
|
|
|
const req = new HttpRequest('POST', VideoService.BASE_VIDEO_URL + 'upload', video, { reportProgress: true })
|
2017-09-14 17:06:31 +02:00
|
|
|
|
2017-10-31 11:52:52 +01:00
|
|
|
return this.authHttp
|
2018-06-12 20:04:58 +02:00
|
|
|
.request<{ video: { id: number, uuid: string } }>(req)
|
2018-07-09 15:56:02 +02:00
|
|
|
.pipe(catchError(err => this.restExtractor.handleError(err)))
|
2017-09-14 17:06:31 +02:00
|
|
|
}
|
|
|
|
|
2018-06-12 20:04:58 +02:00
|
|
|
getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField): Observable<{ videos: Video[], totalVideos: number }> {
|
2017-12-27 16:11:53 +01:00
|
|
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
2016-05-23 11:07:42 +02:00
|
|
|
|
2017-09-14 11:57:49 +02:00
|
|
|
let params = new HttpParams()
|
|
|
|
params = this.restService.addRestGetParams(params, pagination, sort)
|
2016-03-14 13:50:19 +01:00
|
|
|
|
2018-06-06 16:46:42 +02:00
|
|
|
return this.authHttp
|
|
|
|
.get<ResultList<Video>>(UserService.BASE_USERS_URL + '/me/videos', { params })
|
2018-05-15 11:55:51 +02:00
|
|
|
.pipe(
|
2018-06-06 16:46:42 +02:00
|
|
|
switchMap(res => this.extractVideos(res)),
|
2018-07-09 15:56:02 +02:00
|
|
|
catchError(err => this.restExtractor.handleError(err))
|
2018-05-15 11:55:51 +02:00
|
|
|
)
|
2016-03-14 13:50:19 +01:00
|
|
|
}
|
|
|
|
|
2018-04-24 15:10:54 +02:00
|
|
|
getAccountVideos (
|
|
|
|
account: Account,
|
|
|
|
videoPagination: ComponentPagination,
|
|
|
|
sort: VideoSortField
|
2018-06-12 20:04:58 +02:00
|
|
|
): Observable<{ videos: Video[], totalVideos: number }> {
|
2018-04-24 15:10:54 +02:00
|
|
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
|
|
|
|
|
|
|
let params = new HttpParams()
|
|
|
|
params = this.restService.addRestGetParams(params, pagination, sort)
|
|
|
|
|
|
|
|
return this.authHttp
|
2018-06-06 16:46:42 +02:00
|
|
|
.get<ResultList<Video>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params })
|
2018-05-15 11:55:51 +02:00
|
|
|
.pipe(
|
2018-06-06 16:46:42 +02:00
|
|
|
switchMap(res => this.extractVideos(res)),
|
2018-07-09 15:56:02 +02:00
|
|
|
catchError(err => this.restExtractor.handleError(err))
|
2018-05-15 11:55:51 +02:00
|
|
|
)
|
2018-04-24 15:10:54 +02:00
|
|
|
}
|
|
|
|
|
2018-04-25 16:56:13 +02:00
|
|
|
getVideoChannelVideos (
|
|
|
|
videoChannel: VideoChannel,
|
|
|
|
videoPagination: ComponentPagination,
|
|
|
|
sort: VideoSortField
|
2018-06-12 20:04:58 +02:00
|
|
|
): Observable<{ videos: Video[], totalVideos: number }> {
|
2018-04-25 16:56:13 +02:00
|
|
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
|
|
|
|
|
|
|
let params = new HttpParams()
|
|
|
|
params = this.restService.addRestGetParams(params, pagination, sort)
|
|
|
|
|
|
|
|
return this.authHttp
|
2018-08-24 11:04:02 +02:00
|
|
|
.get<ResultList<Video>>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/videos', { params })
|
2018-05-15 11:55:51 +02:00
|
|
|
.pipe(
|
2018-06-06 16:46:42 +02:00
|
|
|
switchMap(res => this.extractVideos(res)),
|
2018-07-09 15:56:02 +02:00
|
|
|
catchError(err => this.restExtractor.handleError(err))
|
2018-05-15 11:55:51 +02:00
|
|
|
)
|
2018-04-25 16:56:13 +02:00
|
|
|
}
|
|
|
|
|
2018-08-21 16:18:59 +02:00
|
|
|
getUserSubscriptionVideos (
|
|
|
|
videoPagination: ComponentPagination,
|
|
|
|
sort: VideoSortField
|
|
|
|
): Observable<{ videos: Video[], totalVideos: number }> {
|
|
|
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
|
|
|
|
|
|
|
let params = new HttpParams()
|
|
|
|
params = this.restService.addRestGetParams(params, pagination, sort)
|
|
|
|
|
|
|
|
return this.authHttp
|
|
|
|
.get<ResultList<Video>>(UserSubscriptionService.BASE_USER_SUBSCRIPTIONS_URL + '/videos', { params })
|
|
|
|
.pipe(
|
|
|
|
switchMap(res => this.extractVideos(res)),
|
|
|
|
catchError(err => this.restExtractor.handleError(err))
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-03-13 10:24:28 +01:00
|
|
|
getVideos (
|
|
|
|
videoPagination: ComponentPagination,
|
2018-04-17 10:56:27 +02:00
|
|
|
sort: VideoSortField,
|
2018-06-27 14:24:49 +02:00
|
|
|
filter?: VideoFilter,
|
2018-07-25 17:18:46 +02:00
|
|
|
categoryOneOf?: number
|
2018-06-12 20:04:58 +02:00
|
|
|
): Observable<{ videos: Video[], totalVideos: number }> {
|
2017-12-27 16:11:53 +01:00
|
|
|
const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
|
2017-10-31 11:52:52 +01:00
|
|
|
|
|
|
|
let params = new HttpParams()
|
|
|
|
params = this.restService.addRestGetParams(params, pagination, sort)
|
|
|
|
|
2018-03-13 10:24:28 +01:00
|
|
|
if (filter) {
|
|
|
|
params = params.set('filter', filter)
|
|
|
|
}
|
|
|
|
|
2018-07-25 17:18:46 +02:00
|
|
|
if (categoryOneOf) {
|
|
|
|
params = params.set('categoryOneOf', categoryOneOf + '')
|
2018-06-27 14:24:49 +02:00
|
|
|
}
|
|
|
|
|
2017-10-31 11:52:52 +01:00
|
|
|
return this.authHttp
|
2018-06-06 16:46:42 +02:00
|
|
|
.get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params })
|
2018-05-15 11:55:51 +02:00
|
|
|
.pipe(
|
2018-06-06 16:46:42 +02:00
|
|
|
switchMap(res => this.extractVideos(res)),
|
2018-07-09 15:56:02 +02:00
|
|
|
catchError(err => this.restExtractor.handleError(err))
|
2018-05-15 11:55:51 +02:00
|
|
|
)
|
2017-10-31 11:52:52 +01:00
|
|
|
}
|
|
|
|
|
2018-04-17 10:56:27 +02:00
|
|
|
buildBaseFeedUrls (params: HttpParams) {
|
2018-04-17 10:35:08 +02:00
|
|
|
const feeds = [
|
|
|
|
{
|
2018-09-26 09:39:41 +02:00
|
|
|
format: FeedFormat.RSS,
|
2018-04-17 10:35:08 +02:00
|
|
|
label: 'rss 2.0',
|
|
|
|
url: VideoService.BASE_FEEDS_URL + FeedFormat.RSS.toLowerCase()
|
|
|
|
},
|
|
|
|
{
|
2018-09-26 09:39:41 +02:00
|
|
|
format: FeedFormat.ATOM,
|
2018-04-17 10:35:08 +02:00
|
|
|
label: 'atom 1.0',
|
|
|
|
url: VideoService.BASE_FEEDS_URL + FeedFormat.ATOM.toLowerCase()
|
|
|
|
},
|
|
|
|
{
|
2018-09-26 09:39:41 +02:00
|
|
|
format: FeedFormat.JSON,
|
2018-04-17 10:35:08 +02:00
|
|
|
label: 'json 1.0',
|
|
|
|
url: VideoService.BASE_FEEDS_URL + FeedFormat.JSON.toLowerCase()
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2018-04-17 10:56:27 +02:00
|
|
|
if (params && params.keys().length !== 0) {
|
|
|
|
for (const feed of feeds) {
|
|
|
|
feed.url += '?' + params.toString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-17 10:35:08 +02:00
|
|
|
return feeds
|
2018-04-17 00:49:04 +02:00
|
|
|
}
|
|
|
|
|
2018-07-25 17:18:46 +02:00
|
|
|
getVideoFeedUrls (sort: VideoSortField, filter?: VideoFilter, categoryOneOf?: number) {
|
2018-04-17 10:56:27 +02:00
|
|
|
let params = this.restService.addRestGetParams(new HttpParams(), undefined, sort)
|
2018-04-17 00:49:04 +02:00
|
|
|
|
2018-04-17 10:35:08 +02:00
|
|
|
if (filter) params = params.set('filter', filter)
|
|
|
|
|
2018-07-25 17:18:46 +02:00
|
|
|
if (categoryOneOf) params = params.set('categoryOneOf', categoryOneOf + '')
|
2018-06-27 14:24:49 +02:00
|
|
|
|
2018-04-17 10:56:27 +02:00
|
|
|
return this.buildBaseFeedUrls(params)
|
2018-04-17 00:49:04 +02:00
|
|
|
}
|
|
|
|
|
2018-04-17 10:35:08 +02:00
|
|
|
getAccountFeedUrls (accountId: number) {
|
2018-04-17 00:49:04 +02:00
|
|
|
let params = this.restService.addRestGetParams(new HttpParams())
|
|
|
|
params = params.set('accountId', accountId.toString())
|
2018-04-17 10:35:08 +02:00
|
|
|
|
2018-04-17 10:56:27 +02:00
|
|
|
return this.buildBaseFeedUrls(params)
|
2018-04-17 00:49:04 +02:00
|
|
|
}
|
|
|
|
|
2018-04-25 16:56:13 +02:00
|
|
|
getVideoChannelFeedUrls (videoChannelId: number) {
|
|
|
|
let params = this.restService.addRestGetParams(new HttpParams())
|
|
|
|
params = params.set('videoChannelId', videoChannelId.toString())
|
|
|
|
|
|
|
|
return this.buildBaseFeedUrls(params)
|
|
|
|
}
|
|
|
|
|
2017-09-14 11:57:49 +02:00
|
|
|
removeVideo (id: number) {
|
2017-10-31 11:52:52 +01:00
|
|
|
return this.authHttp
|
2018-05-15 11:55:51 +02:00
|
|
|
.delete(VideoService.BASE_VIDEO_URL + id)
|
|
|
|
.pipe(
|
|
|
|
map(this.restExtractor.extractDataBool),
|
2018-07-09 15:56:02 +02:00
|
|
|
catchError(err => this.restExtractor.handleError(err))
|
2018-05-15 11:55:51 +02:00
|
|
|
)
|
2016-05-27 17:49:18 +02:00
|
|
|
}
|
|
|
|
|
2017-10-30 20:26:06 +01:00
|
|
|
loadCompleteDescription (descriptionPath: string) {
|
|
|
|
return this.authHttp
|
2018-10-18 14:35:31 +02:00
|
|
|
.get<{ description: string }>(environment.apiUrl + descriptionPath)
|
2018-05-15 11:55:51 +02:00
|
|
|
.pipe(
|
2018-10-18 14:35:31 +02:00
|
|
|
map(res => res.description),
|
2018-07-09 15:56:02 +02:00
|
|
|
catchError(err => this.restExtractor.handleError(err))
|
2018-05-15 11:55:51 +02:00
|
|
|
)
|
2017-03-08 21:35:43 +01:00
|
|
|
}
|
|
|
|
|
2017-07-11 16:01:56 +02:00
|
|
|
setVideoLike (id: number) {
|
2017-06-16 14:32:15 +02:00
|
|
|
return this.setVideoRate(id, 'like')
|
2017-03-08 21:35:43 +01:00
|
|
|
}
|
|
|
|
|
2017-07-11 16:01:56 +02:00
|
|
|
setVideoDislike (id: number) {
|
2017-06-16 14:32:15 +02:00
|
|
|
return this.setVideoRate(id, 'dislike')
|
2017-03-08 21:35:43 +01:00
|
|
|
}
|
|
|
|
|
2018-01-07 14:48:10 +01:00
|
|
|
unsetVideoLike (id: number) {
|
|
|
|
return this.setVideoRate(id, 'none')
|
|
|
|
}
|
|
|
|
|
2018-05-16 11:00:57 +02:00
|
|
|
getUserVideoRating (id: number) {
|
2017-10-13 08:14:40 +02:00
|
|
|
const url = UserService.BASE_USERS_URL + 'me/videos/' + id + '/rating'
|
2017-03-08 21:35:43 +01:00
|
|
|
|
2018-05-16 11:00:57 +02:00
|
|
|
return this.authHttp.get<UserVideoRate>(url)
|
2018-07-09 15:56:02 +02:00
|
|
|
.pipe(catchError(err => this.restExtractor.handleError(err)))
|
2017-03-08 21:35:43 +01:00
|
|
|
}
|
|
|
|
|
2018-07-19 16:17:54 +02:00
|
|
|
extractVideos (result: ResultList<VideoServerModel>) {
|
2018-06-06 16:46:42 +02:00
|
|
|
return this.serverService.localeObservable
|
2018-06-12 20:04:58 +02:00
|
|
|
.pipe(
|
|
|
|
map(translations => {
|
|
|
|
const videosJson = result.data
|
|
|
|
const totalVideos = result.total
|
|
|
|
const videos: Video[] = []
|
|
|
|
|
|
|
|
for (const videoJson of videosJson) {
|
|
|
|
videos.push(new Video(videoJson, translations))
|
|
|
|
}
|
|
|
|
|
|
|
|
return { videos, totalVideos }
|
|
|
|
})
|
|
|
|
)
|
2016-05-21 18:03:34 +02:00
|
|
|
}
|
2018-07-19 16:17:54 +02:00
|
|
|
|
2018-09-04 16:21:07 +02:00
|
|
|
explainedPrivacyLabels (privacies: VideoConstant<VideoPrivacy>[]) {
|
|
|
|
const newPrivacies = privacies.slice()
|
|
|
|
|
|
|
|
const privatePrivacy = newPrivacies.find(p => p.id === VideoPrivacy.PRIVATE)
|
|
|
|
if (privatePrivacy) privatePrivacy.label = this.i18n('Only I can see this video')
|
|
|
|
|
|
|
|
const unlistedPrivacy = newPrivacies.find(p => p.id === VideoPrivacy.UNLISTED)
|
|
|
|
if (unlistedPrivacy) unlistedPrivacy.label = this.i18n('Only people with the private link can see this video')
|
|
|
|
|
|
|
|
const publicPrivacy = newPrivacies.find(p => p.id === VideoPrivacy.PUBLIC)
|
|
|
|
if (publicPrivacy) publicPrivacy.label = this.i18n('Anyone can see this video')
|
|
|
|
|
|
|
|
return privacies
|
|
|
|
}
|
|
|
|
|
2018-07-19 16:17:54 +02:00
|
|
|
private setVideoRate (id: number, rateType: VideoRateType) {
|
|
|
|
const url = VideoService.BASE_VIDEO_URL + id + '/rate'
|
|
|
|
const body: UserVideoRateUpdate = {
|
|
|
|
rating: rateType
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.authHttp
|
|
|
|
.put(url, body)
|
|
|
|
.pipe(
|
|
|
|
map(this.restExtractor.extractDataBool),
|
|
|
|
catchError(err => this.restExtractor.handleError(err))
|
|
|
|
)
|
|
|
|
}
|
2016-03-14 13:50:19 +01:00
|
|
|
}
|