initial commit

This commit is contained in:
Zoe
2026-01-11 05:04:29 -06:00
commit 0877cc10bd
65 changed files with 5009 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import { topics } from "~~/db/schema";
import { protectRoute } from "~~/server/utils/auth";
export default defineEventHandler(async (event) => {
await protectRoute(event);
const db = useDrizzle();
const body = await readBody(event);
const { agentId, name } = body;
if (!agentId || !name) {
throw createError({ statusCode: 400, statusMessage: 'Missing required fields' });
}
const [inserted] = await db.insert(topics).values({ userId: event.context.user.id, agentId, name }).returning();
return inserted;
});