- static loadFromAccountByVideoId (videoId: number, transaction: Transaction): Promise<MActor> {
- const query = {
- include: [
- {
- attributes: [ 'id' ],
- model: AccountModel.unscoped(),
- required: true,
- include: [
- {
- attributes: [ 'id' ],
- model: VideoChannelModel.unscoped(),
- required: true,
- include: [
- {
- attributes: [ 'id' ],
- model: VideoModel.unscoped(),
- required: true,
- where: {
- id: videoId
- }
- }
- ]
- }
- ]
- }
- ],
+ static loadAccountActorFollowerUrlByVideoId (videoId: number, transaction: Transaction) {
+ const query = `SELECT "actor"."id" AS "id", "actor"."followersUrl" AS "followersUrl" ` +
+ `FROM "actor" ` +
+ `INNER JOIN "account" ON "actor"."id" = "account"."actorId" ` +
+ `INNER JOIN "videoChannel" ON "videoChannel"."accountId" = "account"."id" ` +
+ `INNER JOIN "video" ON "video"."channelId" = "videoChannel"."id" AND "video"."id" = :videoId`
+
+ const options = {
+ type: QueryTypes.SELECT as QueryTypes.SELECT,
+ replacements: { videoId },
+ plain: true as true,