This commit is contained in:
Carl-Gerhard Lindesvärd
2025-12-14 11:01:26 +01:00
parent dad9baa581
commit bc84404235
35 changed files with 3172 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
import * as controller from '@/controllers/misc.controller';
import { insightsQueue } from '@openpanel/queue';
import type { FastifyPluginCallback } from 'fastify';
const miscRouter: FastifyPluginCallback = async (fastify) => {
@@ -43,6 +44,27 @@ const miscRouter: FastifyPluginCallback = async (fastify) => {
url: '/geo',
handler: controller.getGeo,
});
fastify.route({
method: 'GET',
url: '/insights/test',
handler: async (req, reply) => {
const projectId = req.query.projectId as string;
const job = await insightsQueue.add(
'insightsProject',
{
type: 'insightsProject',
payload: {
projectId: projectId,
date: new Date().toISOString().slice(0, 10),
},
},
{ jobId: `manual:${Date.now()}:${projectId}` },
);
return { jobId: job.id };
},
});
};
export default miscRouter;