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