diff options
author | Chocobozzz <me@florianbigard.com> | 2020-12-08 14:30:29 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-12-09 11:41:22 +0100 |
commit | b49f22d8f9a52ab75fd38db2d377249eb58fa678 (patch) | |
tree | a2825877d7b3b53454804a79c9d2a14c5d37385c /server/models/activitypub/actor-follow.ts | |
parent | 6c8c15f914cd375da1db5d0cd4d924a86c53d4c1 (diff) | |
download | PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.gz PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.zst PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.zip |
Upgrade sequelize to v6
Diffstat (limited to 'server/models/activitypub/actor-follow.ts')
-rw-r--r-- | server/models/activitypub/actor-follow.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts index 58bc63d34..ce6a4e267 100644 --- a/server/models/activitypub/actor-follow.ts +++ b/server/models/activitypub/actor-follow.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import * as Bluebird from 'bluebird' | ||
2 | import { difference, values } from 'lodash' | 1 | import { difference, values } from 'lodash' |
3 | import { IncludeOptions, Op, QueryTypes, Transaction, WhereOptions } from 'sequelize' | 2 | import { IncludeOptions, Op, QueryTypes, Transaction, WhereOptions } from 'sequelize' |
4 | import { | 3 | import { |
@@ -62,7 +61,7 @@ import { ActorModel, unusedActorAttributesForAPI } from './actor' | |||
62 | } | 61 | } |
63 | ] | 62 | ] |
64 | }) | 63 | }) |
65 | export class ActorFollowModel extends Model<ActorFollowModel> { | 64 | export class ActorFollowModel extends Model { |
66 | 65 | ||
67 | @AllowNull(false) | 66 | @AllowNull(false) |
68 | @Column(DataType.ENUM(...values(FOLLOW_STATES))) | 67 | @Column(DataType.ENUM(...values(FOLLOW_STATES))) |
@@ -176,7 +175,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
176 | .then(results => results.length === 1) | 175 | .then(results => results.length === 1) |
177 | } | 176 | } |
178 | 177 | ||
179 | static loadByActorAndTarget (actorId: number, targetActorId: number, t?: Transaction): Bluebird<MActorFollowActorsDefault> { | 178 | static loadByActorAndTarget (actorId: number, targetActorId: number, t?: Transaction): Promise<MActorFollowActorsDefault> { |
180 | const query = { | 179 | const query = { |
181 | where: { | 180 | where: { |
182 | actorId, | 181 | actorId, |
@@ -205,7 +204,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
205 | targetName: string, | 204 | targetName: string, |
206 | targetHost: string, | 205 | targetHost: string, |
207 | t?: Transaction | 206 | t?: Transaction |
208 | ): Bluebird<MActorFollowActorsDefaultSubscription> { | 207 | ): Promise<MActorFollowActorsDefaultSubscription> { |
209 | const actorFollowingPartInclude: IncludeOptions = { | 208 | const actorFollowingPartInclude: IncludeOptions = { |
210 | model: ActorModel, | 209 | model: ActorModel, |
211 | required: true, | 210 | required: true, |
@@ -258,7 +257,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
258 | }) | 257 | }) |
259 | } | 258 | } |
260 | 259 | ||
261 | static listSubscribedIn (actorId: number, targets: { name: string, host?: string }[]): Bluebird<MActorFollowFollowingHost[]> { | 260 | static listSubscribedIn (actorId: number, targets: { name: string, host?: string }[]): Promise<MActorFollowFollowingHost[]> { |
262 | const whereTab = targets | 261 | const whereTab = targets |
263 | .map(t => { | 262 | .map(t => { |
264 | if (t.host) { | 263 | if (t.host) { |
@@ -287,7 +286,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
287 | }) | 286 | }) |
288 | 287 | ||
289 | const query = { | 288 | const query = { |
290 | attributes: [], | 289 | attributes: [ 'id' ], |
291 | where: { | 290 | where: { |
292 | [Op.and]: [ | 291 | [Op.and]: [ |
293 | { | 292 | { |
@@ -671,7 +670,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
671 | 670 | ||
672 | selections.push('COUNT(*) AS "total"') | 671 | selections.push('COUNT(*) AS "total"') |
673 | 672 | ||
674 | const tasks: Bluebird<any>[] = [] | 673 | const tasks: Promise<any>[] = [] |
675 | 674 | ||
676 | for (const selection of selections) { | 675 | for (const selection of selections) { |
677 | let query = 'SELECT ' + selection + ' FROM "actor" ' + | 676 | let query = 'SELECT ' + selection + ' FROM "actor" ' + |