import { inject , injectable } from 'inversify' ; import * as apid from '../../../../api' ; import IRecordedDB , { FindAllOption } from '../../db/IRecordedDB' ; import IIPCClient from '../../ipc/IIPCClient' ; import IRecordedItemUtil from '../IRecordedItemUtil' ; import IRecordingApiModel from './IRecordingApiModel' ; @ injectable ( ) export default class RecordingApiModel implements IRecordingApiModel { private ipc : IIPCClient ; private recordedDB : IRecordedDB ; private recordedItemUtil : IRecordedItemUtil ; constructor ( @ inject ( 'IIPCClient' ) ipc , @ inject ( 'IRecordedDB' ) recordedDB , @ inject ( 'IRecordedItemUtil' ) recordedItemUtil ) { this . ipc = ipc ; this . recordedDB = recordedDB ; this . recordedItemUtil = recordedItemUtil ; } param option return public async gets ( option ) { ( < FindAllOption > option ) . isRecording = true ; const [ records , total ] = await this . recordedDB . findAll ( option , { isNeedVideoFiles : true , isNeedThumbnails : true , isNeedsDropLog : false , isNeedTags : false , } ) ; return { records : records . map ( r => { return this . recordedItemUtil . convertRecordedToRecordedItem ( r , option . isHalfWidth ) ; } ) , total , } ; } return public async resetTimer ( ) { await this . ipc . recording . resetTimer ( ) ; } }