forked from BRETT/BRETT
12 lines
359 B
TypeScript
12 lines
359 B
TypeScript
import { and, eq } from 'drizzle-orm'
|
|
import { notifications } from '../../db/schema'
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const user = await requireUser(event)
|
|
await useDb()
|
|
.update(notifications)
|
|
.set({ isRead: true })
|
|
.where(and(eq(notifications.userId, user.id), eq(notifications.isRead, false)))
|
|
return { ok: true }
|
|
})
|