kaneo (minimalist kanban) fork to experiment adding a tangled integration
github.com/usekaneo/kaneo
1import { and, eq } from "drizzle-orm";
2import { HTTPException } from "hono/http-exception";
3import db from "../../database";
4import { notificationTable } from "../../database/schema";
5
6async function markNotificationAsRead(id: string, userId: string) {
7 const [notification] = await db
8 .update(notificationTable)
9 .set({ isRead: true })
10 .where(
11 and(eq(notificationTable.id, id), eq(notificationTable.userId, userId)),
12 )
13 .returning();
14
15 if (!notification) {
16 throw new HTTPException(404, {
17 message: "Notification not found",
18 });
19 }
20
21 return notification;
22}
23
24export default markNotificationAsRead;