misskey/src/server/api/endpoints/charts/network.ts
syuilo b9cb6d1c10 refactor: refactoring imports
将来ESMに移行しやすいように
Related: #7658

なんかmochaが起動しなくなってるけど理由不明
すぐ直したい
2021-08-19 18:33:41 +09:00

31 lines
635 B
TypeScript

import $ from 'cafy';
import define from '../../define.js';
import { convertLog } from '@/services/chart/core.js';
import { networkChart } from '@/services/chart/index.js';
export const meta = {
tags: ['charts'],
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(networkChart.schema),
};
export default define(meta, async (ps) => {
return await networkChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null);
});