Kevin CATHALY commited on
add an endpoint to api to get an assistant by id (#1020)
Browse files1234567891011121314151617import { collections } from "$lib/server/database";import { ObjectId } from "mongodb";
export async function GET({ params }) { const id = params.id; const assistantId = new ObjectId(id);
const assistant = await collections.assistants.findOne({ _id: assistantId, });
if (assistant) { return Response.json(assistant); } else { return Response.json({ message: "Assistant not found" }, { status: 404 }); }}src/routes/api/assistant/[id]/+server.tsAdded+17