From bc99dfe54e093e69ba8fd06d36b36fbbda3f45de Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Wed, 15 Jul 2020 11:17:03 +0200 Subject: variable columns for users list, more columns possible, badge display for statuses --- server/models/video/video-channel.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'server/models') diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 03a3cdf81..f3401fb9c 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -54,6 +54,7 @@ export enum ScopeNames { type AvailableForListOptions = { actorId: number + search?: string } type AvailableWithStatsOptions = { @@ -309,15 +310,23 @@ export class VideoChannelModel extends Model { return VideoChannelModel.count(query) } - static listForApi (actorId: number, start: number, count: number, sort: string) { + static listForApi (parameters: { + actorId: number + start: number + count: number + sort: string + search?: string + }) { + const { actorId, search } = parameters + const query = { - offset: start, - limit: count, - order: getSort(sort) + offset: parameters.start, + limit: parameters.count, + order: getSort(parameters.sort) } const scopes = { - method: [ ScopeNames.FOR_API, { actorId } as AvailableForListOptions ] + method: [ ScopeNames.FOR_API, { actorId, search } as AvailableForListOptions ] } return VideoChannelModel .scope(scopes) -- cgit v1.2.3