Sharkey/packages/backend/src/server/api/endpoints/charts/users.ts

17 lines
508 B
TypeScript
Raw Normal View History

import { Injectable } from '@nestjs/common';
2022-09-18 03:27:08 +09:00
import { Endpoint } from '@/server/api/endpoint-base.js';
import UsersChart from '@/core/chart/charts/users.js';
2018-10-21 09:20:11 +09:00
2022-01-03 02:12:50 +09:00
// eslint-disable-next-line import/no-default-export
2022-09-18 03:27:08 +09:00
@Injectable()
2023-06-05 06:55:13 +00:00
export default class extends Endpoint<'charts/users'> {
name = 'charts/users' as const;
2022-09-18 03:27:08 +09:00
constructor(
private usersChart: UsersChart,
) {
2023-06-05 06:55:13 +00:00
super(async (ps, me) => {
2022-09-18 03:27:08 +09:00
return await this.usersChart.getChart(ps.span, ps.limit, ps.offset ? new Date(ps.offset) : null);
});
}
}