import { isHostValid } from '../../helpers/custom-validators/servers'
import { ActorModel } from '../activitypub/actor'
import { throwIfNotValid } from '../utils'
-import { AccountBlocklistModel } from '../account/account-blocklist'
import { ServerBlocklistModel } from './server-blocklist'
+import * as Bluebird from 'bluebird'
+import { MServer, MServerFormattable } from '@server/typings/models/server'
@Table({
tableName: 'server',
})
BlockedByAccounts: ServerBlocklistModel[]
- static loadByHost (host: string) {
+ static load (id: number): Bluebird<MServer> {
+ const query = {
+ where: {
+ id
+ }
+ }
+
+ return ServerModel.findOne(query)
+ }
+
+ static loadByHost (host: string): Bluebird<MServer> {
const query = {
where: {
host
return this.BlockedByAccounts && this.BlockedByAccounts.length !== 0
}
- toFormattedJSON () {
+ toFormattedJSON (this: MServerFormattable) {
return {
host: this.host
}