From 61b909b9bf849516f30dab2bf5977acfbbddc5c6 Mon Sep 17 00:00:00 2001 From: PhieF Date: Wed, 27 Jun 2018 14:24:49 +0200 Subject: Filter by category (#720) * get videos with specific category (api) * update api doc with category * add url parameter to filter by category * fix lint issues --- server/models/video/video.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'server/models') diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 0041e4d38..0af70cadf 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -106,6 +106,7 @@ export enum ScopeNames { actorId: number, hideNSFW: boolean, filter?: VideoFilter, + category?: number, withFiles?: boolean, accountId?: number, videoChannelId?: number @@ -215,6 +216,10 @@ export enum ScopeNames { query.where['nsfw'] = false } + if (options.category) { + query.where['category'] = options.category + } + if (options.accountId) { accountInclude.where = { id: options.accountId @@ -730,6 +735,7 @@ export class VideoModel extends Model { sort: string, hideNSFW: boolean, withFiles: boolean, + category?: number, filter?: VideoFilter, accountId?: number, videoChannelId?: number @@ -746,6 +752,7 @@ export class VideoModel extends Model { ScopeNames.AVAILABLE_FOR_LIST, { actorId: serverActor.id, hideNSFW: options.hideNSFW, + category: options.category, filter: options.filter, withFiles: options.withFiles, accountId: options.accountId, -- cgit v1.2.3