1
0
forked from mirror/misskey
misskey/packages/backend/src/server/api/endpoints/charts/notes.ts
2022-01-03 02:12:50 +09:00

32 lines
682 B
TypeScript

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