yumechi-no-kuni/src/models/stats.ts

234 lines
3.9 KiB
TypeScript
Raw Normal View History

2018-08-18 06:22:56 -05:00
import * as mongo from 'mongodb';
import db from '../db/mongodb';
2018-08-18 10:27:23 -05:00
const Stats = db.get<IStats>('stats');
2018-09-01 05:12:07 -05:00
// 後方互換性のため
Stats.dropIndex({ date: -1 } as any).catch((e: mongo.MongoError) => {
if (e.code !== 27) throw e;
});
2018-08-26 14:50:52 -05:00
Stats.createIndex({ span: -1, date: -1 }, { unique: true });
2018-08-18 10:27:23 -05:00
export default Stats;
2018-08-18 06:22:56 -05:00
2018-08-18 10:27:23 -05:00
export interface IStats {
2018-08-18 06:22:56 -05:00
_id: mongo.ObjectID;
2018-08-24 18:35:41 -05:00
/**
*
*/
2018-08-18 06:22:56 -05:00
date: Date;
2018-08-24 18:35:41 -05:00
/**
*
*/
2018-08-23 01:40:24 -05:00
span: 'day' | 'hour';
2018-08-18 09:48:54 -05:00
/**
*
*/
2018-08-18 06:22:56 -05:00
users: {
local: {
/**
2018-08-24 18:35:41 -05:00
* ()
2018-08-18 06:22:56 -05:00
*/
total: number;
/**
2018-08-24 18:35:41 -05:00
* ()
*/
inc: number;
/**
* ()
2018-08-18 06:22:56 -05:00
*/
2018-08-24 18:35:41 -05:00
dec: number;
2018-08-18 06:22:56 -05:00
};
remote: {
/**
2018-08-24 18:35:41 -05:00
* ()
2018-08-18 06:22:56 -05:00
*/
total: number;
/**
2018-08-24 18:35:41 -05:00
* ()
2018-08-18 06:22:56 -05:00
*/
2018-08-24 18:35:41 -05:00
inc: number;
/**
* ()
*/
dec: number;
2018-08-18 06:22:56 -05:00
};
};
2018-08-18 09:48:54 -05:00
/**
* 稿
*/
2018-08-18 06:22:56 -05:00
notes: {
local: {
/**
2018-08-24 18:35:41 -05:00
* 稿 ()
2018-08-18 06:22:56 -05:00
*/
total: number;
2018-08-18 09:23:55 -05:00
/**
2018-08-24 18:35:41 -05:00
* 稿 ()
2018-08-18 09:23:55 -05:00
*/
2018-08-24 18:35:41 -05:00
inc: number;
/**
* 稿 ()
*/
dec: number;
2018-08-18 09:23:55 -05:00
2018-08-18 06:22:56 -05:00
diffs: {
/**
2018-08-24 18:35:41 -05:00
* 稿 ()
2018-08-18 06:22:56 -05:00
*/
normal: number;
/**
2018-08-24 18:35:41 -05:00
* 稿 ()
2018-08-18 06:22:56 -05:00
*/
reply: number;
/**
2018-08-24 18:35:41 -05:00
* Renoteの投稿数の差分 ()
2018-08-18 06:22:56 -05:00
*/
renote: number;
};
};
remote: {
/**
2018-08-24 18:35:41 -05:00
* 稿 ()
2018-08-18 06:22:56 -05:00
*/
total: number;
2018-08-18 09:23:55 -05:00
/**
2018-08-24 18:35:41 -05:00
* 稿 ()
*/
inc: number;
/**
* 稿 ()
2018-08-18 09:23:55 -05:00
*/
2018-08-24 18:35:41 -05:00
dec: number;
2018-08-18 09:23:55 -05:00
2018-08-18 06:22:56 -05:00
diffs: {
/**
2018-08-24 18:35:41 -05:00
* 稿 ()
2018-08-18 06:22:56 -05:00
*/
normal: number;
/**
2018-08-24 18:35:41 -05:00
* 稿 ()
2018-08-18 06:22:56 -05:00
*/
reply: number;
/**
2018-08-24 18:35:41 -05:00
* Renoteの投稿数の差分 ()
2018-08-18 06:22:56 -05:00
*/
renote: number;
};
};
};
2018-08-18 09:48:54 -05:00
/**
* ()
*/
drive: {
local: {
/**
2018-08-24 18:35:41 -05:00
* ()
2018-08-18 09:48:54 -05:00
*/
totalCount: number;
/**
2018-08-24 18:35:41 -05:00
* ()
2018-08-18 09:48:54 -05:00
*/
totalSize: number;
/**
2018-08-24 18:35:41 -05:00
* ()
*/
incCount: number;
/**
* 使 ()
*/
incSize: number;
/**
* ()
2018-08-18 09:48:54 -05:00
*/
2018-08-24 18:35:41 -05:00
decCount: number;
2018-08-18 09:48:54 -05:00
/**
2018-08-24 18:35:41 -05:00
* 使 ()
2018-08-18 09:48:54 -05:00
*/
2018-08-24 18:35:41 -05:00
decSize: number;
2018-08-18 09:48:54 -05:00
};
remote: {
/**
2018-08-24 18:35:41 -05:00
* ()
2018-08-18 09:48:54 -05:00
*/
totalCount: number;
/**
2018-08-24 18:35:41 -05:00
* ()
2018-08-18 09:48:54 -05:00
*/
totalSize: number;
/**
2018-08-24 18:35:41 -05:00
* ()
*/
incCount: number;
/**
* 使 ()
*/
incSize: number;
/**
* ()
2018-08-18 09:48:54 -05:00
*/
2018-08-24 18:35:41 -05:00
decCount: number;
2018-08-18 09:48:54 -05:00
/**
2018-08-24 18:35:41 -05:00
* 使 ()
2018-08-18 09:48:54 -05:00
*/
2018-08-24 18:35:41 -05:00
decSize: number;
2018-08-18 09:48:54 -05:00
};
};
2018-09-14 15:40:58 -05:00
/**
*
*/
network: {
/**
*
*/
requests: number;
/**
*
* TIP: (totalTime / requests)
*/
totalTime: number;
/**
*
*/
incomingBytes: number;
/**
*
*/
outgoingBytes: number;
};
2018-08-18 06:22:56 -05:00
}