continue scaffolding and refine the basic foundation
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import { agents } from "~~/db/schema";
|
||||
import { protectRoute } from "~~/server/utils/auth";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
await protectRoute(event);
|
||||
|
||||
const db = useDrizzle();
|
||||
const userId = event.context.user.id;
|
||||
|
||||
const rows = await db.select().from(agents);
|
||||
// Only return agents for the authenticated user
|
||||
const rows = await db.select().from(agents).where(eq(agents.userId, userId));
|
||||
return rows;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user