This commit is contained in:
11
server/api/todos/index.get.ts
Normal file
11
server/api/todos/index.get.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
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
|
||||
})
|
||||
Reference in New Issue
Block a user