import { inject , injectable } from 'inversify' ; import * as path from 'path' ; import * as apid from '../../../../api' ; import IThumbnailDB from '../../db/IThumbnailDB' ; import IConfigFile from '../../IConfigFile' ; import IConfiguration from '../../IConfiguration' ; import IIPCClient from '../../ipc/IIPCClient' ; import IThumbnailApiModel from './IThumbnailApiModel' ; @ injectable ( ) export default class ThumbnailApiModel implements IThumbnailApiModel { private ipc : IIPCClient ; private thumbnailDB : IThumbnailDB ; private config : IConfigFile ; constructor ( @ inject ( 'IIPCClient' ) ipc , @ inject ( 'IThumbnailDB' ) thumbnailDB , @ inject ( 'IConfiguration' ) configuration ) { this . ipc = ipc ; this . thumbnailDB = thumbnailDB ; this . config = configuration . getConfig ( ) ; } param thumbnailId return public async getIdFilePath ( thumbnailId ) { const thumbnail = await this . thumbnailDB . findId ( thumbnailId ) ; if ( thumbnail === null ) { return null ; } return path . join ( this . config . thumbnail , thumbnail . filePath ) ; } return public regenerate ( ) { return this . ipc . thumbnail . regenerate ( ) ; } /**
     * ファイルのクリーンアップ
     */ public async fileCleanup ( ) { await this . ipc . thumbnail . fileCleanup ( ) ; } param videoFileId return public async add ( videoFileId ) { await this . ipc . thumbnail . add ( videoFileId ) ; } param thumbnailId return public async delete ( thumbnailId ) { await this . ipc . thumbnail . delete ( thumbnailId ) ; } }