X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fserver%2Fserver.ts;h=a5e05f460fffcfe90c8026321f6df023c513b121;hb=5e47f6ab984a7d00782e4c7030afffa1ba480add;hp=ef42de09063b0f5ed7bf9d511e7d7d01c4fe65cf;hpb=c3edc5b074aa4bb1861ed0a94d3713808e87170f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/server/server.ts b/server/models/server/server.ts index ef42de090..a5e05f460 100644 --- a/server/models/server/server.ts +++ b/server/models/server/server.ts @@ -4,7 +4,7 @@ import { MServer, MServerFormattable } from '@server/types/models/server' import { AttributesOnly } from '@shared/typescript-utils' import { isHostValid } from '../../helpers/custom-validators/servers' import { ActorModel } from '../actor/actor' -import { throwIfNotValid } from '../utils' +import { buildSQLAttributes, throwIfNotValid } from '../shared' import { ServerBlocklistModel } from './server-blocklist' @Table({ @@ -52,6 +52,18 @@ export class ServerModel extends Model>> { }) BlockedBy: ServerBlocklistModel[] + // --------------------------------------------------------------------------- + + static getSQLAttributes (tableName: string, aliasPrefix = '') { + return buildSQLAttributes({ + model: this, + tableName, + aliasPrefix + }) + } + + // --------------------------------------------------------------------------- + static load (id: number, transaction?: Transaction): Promise { const query = { where: {