X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-channel.ts;h=9f04a57c64025f11baa6e9d02fee6f4ef1208141;hb=9c9a236b541a286e165d67341e4ddd6ea2fabdf1;hp=e4b12c517ccc71eeb61f0c70402a625cdcee87c9;hpb=56d07460b5fe55cc86501742e759d9711d7eb386;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index e4b12c517..9f04a57c6 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -438,30 +438,6 @@ ON "Account->Actor"."serverId" = "Account->Actor->Server"."id"` } } - static listForApi (parameters: { - actorId: number - start: number - count: number - sort: string - }) { - const { actorId } = parameters - - const query = { - offset: parameters.start, - limit: parameters.count, - order: getSort(parameters.sort) - } - - return VideoChannelModel - .scope({ - method: [ ScopeNames.FOR_API, { actorId } as AvailableForListOptions ] - }) - .findAndCountAll(query) - .then(({ rows, count }) => { - return { total: count, data: rows } - }) - } - static listLocalsForSitemap (sort: string): Promise { const query = { attributes: [ ], @@ -483,15 +459,33 @@ ON "Account->Actor"."serverId" = "Account->Actor->Server"."id"` .findAll(query) } - static searchForApi (options: { - actorId: number - search?: string + static listForApi (parameters: Pick & { start: number count: number sort: string + }) { + const { actorId } = parameters + + const query = { + offset: parameters.start, + limit: parameters.count, + order: getSort(parameters.sort) + } + + return VideoChannelModel + .scope({ + method: [ ScopeNames.FOR_API, { actorId } as AvailableForListOptions ] + }) + .findAndCountAll(query) + .then(({ rows, count }) => { + return { total: count, data: rows } + }) + } - host?: string - handles?: string[] + static searchForApi (options: Pick & { + start: number + count: number + sort: string }) { let attributesInclude: any[] = [ literal('0 as similarity') ] let where: WhereOptions