aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/abuse
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-12-08 14:30:29 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-12-09 11:41:22 +0100
commitb49f22d8f9a52ab75fd38db2d377249eb58fa678 (patch)
treea2825877d7b3b53454804a79c9d2a14c5d37385c /server/models/abuse
parent6c8c15f914cd375da1db5d0cd4d924a86c53d4c1 (diff)
downloadPeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.gz
PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.tar.zst
PeerTube-b49f22d8f9a52ab75fd38db2d377249eb58fa678.zip
Upgrade sequelize to v6
Diffstat (limited to 'server/models/abuse')
-rw-r--r--server/models/abuse/abuse-message.ts6
-rw-r--r--server/models/abuse/abuse.ts7
-rw-r--r--server/models/abuse/video-abuse.ts2
-rw-r--r--server/models/abuse/video-comment-abuse.ts2
4 files changed, 8 insertions, 9 deletions
diff --git a/server/models/abuse/abuse-message.ts b/server/models/abuse/abuse-message.ts
index fce20f7a7..7e51b3e07 100644
--- a/server/models/abuse/abuse-message.ts
+++ b/server/models/abuse/abuse-message.ts
@@ -1,10 +1,10 @@
1import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' 1import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
2import { isAbuseMessageValid } from '@server/helpers/custom-validators/abuses' 2import { isAbuseMessageValid } from '@server/helpers/custom-validators/abuses'
3import { MAbuseMessage, MAbuseMessageFormattable } from '@server/types/models'
3import { AbuseMessage } from '@shared/models' 4import { AbuseMessage } from '@shared/models'
4import { AccountModel, ScopeNames as AccountScopeNames } from '../account/account' 5import { AccountModel, ScopeNames as AccountScopeNames } from '../account/account'
5import { throwIfNotValid, getSort } from '../utils' 6import { getSort, throwIfNotValid } from '../utils'
6import { AbuseModel } from './abuse' 7import { AbuseModel } from './abuse'
7import { MAbuseMessageFormattable, MAbuseMessage } from '@server/types/models'
8 8
9@Table({ 9@Table({
10 tableName: 'abuseMessage', 10 tableName: 'abuseMessage',
@@ -17,7 +17,7 @@ import { MAbuseMessageFormattable, MAbuseMessage } from '@server/types/models'
17 } 17 }
18 ] 18 ]
19}) 19})
20export class AbuseMessageModel extends Model<AbuseMessageModel> { 20export class AbuseMessageModel extends Model {
21 21
22 @AllowNull(false) 22 @AllowNull(false)
23 @Is('AbuseMessage', value => throwIfNotValid(value, isAbuseMessageValid, 'message')) 23 @Is('AbuseMessage', value => throwIfNotValid(value, isAbuseMessageValid, 'message'))
diff --git a/server/models/abuse/abuse.ts b/server/models/abuse/abuse.ts
index 290270fe2..de249d211 100644
--- a/server/models/abuse/abuse.ts
+++ b/server/models/abuse/abuse.ts
@@ -1,4 +1,3 @@
1import * as Bluebird from 'bluebird'
2import { invert } from 'lodash' 1import { invert } from 'lodash'
3import { literal, Op, QueryTypes } from 'sequelize' 2import { literal, Op, QueryTypes } from 'sequelize'
4import { 3import {
@@ -188,7 +187,7 @@ export enum ScopeNames {
188 } 187 }
189 ] 188 ]
190}) 189})
191export class AbuseModel extends Model<AbuseModel> { 190export class AbuseModel extends Model {
192 191
193 @AllowNull(false) 192 @AllowNull(false)
194 @Default(null) 193 @Default(null)
@@ -265,7 +264,7 @@ export class AbuseModel extends Model<AbuseModel> {
265 }) 264 })
266 VideoAbuse: VideoAbuseModel 265 VideoAbuse: VideoAbuseModel
267 266
268 static loadByIdWithReporter (id: number): Bluebird<MAbuseReporter> { 267 static loadByIdWithReporter (id: number): Promise<MAbuseReporter> {
269 const query = { 268 const query = {
270 where: { 269 where: {
271 id 270 id
@@ -281,7 +280,7 @@ export class AbuseModel extends Model<AbuseModel> {
281 return AbuseModel.findOne(query) 280 return AbuseModel.findOne(query)
282 } 281 }
283 282
284 static loadFull (id: number): Bluebird<MAbuseFull> { 283 static loadFull (id: number): Promise<MAbuseFull> {
285 const query = { 284 const query = {
286 where: { 285 where: {
287 id 286 id
diff --git a/server/models/abuse/video-abuse.ts b/server/models/abuse/video-abuse.ts
index d92bcf19f..90aa0695e 100644
--- a/server/models/abuse/video-abuse.ts
+++ b/server/models/abuse/video-abuse.ts
@@ -14,7 +14,7 @@ import { AbuseModel } from './abuse'
14 } 14 }
15 ] 15 ]
16}) 16})
17export class VideoAbuseModel extends Model<VideoAbuseModel> { 17export class VideoAbuseModel extends Model {
18 18
19 @CreatedAt 19 @CreatedAt
20 createdAt: Date 20 createdAt: Date
diff --git a/server/models/abuse/video-comment-abuse.ts b/server/models/abuse/video-comment-abuse.ts
index 8b34009b4..d3fce76a5 100644
--- a/server/models/abuse/video-comment-abuse.ts
+++ b/server/models/abuse/video-comment-abuse.ts
@@ -13,7 +13,7 @@ import { AbuseModel } from './abuse'
13 } 13 }
14 ] 14 ]
15}) 15})
16export class VideoCommentAbuseModel extends Model<VideoCommentAbuseModel> { 16export class VideoCommentAbuseModel extends Model {
17 17
18 @CreatedAt 18 @CreatedAt
19 createdAt: Date 19 createdAt: Date