core/apps/webapp/app/routes/api.v1.episodes.$episodeId.facts.tsx
Harshith Mullapudi 1fa7fd93d5
Feat: spaces (#51)
* feat: Episode ingestion update
Benchmarking CORE

* Feat: Spaces in knowledge graph

* fix: remove daily assignment

* Feat: add spaces

* Feat: spaces

---------

Co-authored-by: Manoj K <saimanoj58@gmail.com>
2025-08-21 11:53:45 +05:30

29 lines
781 B
TypeScript

import { type LoaderFunctionArgs, json } from "@remix-run/node";
import { getEpisodeFacts } from "~/services/episodeFacts.server";
import { requireUser } from "~/services/session.server";
export async function loader({ request, params }: LoaderFunctionArgs) {
try {
const user = await requireUser(request);
const { episodeId } = params;
if (!episodeId) {
return json(
{ success: false, error: "Episode ID is required" },
{ status: 400 },
);
}
const result = await getEpisodeFacts(episodeId, user.id);
return json(result);
} catch (error) {
console.error("Error in episodes facts API:", error);
return json(
{ success: false, error: "Internal server error", facts: [] },
{ status: 500 },
);
}
}