Improve doc
This commit is contained in:
parent
d994c84901
commit
5db7b2e193
2 changed files with 42 additions and 27 deletions
|
@ -1,6 +1,7 @@
|
|||
import $ from 'cafy';
|
||||
import define from '../../define';
|
||||
import usersChart from '../../../../services/chart/users';
|
||||
import usersChart, { usersLogSchema } from '../../../../services/chart/users';
|
||||
import { convertLog } from '../../../../services/chart';
|
||||
|
||||
export const meta = {
|
||||
stability: 'stable',
|
||||
|
@ -28,12 +29,7 @@ export const meta = {
|
|||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
},
|
||||
},
|
||||
res: convertLog(usersLogSchema),
|
||||
};
|
||||
|
||||
export default define(meta, async (ps) => {
|
||||
|
|
|
@ -1,31 +1,50 @@
|
|||
import autobind from 'autobind-decorator';
|
||||
import Chart, { Obj } from './';
|
||||
import User, { IUser, isLocalUser } from '../../models/user';
|
||||
import { SchemaType } from '../../prelude/schema';
|
||||
|
||||
/**
|
||||
* ユーザーに関するチャート
|
||||
*/
|
||||
type UsersLog = {
|
||||
local: {
|
||||
const logSchema = {
|
||||
/**
|
||||
* 集計期間時点での、全ユーザー数
|
||||
*/
|
||||
total: number;
|
||||
total: {
|
||||
type: 'number' as 'number',
|
||||
description: '集計期間時点での、全ユーザー数'
|
||||
},
|
||||
|
||||
/**
|
||||
* 増加したユーザー数
|
||||
*/
|
||||
inc: number;
|
||||
inc: {
|
||||
type: 'number' as 'number',
|
||||
description: '増加したユーザー数'
|
||||
},
|
||||
|
||||
/**
|
||||
* 減少したユーザー数
|
||||
*/
|
||||
dec: number;
|
||||
};
|
||||
|
||||
remote: UsersLog['local'];
|
||||
dec: {
|
||||
type: 'number' as 'number',
|
||||
description: '減少したユーザー数'
|
||||
},
|
||||
};
|
||||
|
||||
export const usersLogSchema = {
|
||||
type: 'object' as 'object',
|
||||
properties: {
|
||||
local: {
|
||||
type: 'object' as 'object',
|
||||
properties: logSchema
|
||||
},
|
||||
remote: {
|
||||
type: 'object' as 'object',
|
||||
properties: logSchema
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
type UsersLog = SchemaType<typeof usersLogSchema>;
|
||||
|
||||
class UsersChart extends Chart<UsersLog> {
|
||||
constructor() {
|
||||
super('users');
|
||||
|
|
Loading…
Reference in a new issue