diff options
Diffstat (limited to 'server/models/abuse')
-rw-r--r-- | server/models/abuse/abuse-message.ts | 6 | ||||
-rw-r--r-- | server/models/abuse/abuse.ts | 7 | ||||
-rw-r--r-- | server/models/abuse/video-abuse.ts | 2 | ||||
-rw-r--r-- | server/models/abuse/video-comment-abuse.ts | 2 |
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 @@ | |||
1 | import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' | 1 | import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' |
2 | import { isAbuseMessageValid } from '@server/helpers/custom-validators/abuses' | 2 | import { isAbuseMessageValid } from '@server/helpers/custom-validators/abuses' |
3 | import { MAbuseMessage, MAbuseMessageFormattable } from '@server/types/models' | ||
3 | import { AbuseMessage } from '@shared/models' | 4 | import { AbuseMessage } from '@shared/models' |
4 | import { AccountModel, ScopeNames as AccountScopeNames } from '../account/account' | 5 | import { AccountModel, ScopeNames as AccountScopeNames } from '../account/account' |
5 | import { throwIfNotValid, getSort } from '../utils' | 6 | import { getSort, throwIfNotValid } from '../utils' |
6 | import { AbuseModel } from './abuse' | 7 | import { AbuseModel } from './abuse' |
7 | import { 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 | }) |
20 | export class AbuseMessageModel extends Model<AbuseMessageModel> { | 20 | export 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 @@ | |||
1 | import * as Bluebird from 'bluebird' | ||
2 | import { invert } from 'lodash' | 1 | import { invert } from 'lodash' |
3 | import { literal, Op, QueryTypes } from 'sequelize' | 2 | import { literal, Op, QueryTypes } from 'sequelize' |
4 | import { | 3 | import { |
@@ -188,7 +187,7 @@ export enum ScopeNames { | |||
188 | } | 187 | } |
189 | ] | 188 | ] |
190 | }) | 189 | }) |
191 | export class AbuseModel extends Model<AbuseModel> { | 190 | export 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 | }) |
17 | export class VideoAbuseModel extends Model<VideoAbuseModel> { | 17 | export 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 | }) |
16 | export class VideoCommentAbuseModel extends Model<VideoCommentAbuseModel> { | 16 | export class VideoCommentAbuseModel extends Model { |
17 | 17 | ||
18 | @CreatedAt | 18 | @CreatedAt |
19 | createdAt: Date | 19 | createdAt: Date |