diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-23 09:50:57 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-24 16:26:21 +0200 |
commit | 3acc50844047a37698f0618fa235c138e386a053 (patch) | |
tree | e33243bf7fadbcf2df616fc41814245094fd881a /server/models/activitypub | |
parent | 1735c825726edaa0af5035cb6cbb0cc0db502c6d (diff) | |
download | PeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.gz PeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.zst PeerTube-3acc50844047a37698f0618fa235c138e386a053.zip |
Upgrade sequelize
Diffstat (limited to 'server/models/activitypub')
-rw-r--r-- | server/models/activitypub/actor.ts | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts index 1ebee8df5..4a466441c 100644 --- a/server/models/activitypub/actor.ts +++ b/server/models/activitypub/actor.ts | |||
@@ -56,46 +56,46 @@ export const unusedActorAttributesForAPI = [ | |||
56 | 'updatedAt' | 56 | 'updatedAt' |
57 | ] | 57 | ] |
58 | 58 | ||
59 | @DefaultScope({ | 59 | @DefaultScope(() => ({ |
60 | include: [ | 60 | include: [ |
61 | { | 61 | { |
62 | model: () => ServerModel, | 62 | model: ServerModel, |
63 | required: false | 63 | required: false |
64 | }, | 64 | }, |
65 | { | 65 | { |
66 | model: () => AvatarModel, | 66 | model: AvatarModel, |
67 | required: false | 67 | required: false |
68 | } | 68 | } |
69 | ] | 69 | ] |
70 | }) | 70 | })) |
71 | @Scopes({ | 71 | @Scopes(() => ({ |
72 | [ScopeNames.FULL]: { | 72 | [ScopeNames.FULL]: { |
73 | include: [ | 73 | include: [ |
74 | { | 74 | { |
75 | model: () => AccountModel.unscoped(), | 75 | model: AccountModel.unscoped(), |
76 | required: false | 76 | required: false |
77 | }, | 77 | }, |
78 | { | 78 | { |
79 | model: () => VideoChannelModel.unscoped(), | 79 | model: VideoChannelModel.unscoped(), |
80 | required: false, | 80 | required: false, |
81 | include: [ | 81 | include: [ |
82 | { | 82 | { |
83 | model: () => AccountModel, | 83 | model: AccountModel, |
84 | required: true | 84 | required: true |
85 | } | 85 | } |
86 | ] | 86 | ] |
87 | }, | 87 | }, |
88 | { | 88 | { |
89 | model: () => ServerModel, | 89 | model: ServerModel, |
90 | required: false | 90 | required: false |
91 | }, | 91 | }, |
92 | { | 92 | { |
93 | model: () => AvatarModel, | 93 | model: AvatarModel, |
94 | required: false | 94 | required: false |
95 | } | 95 | } |
96 | ] as any // FIXME: sequelize typings | 96 | ] |
97 | } | 97 | } |
98 | }) | 98 | })) |
99 | @Table({ | 99 | @Table({ |
100 | tableName: 'actor', | 100 | tableName: 'actor', |
101 | indexes: [ | 101 | indexes: [ |
@@ -131,7 +131,7 @@ export const unusedActorAttributesForAPI = [ | |||
131 | export class ActorModel extends Model<ActorModel> { | 131 | export class ActorModel extends Model<ActorModel> { |
132 | 132 | ||
133 | @AllowNull(false) | 133 | @AllowNull(false) |
134 | @Column({ type: DataType.ENUM(...values(ACTIVITY_PUB_ACTOR_TYPES)) }) // FIXME: sequelize typings | 134 | @Column(DataType.ENUM(...values(ACTIVITY_PUB_ACTOR_TYPES))) |
135 | type: ActivityPubActorType | 135 | type: ActivityPubActorType |
136 | 136 | ||
137 | @AllowNull(false) | 137 | @AllowNull(false) |
@@ -280,14 +280,16 @@ export class ActorModel extends Model<ActorModel> { | |||
280 | attributes: [ 'id' ], | 280 | attributes: [ 'id' ], |
281 | model: VideoChannelModel.unscoped(), | 281 | model: VideoChannelModel.unscoped(), |
282 | required: true, | 282 | required: true, |
283 | include: { | 283 | include: [ |
284 | attributes: [ 'id' ], | 284 | { |
285 | model: VideoModel.unscoped(), | 285 | attributes: [ 'id' ], |
286 | required: true, | 286 | model: VideoModel.unscoped(), |
287 | where: { | 287 | required: true, |
288 | id: videoId | 288 | where: { |
289 | id: videoId | ||
290 | } | ||
289 | } | 291 | } |
290 | } | 292 | ] |
291 | } | 293 | } |
292 | ] | 294 | ] |
293 | } | 295 | } |
@@ -295,7 +297,7 @@ export class ActorModel extends Model<ActorModel> { | |||
295 | transaction | 297 | transaction |
296 | } | 298 | } |
297 | 299 | ||
298 | return ActorModel.unscoped().findOne(query as any) // FIXME: typings | 300 | return ActorModel.unscoped().findOne(query) |
299 | } | 301 | } |
300 | 302 | ||
301 | static isActorUrlExist (url: string) { | 303 | static isActorUrlExist (url: string) { |
@@ -389,8 +391,7 @@ export class ActorModel extends Model<ActorModel> { | |||
389 | } | 391 | } |
390 | 392 | ||
391 | static incrementFollows (id: number, column: 'followersCount' | 'followingCount', by: number) { | 393 | static incrementFollows (id: number, column: 'followersCount' | 'followingCount', by: number) { |
392 | // FIXME: typings | 394 | return ActorModel.increment(column, { |
393 | return (ActorModel as any).increment(column, { | ||
394 | by, | 395 | by, |
395 | where: { | 396 | where: { |
396 | id | 397 | id |