feat: queue len show

This commit is contained in:
archer
2023-08-14 11:39:42 +08:00
parent 4952a48c52
commit bb7596c3d5
7 changed files with 57 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import { jsonRes } from '@/service/response';
import { TrainingData } from '@/service/mongo';
import { authUser } from '@/service/utils/auth';
/* 拆分数据成QA */
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
await authUser({ req, authToken: true });
// split queue data
const result = await TrainingData.countDocuments({
lockTime: { $lt: new Date('2040/1/1') }
});
jsonRes(res, {
data: result
});
} catch (err) {
jsonRes(res, {
code: 500,
error: err
});
}
}