diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-02-08 04:31:33 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-02-08 04:31:33 +0900 |
| commit | aba85b977dfc868c1a65ce06ed58ea59d0371f7f (patch) | |
| tree | 5e27a5397bb3ee93ae1790ed2f92c6264ae86956 /src/chart/active-users.ts | |
| parent | Implement instance blocking (#4182) (diff) | |
| download | sharkey-aba85b977dfc868c1a65ce06ed58ea59d0371f7f.tar.gz sharkey-aba85b977dfc868c1a65ce06ed58ea59d0371f7f.tar.bz2 sharkey-aba85b977dfc868c1a65ce06ed58ea59d0371f7f.zip | |
Refactoring: Move chart dir into services dir
Diffstat (limited to 'src/chart/active-users.ts')
| -rw-r--r-- | src/chart/active-users.ts | 48 |
1 files changed, 0 insertions, 48 deletions
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<ActiveUsersLog> { - constructor() { - super('activeUsers'); - } - - @autobind - protected async getTemplate(init: boolean, latest?: ActiveUsersLog): Promise<ActiveUsersLog> { - 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(); |