2018-10-23 16:34:04 -05:00
|
|
|
import $ from 'cafy';
|
2021-08-19 07:55:45 -05:00
|
|
|
import define from '../../define';
|
|
|
|
import { convertLog } from '@/services/chart/core';
|
|
|
|
import { federationChart } from '@/services/chart/index';
|
2018-10-23 16:34:04 -05:00
|
|
|
|
|
|
|
export const meta = {
|
2019-02-22 20:20:58 -06:00
|
|
|
tags: ['charts'],
|
|
|
|
|
2018-10-23 16:34:04 -05:00
|
|
|
params: {
|
2018-11-01 13:32:24 -05:00
|
|
|
span: {
|
|
|
|
validator: $.str.or(['day', 'hour']),
|
|
|
|
},
|
2018-10-23 16:34:04 -05:00
|
|
|
|
2018-11-01 13:32:24 -05:00
|
|
|
limit: {
|
2019-02-13 01:33:07 -06:00
|
|
|
validator: $.optional.num.range(1, 500),
|
2018-10-23 16:34:04 -05:00
|
|
|
default: 30,
|
2018-11-01 13:32:24 -05:00
|
|
|
},
|
2020-03-06 10:04:36 -06:00
|
|
|
|
|
|
|
offset: {
|
2020-03-06 20:23:31 -06:00
|
|
|
validator: $.optional.nullable.num,
|
|
|
|
default: null,
|
2020-03-06 10:04:36 -06:00
|
|
|
},
|
2019-02-22 20:20:58 -06:00
|
|
|
},
|
|
|
|
|
2022-02-05 09:13:52 -06:00
|
|
|
// TODO: response definition
|
2022-01-18 07:27:10 -06:00
|
|
|
} as const;
|
2018-10-23 16:34:04 -05:00
|
|
|
|
2022-01-02 11:12:50 -06:00
|
|
|
// eslint-disable-next-line import/no-default-export
|
2019-02-21 20:46:58 -06:00
|
|
|
export default define(meta, async (ps) => {
|
2020-03-06 20:23:31 -06:00
|
|
|
return await federationChart.getChart(ps.span as any, ps.limit!, ps.offset ? new Date(ps.offset) : null);
|
2019-02-21 20:46:58 -06:00
|
|
|
});
|