fcfb5ef0a3
* wip
* ✌️
* use ajv/dist/core
* revert try
* clean up
28 lines
573 B
TypeScript
28 lines
573 B
TypeScript
import { USER_ONLINE_THRESHOLD } from '@/const';
|
|
import { Users } from '@/models/index';
|
|
import { MoreThan } from 'typeorm';
|
|
import define from '../define';
|
|
|
|
export const meta = {
|
|
tags: ['meta'],
|
|
|
|
requireCredential: false,
|
|
} as const;
|
|
|
|
export const paramDef = {
|
|
type: 'object',
|
|
properties: {},
|
|
required: [],
|
|
} as const;
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
|
export default define(meta, paramDef, async () => {
|
|
const count = await Users.count({
|
|
lastActiveDate: MoreThan(new Date(Date.now() - USER_ONLINE_THRESHOLD)),
|
|
});
|
|
|
|
return {
|
|
count,
|
|
};
|
|
});
|