Improve doc

This commit is contained in:
syuilo 2019-02-24 10:00:24 +09:00
parent b679163d01
commit a55d5516a6
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
2 changed files with 63 additions and 39 deletions

View File

@ -1,6 +1,7 @@
import $ from 'cafy'; import $ from 'cafy';
import define from '../../define'; import define from '../../define';
import driveChart from '../../../../services/chart/drive'; import driveChart, { driveLogSchema } from '../../../../services/chart/drive';
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(driveLogSchema),
type: 'array',
items: {
type: 'object',
},
},
}; };
export default define(meta, async (ps) => { export default define(meta, async (ps) => {

View File

@ -2,46 +2,74 @@ import autobind from 'autobind-decorator';
import Chart, { Obj } from './'; import Chart, { Obj } from './';
import DriveFile, { IDriveFile } from '../../models/drive-file'; import DriveFile, { IDriveFile } from '../../models/drive-file';
import { isLocalUser } from '../../models/user'; import { isLocalUser } from '../../models/user';
import { SchemaType } from '../../prelude/schema';
/** const logSchema = {
*
*/
type DriveLog = {
local: {
/** /**
* *
*/ */
totalCount: number; totalCount: {
type: 'number' as 'number',
description: '集計期間時点での、全ドライブファイル数'
},
/** /**
* *
*/ */
totalSize: number; totalSize: {
type: 'number' as 'number',
description: '集計期間時点での、全ドライブファイルの合計サイズ'
},
/** /**
* *
*/ */
incCount: number; incCount: {
type: 'number' as 'number',
description: '増加したドライブファイル数'
},
/** /**
* 使 * 使
*/ */
incSize: number; incSize: {
type: 'number' as 'number',
description: '増加したドライブ使用量'
},
/** /**
* *
*/ */
decCount: number; decCount: {
type: 'number' as 'number',
description: '減少したドライブファイル数'
},
/** /**
* 使 * 使
*/ */
decSize: number; decSize: {
}; type: 'number' as 'number',
description: '減少したドライブ使用量'
remote: DriveLog['local']; },
}; };
export const driveLogSchema = {
type: 'object' as 'object',
properties: {
local: {
type: 'object' as 'object',
properties: logSchema
},
remote: {
type: 'object' as 'object',
properties: logSchema
},
}
};
type DriveLog = SchemaType<typeof driveLogSchema>;
class DriveChart extends Chart<DriveLog> { class DriveChart extends Chart<DriveLog> {
constructor() { constructor() {
super('drive'); super('drive');