diff options
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-channel.ts | 19 |
1 files changed, 14 insertions, 5 deletions
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 { | |||
54 | 54 | ||
55 | type AvailableForListOptions = { | 55 | type AvailableForListOptions = { |
56 | actorId: number | 56 | actorId: number |
57 | search?: string | ||
57 | } | 58 | } |
58 | 59 | ||
59 | type AvailableWithStatsOptions = { | 60 | type AvailableWithStatsOptions = { |
@@ -309,15 +310,23 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
309 | return VideoChannelModel.count(query) | 310 | return VideoChannelModel.count(query) |
310 | } | 311 | } |
311 | 312 | ||
312 | static listForApi (actorId: number, start: number, count: number, sort: string) { | 313 | static listForApi (parameters: { |
314 | actorId: number | ||
315 | start: number | ||
316 | count: number | ||
317 | sort: string | ||
318 | search?: string | ||
319 | }) { | ||
320 | const { actorId, search } = parameters | ||
321 | |||
313 | const query = { | 322 | const query = { |
314 | offset: start, | 323 | offset: parameters.start, |
315 | limit: count, | 324 | limit: parameters.count, |
316 | order: getSort(sort) | 325 | order: getSort(parameters.sort) |
317 | } | 326 | } |
318 | 327 | ||
319 | const scopes = { | 328 | const scopes = { |
320 | method: [ ScopeNames.FOR_API, { actorId } as AvailableForListOptions ] | 329 | method: [ ScopeNames.FOR_API, { actorId, search } as AvailableForListOptions ] |
321 | } | 330 | } |
322 | return VideoChannelModel | 331 | return VideoChannelModel |
323 | .scope(scopes) | 332 | .scope(scopes) |