core/apps/webapp/app/routes/api.v1.conversation.$conversationId.read.tsx
Harshith Mullapudi ef320394d5 1. Feat: added ingestion floating status
2. OAuth for mcp
2025-07-15 22:02:41 +05:30

36 lines
911 B
TypeScript

import { json } from "@remix-run/node";
import { createActionApiRoute } from "~/services/routeBuilders/apiBuilder.server";
import { getWorkspaceByUser } from "~/models/workspace.server";
import { readConversation } from "~/services/conversation.server";
import { z } from "zod";
export const ConversationIdSchema = z.object({
conversationId: z.string(),
});
const { action, loader } = createActionApiRoute(
{
params: ConversationIdSchema,
allowJWT: true,
authorization: {
action: "oauth",
},
corsStrategy: "all",
},
async ({ authentication, params }) => {
const workspace = await getWorkspaceByUser(authentication.userId);
if (!workspace) {
throw new Error("No workspace found");
}
// Call the service to get the redirect URL
const read = await readConversation(params.conversationId);
return json(read);
},
);
export { action, loader };