X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Factor%2Factor-image.ts;h=9c34a0101acf46c778f548933f7ed924d756d5a0;hb=5e47f6ab984a7d00782e4c7030afffa1ba480add;hp=f74ab735e31717d5e0a9f04069a487376fb4bf04;hpb=ab4b8974997777373a6032073f9c1aaf33ba9931;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/actor/actor-image.ts b/server/models/actor/actor-image.ts index f74ab735e..9c34a0101 100644 --- a/server/models/actor/actor-image.ts +++ b/server/models/actor/actor-image.ts @@ -22,7 +22,7 @@ import { isActivityPubUrlValid } from '../../helpers/custom-validators/activityp import { logger } from '../../helpers/logger' import { CONFIG } from '../../initializers/config' import { LAZY_STATIC_PATHS, MIMETYPES, WEBSERVER } from '../../initializers/constants' -import { throwIfNotValid } from '../utils' +import { buildSQLAttributes, throwIfNotValid } from '../shared' import { ActorModel } from './actor' @Table({ @@ -91,9 +91,21 @@ export class ActorImageModel extends Model logger.error('Cannot remove actor image file %s.', instance.filename, err)) + .catch(err => logger.error('Cannot remove actor image file %s.', instance.filename, { err })) } + // --------------------------------------------------------------------------- + + static getSQLAttributes (tableName: string, aliasPrefix = '') { + return buildSQLAttributes({ + model: this, + tableName, + aliasPrefix + }) + } + + // --------------------------------------------------------------------------- + static loadByName (filename: string) { const query = { where: { @@ -138,6 +150,9 @@ export class ActorImageModel extends Model