diff options
Diffstat (limited to 'server/models/server/server.ts')
-rw-r--r-- | server/models/server/server.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/server/models/server/server.ts b/server/models/server/server.ts index 771200797..0e58beeaf 100644 --- a/server/models/server/server.ts +++ b/server/models/server/server.ts | |||
@@ -1,10 +1,9 @@ | |||
1 | import { AllowNull, Column, CreatedAt, Default, HasMany, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' | 1 | import { AllowNull, Column, CreatedAt, Default, HasMany, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' |
2 | import { MServer, MServerFormattable } from '@server/types/models/server' | ||
2 | import { isHostValid } from '../../helpers/custom-validators/servers' | 3 | import { isHostValid } from '../../helpers/custom-validators/servers' |
3 | import { ActorModel } from '../activitypub/actor' | 4 | import { ActorModel } from '../activitypub/actor' |
4 | import { throwIfNotValid } from '../utils' | 5 | import { throwIfNotValid } from '../utils' |
5 | import { ServerBlocklistModel } from './server-blocklist' | 6 | import { ServerBlocklistModel } from './server-blocklist' |
6 | import * as Bluebird from 'bluebird' | ||
7 | import { MServer, MServerFormattable } from '@server/types/models/server' | ||
8 | 7 | ||
9 | @Table({ | 8 | @Table({ |
10 | tableName: 'server', | 9 | tableName: 'server', |
@@ -15,7 +14,7 @@ import { MServer, MServerFormattable } from '@server/types/models/server' | |||
15 | } | 14 | } |
16 | ] | 15 | ] |
17 | }) | 16 | }) |
18 | export class ServerModel extends Model<ServerModel> { | 17 | export class ServerModel extends Model { |
19 | 18 | ||
20 | @AllowNull(false) | 19 | @AllowNull(false) |
21 | @Is('Host', value => throwIfNotValid(value, isHostValid, 'valid host')) | 20 | @Is('Host', value => throwIfNotValid(value, isHostValid, 'valid host')) |
@@ -51,7 +50,7 @@ export class ServerModel extends Model<ServerModel> { | |||
51 | }) | 50 | }) |
52 | BlockedByAccounts: ServerBlocklistModel[] | 51 | BlockedByAccounts: ServerBlocklistModel[] |
53 | 52 | ||
54 | static load (id: number): Bluebird<MServer> { | 53 | static load (id: number): Promise<MServer> { |
55 | const query = { | 54 | const query = { |
56 | where: { | 55 | where: { |
57 | id | 56 | id |
@@ -61,7 +60,7 @@ export class ServerModel extends Model<ServerModel> { | |||
61 | return ServerModel.findOne(query) | 60 | return ServerModel.findOne(query) |
62 | } | 61 | } |
63 | 62 | ||
64 | static loadByHost (host: string): Bluebird<MServer> { | 63 | static loadByHost (host: string): Promise<MServer> { |
65 | const query = { | 64 | const query = { |
66 | where: { | 65 | where: { |
67 | host | 66 | host |