aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-comment.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-23 09:50:57 +0200
committerChocobozzz <me@florianbigard.com>2019-04-24 16:26:21 +0200
commit3acc50844047a37698f0618fa235c138e386a053 (patch)
treee33243bf7fadbcf2df616fc41814245094fd881a /server/models/video/video-comment.ts
parent1735c825726edaa0af5035cb6cbb0cc0db502c6d (diff)
downloadPeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.gz
PeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.zst
PeerTube-3acc50844047a37698f0618fa235c138e386a053.zip
Upgrade sequelize
Diffstat (limited to 'server/models/video/video-comment.ts')
-rw-r--r--server/models/video/video-comment.ts33
1 files changed, 16 insertions, 17 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index 5f7cd3671..fee11ec5f 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -30,7 +30,7 @@ import { UserModel } from '../account/user'
30import { actorNameAlphabet } from '../../helpers/custom-validators/activitypub/actor' 30import { actorNameAlphabet } from '../../helpers/custom-validators/activitypub/actor'
31import { regexpCapture } from '../../helpers/regexp' 31import { regexpCapture } from '../../helpers/regexp'
32import { uniq } from 'lodash' 32import { uniq } from 'lodash'
33import { FindOptions, Op, Order, Sequelize, Transaction } from 'sequelize' 33import { FindOptions, Op, Order, ScopeOptions, Sequelize, Transaction } from 'sequelize'
34 34
35enum ScopeNames { 35enum ScopeNames {
36 WITH_ACCOUNT = 'WITH_ACCOUNT', 36 WITH_ACCOUNT = 'WITH_ACCOUNT',
@@ -39,7 +39,7 @@ enum ScopeNames {
39 ATTRIBUTES_FOR_API = 'ATTRIBUTES_FOR_API' 39 ATTRIBUTES_FOR_API = 'ATTRIBUTES_FOR_API'
40} 40}
41 41
42@Scopes({ 42@Scopes(() => ({
43 [ScopeNames.ATTRIBUTES_FOR_API]: (serverAccountId: number, userAccountId?: number) => { 43 [ScopeNames.ATTRIBUTES_FOR_API]: (serverAccountId: number, userAccountId?: number) => {
44 return { 44 return {
45 attributes: { 45 attributes: {
@@ -63,34 +63,34 @@ enum ScopeNames {
63 ] 63 ]
64 ] 64 ]
65 } 65 }
66 } 66 } as FindOptions
67 }, 67 },
68 [ScopeNames.WITH_ACCOUNT]: { 68 [ScopeNames.WITH_ACCOUNT]: {
69 include: [ 69 include: [
70 { 70 {
71 model: () => AccountModel, 71 model: AccountModel,
72 include: [ 72 include: [
73 { 73 {
74 model: () => ActorModel, 74 model: ActorModel,
75 include: [ 75 include: [
76 { 76 {
77 model: () => ServerModel, 77 model: ServerModel,
78 required: false 78 required: false
79 }, 79 },
80 { 80 {
81 model: () => AvatarModel, 81 model: AvatarModel,
82 required: false 82 required: false
83 } 83 }
84 ] 84 ]
85 } 85 }
86 ] 86 ]
87 } 87 }
88 ] as any // FIXME: sequelize typings 88 ]
89 }, 89 },
90 [ScopeNames.WITH_IN_REPLY_TO]: { 90 [ScopeNames.WITH_IN_REPLY_TO]: {
91 include: [ 91 include: [
92 { 92 {
93 model: () => VideoCommentModel, 93 model: VideoCommentModel,
94 as: 'InReplyToVideoComment' 94 as: 'InReplyToVideoComment'
95 } 95 }
96 ] 96 ]
@@ -98,19 +98,19 @@ enum ScopeNames {
98 [ScopeNames.WITH_VIDEO]: { 98 [ScopeNames.WITH_VIDEO]: {
99 include: [ 99 include: [
100 { 100 {
101 model: () => VideoModel, 101 model: VideoModel,
102 required: true, 102 required: true,
103 include: [ 103 include: [
104 { 104 {
105 model: () => VideoChannelModel.unscoped(), 105 model: VideoChannelModel.unscoped(),
106 required: true, 106 required: true,
107 include: [ 107 include: [
108 { 108 {
109 model: () => AccountModel, 109 model: AccountModel,
110 required: true, 110 required: true,
111 include: [ 111 include: [
112 { 112 {
113 model: () => ActorModel, 113 model: ActorModel,
114 required: true 114 required: true
115 } 115 }
116 ] 116 ]
@@ -119,9 +119,9 @@ enum ScopeNames {
119 } 119 }
120 ] 120 ]
121 } 121 }
122 ] as any // FIXME: sequelize typings 122 ]
123 } 123 }
124}) 124}))
125@Table({ 125@Table({
126 tableName: 'videoComment', 126 tableName: 'videoComment',
127 indexes: [ 127 indexes: [
@@ -313,8 +313,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
313 } 313 }
314 } 314 }
315 315
316 // FIXME: typings 316 const scopes: (string | ScopeOptions)[] = [
317 const scopes: any[] = [
318 ScopeNames.WITH_ACCOUNT, 317 ScopeNames.WITH_ACCOUNT,
319 { 318 {
320 method: [ ScopeNames.ATTRIBUTES_FOR_API, serverAccountId, userAccountId ] 319 method: [ ScopeNames.ATTRIBUTES_FOR_API, serverAccountId, userAccountId ]