Spaces:
Running
Running
File size: 421 Bytes
c2f5b76 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import { 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 });
}
}
|