From aba85b977dfc868c1a65ce06ed58ea59d0371f7f Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 8 Feb 2019 04:31:33 +0900 Subject: Refactoring: Move chart dir into services dir --- src/chart/active-users.ts | 48 ----------------------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 src/chart/active-users.ts (limited to 'src/chart/active-users.ts') diff --git a/src/chart/active-users.ts b/src/chart/active-users.ts deleted file mode 100644 index 06d9b8aa90..0000000000 --- a/src/chart/active-users.ts +++ /dev/null @@ -1,48 +0,0 @@ -import autobind from 'autobind-decorator'; -import Chart, { Obj } from '.'; -import { IUser, isLocalUser } from '../models/user'; - -/** - * アクティブユーザーに関するチャート - */ -type ActiveUsersLog = { - local: { - /** - * アクティブユーザー数 - */ - count: number; - }; - - remote: ActiveUsersLog['local']; -}; - -class ActiveUsersChart extends Chart { - constructor() { - super('activeUsers'); - } - - @autobind - protected async getTemplate(init: boolean, latest?: ActiveUsersLog): Promise { - return { - local: { - count: 0 - }, - remote: { - count: 0 - } - }; - } - - @autobind - public async update(user: IUser) { - const update: Obj = { - count: 1 - }; - - await this.incIfUnique({ - [isLocalUser(user) ? 'local' : 'remote']: update - }, 'users', user._id.toHexString()); - } -} - -export default new ActiveUsersChart(); -- cgit v1.2.3-freya