import autobind from 'autobind-decorator'; import Chart, { KVs } from '../core'; import { DriveFiles } from '@/models/index'; import { Not, IsNull } from 'typeorm'; import { DriveFile } from '@/models/entities/drive-file'; import { name, schema } from './entities/drive'; /** * ドライブに関するチャート */ // eslint-disable-next-line import/no-default-export export default class DriveChart extends Chart { constructor() { super(name, schema); } @autobind protected async tickMajor(): Promise>> { return {}; } @autobind protected async tickMinor(): Promise>> { return {}; } @autobind public async update(file: DriveFile, isAdditional: boolean): Promise { const fileSizeKb = file.size / 1000; await this.commit(file.userHost === null ? { 'local.incCount': isAdditional ? 1 : 0, 'local.incSize': isAdditional ? fileSizeKb : 0, 'local.decCount': isAdditional ? 0 : 1, 'local.decSize': isAdditional ? 0 : fileSizeKb, } : { 'remote.incCount': isAdditional ? 1 : 0, 'remote.incSize': isAdditional ? fileSizeKb : 0, 'remote.decCount': isAdditional ? 0 : 1, 'remote.decSize': isAdditional ? 0 : fileSizeKb, }); } }