+
+ @HasMany(() => ServerBlocklistModel, {
+ foreignKey: {
+ allowNull: false
+ },
+ onDelete: 'CASCADE'
+ })
+ BlockedByAccounts: ServerBlocklistModel[]
+
+ 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 ServerModel.findOne(query)
+ }
+
+ isBlocked () {
+ return this.BlockedByAccounts && this.BlockedByAccounts.length !== 0
+ }
+
+ toFormattedJSON (this: MServerFormattable) {
+ return {
+ host: this.host
+ }
+ }