core/apps/webapp/app/routes/api.v1.add.tsx
Harshith Mullapudi d11cc5dc93 Fix: UI components
2025-07-18 16:57:08 +05:30

23 lines
592 B
TypeScript

import { json } from "@remix-run/node";
import { createActionApiRoute } from "~/services/routeBuilders/apiBuilder.server";
import { addToQueue } from "~/lib/ingest.server";
import { IngestBodyRequest } from "~/trigger/ingest/ingest";
const { action, loader } = createActionApiRoute(
{
body: IngestBodyRequest,
allowJWT: true,
authorization: {
action: "ingest",
},
corsStrategy: "all",
},
async ({ body, authentication }) => {
const response = addToQueue(body, authentication.userId);
return json({ ...response });
},
);
export { action, loader };