X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fthumbnail.ts;h=f33bd31799b302a904591cb2fdcfb7d4cbcae1f6;hb=0c9668f77901e7540e2c7045eb0f2974a4842a69;hp=319e1175ae4da4cddca45fb119dfc6c8688f825c;hpb=d9a2a03196275065c28f4a0b7d4d7bc9992d77a1;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/thumbnail.ts b/server/models/video/thumbnail.ts index 319e1175a..f33bd3179 100644 --- a/server/models/video/thumbnail.ts +++ b/server/models/video/thumbnail.ts @@ -16,7 +16,8 @@ import { UpdatedAt } from 'sequelize-typescript' import { afterCommitIfTransaction } from '@server/helpers/database-utils' -import { MThumbnail, MThumbnailVideo, MVideoWithHost } from '@server/types/models' +import { MThumbnail, MThumbnailVideo, MVideo } from '@server/types/models' +import { AttributesOnly } from '@shared/typescript-utils' import { ThumbnailType } from '../../../shared/models/videos/thumbnail.type' import { logger } from '../../helpers/logger' import { CONFIG } from '../../initializers/config' @@ -40,7 +41,7 @@ import { VideoPlaylistModel } from './video-playlist' } ] }) -export class ThumbnailModel extends Model { +export class ThumbnailModel extends Model>> { @AllowNull(false) @Column @@ -126,7 +127,7 @@ export class ThumbnailModel extends Model { // Don't block the transaction instance.removeThumbnail() - .catch(err => logger.error('Cannot remove thumbnail file %s.', instance.filename, err)) + .catch(err => logger.error('Cannot remove thumbnail file %s.', instance.filename, { err })) } static loadByFilename (filename: string, thumbnailType: ThumbnailType): Promise { @@ -163,7 +164,7 @@ export class ThumbnailModel extends Model { return join(directory, filename) } - getFileUrl (video: MVideoWithHost) { + getFileUrl (video: MVideo) { const staticPath = ThumbnailModel.types[this.type].staticPath + this.filename if (video.isOwned()) return WEBSERVER.URL + staticPath