1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-25 20:18:18 +09:00
MisskeyIO/src/server/api/endpoints/charts/drive.ts
2021-06-08 14:09:32 +09:00

31 lines
643 B
TypeScript

import $ from 'cafy';
import define from '../../define';
import { convertLog } from '../../../../services/chart/core';
import { driveChart } from '../../../../services/chart';
export const meta = {
tags: ['charts', 'drive'],
params: {
span: {
validator: $.str.or(['day', 'hour']),
},
limit: {
validator: $.optional.num.range(1, 500),
default: 30,
},
offset: {
validator: $.optional.nullable.num,
default: null,
},
},
res: convertLog(driveChart.schema),
};
export default define(meta, async (ps) => {
return await driveChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null);
});