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'
@Table({
tableName: 'server',
})
Actors: ActorModel[]
+ @HasMany(() => ServerBlocklistModel, {
+ foreignKey: {
+ allowNull: false
+ },
+ onDelete: 'CASCADE'
+ })
+ BlockedByAccounts: ServerBlocklistModel[]
+
static loadByHost (host: string) {
const query = {
where: {
return ServerModel.findOne(query)
}
+ isBlocked () {
+ return this.BlockedByAccounts && this.BlockedByAccounts.length !== 0
+ }
+
toFormattedJSON () {
return {
host: this.host