1 import { AllowNull, Column, CreatedAt, Default, HasMany, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
2 import { isHostValid } from '../../helpers/custom-validators/servers'
3 import { ActorModel } from '../activitypub/actor'
4 import { throwIfNotValid } from '../utils'
5 import { AccountBlocklistModel } from '../account/account-blocklist'
6 import { ServerBlocklistModel } from './server-blocklist'
17 export class ServerModel extends Model<ServerModel> {
20 @Is('Host', value => throwIfNotValid(value, isHostValid, 'valid host'))
27 redundancyAllowed: boolean
35 @HasMany(() => ActorModel, {
45 @HasMany(() => ServerBlocklistModel, {
51 BlockedByAccounts: ServerBlocklistModel[]
53 static loadByHost (host: string) {
60 return ServerModel.findOne(query)
64 return this.BlockedByAccounts && this.BlockedByAccounts.length !== 0