Files
test/server/api/todos/index.get.ts
AlucardDev 7d4ff5962c
Some checks failed
ci / ci (22, ubuntu-latest) (push) Has been cancelled
first commit
2026-08-28 23:32:07 +03:00

12 lines
318 B
TypeScript

import { db, schema } from 'hub:db'
import { eq } from 'drizzle-orm'
export default eventHandler(async (event) => {
const { user } = await requireUserSession(event)
// List todos for the current user
const todos = await db.select().from(schema.todos).where(eq(schema.todos.userId, user.id))
return todos
})