-import { Observable } from 'rxjs'
-import { catchError, map } from 'rxjs/operators'
+import { SortMeta } from 'primeng/api'
+import { from, Observable } from 'rxjs'
+import { catchError, concatMap, map, toArray } from 'rxjs/operators'
import { HttpClient, HttpParams } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { ComponentPaginationLight, RestExtractor, RestPagination, RestService } from '@app/core'
import { environment } from '../../../environments/environment'
import { VideoCommentThreadTree } from './video-comment-thread-tree.model'
import { VideoComment } from './video-comment.model'
-import { SortMeta } from 'primeng/api'
@Injectable()
export class VideoCommentService {
+ static BASE_FEEDS_URL = environment.apiUrl + '/feeds/video-comments.'
+
private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/'
- private static BASE_FEEDS_URL = environment.apiUrl + '/feeds/video-comments.'
constructor (
private authHttp: HttpClient,
search?: string
}): Observable<ResultList<VideoCommentAdmin>> {
const { pagination, sort, search } = options
- const url = VideoCommentService.BASE_VIDEO_URL + '/comments'
+ const url = VideoCommentService.BASE_VIDEO_URL + 'comments'
let params = new HttpParams()
params = this.restService.addRestGetParams(params, pagination, sort)
)
}
+ deleteVideoComments (comments: { videoId: number | string, commentId: number }[]) {
+ return from(comments)
+ .pipe(
+ concatMap(c => this.deleteVideoComment(c.videoId, c.commentId)),
+ toArray()
+ )
+ }
+
getVideoCommentsFeeds (videoUUID?: string) {
const feeds = [
{
private buildParamsFromSearch (search: string, params: HttpParams) {
const filters = this.restService.parseQueryStringFilter(search, {
- state: {
+ isLocal: {
prefix: 'local:',
isBoolean: true,
handler: v => {