X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-channel.ts;h=b0b261c88a93dc965a3955685244a4256883795f;hb=41b15c892192073828458d007256a9dfdf3bb6fb;hp=fb70e662526a6561ca44f1ffb2ae9d85628a8d1c;hpb=97567dd81f508dd6295ac4d73d849aa2ce0a6549;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index fb70e6625..b0b261c88 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -72,7 +72,7 @@ type AvailableForListOptions = { attributes: [ 'name', 'description', 'id', 'actorId' ], include: [ { - attributes: [ 'uuid', 'preferredUsername', 'url', 'serverId', 'avatarId' ], + attributes: [ 'preferredUsername', 'url', 'serverId', 'avatarId' ], model: ActorModel.unscoped(), required: true, include: [ @@ -334,14 +334,21 @@ export class VideoChannelModel extends Model { }) } - static listByAccount (accountId: number) { + static listByAccount (options: { + accountId: number, + start: number, + count: number, + sort: string + }) { const query = { - order: getSort('createdAt'), + offset: options.start, + limit: options.count, + order: getSort(options.sort), include: [ { model: AccountModel, where: { - id: accountId + id: options.accountId }, required: true } @@ -380,24 +387,6 @@ export class VideoChannelModel extends Model { .findByPk(id) } - static loadByUUIDAndPopulateAccount (uuid: string) { - const query = { - include: [ - { - model: ActorModel, - required: true, - where: { - uuid - } - } - ] - } - - return VideoChannelModel - .scope([ ScopeNames.WITH_ACCOUNT ]) - .findOne(query) - } - static loadByUrlAndPopulateAccount (url: string) { const query = { include: [ @@ -503,7 +492,6 @@ export class VideoChannelModel extends Model { return { id: this.id, - uuid: actor.uuid, name: actor.name, displayName: this.getDisplayName(), url: actor.url,