feat: read by user
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s

This commit is contained in:
Methapon2001 2025-03-05 10:49:08 +07:00
parent ae252acbb8
commit 34af1f9dcd

View file

@ -67,7 +67,14 @@ export class NotificationController extends Controller {
@Get("{notificationId}")
@Security("keycloak")
async getNotification(@Request() req: RequestWithUser, @Path() notificationId: string) {
const record = await prisma.notification.findFirst({ where: { id: notificationId } });
const record = await prisma.notification.update({
where: { id: notificationId },
data: {
readByUser: {
connect: { id: req.user.sub },
},
},
});
if (!record) throw notFoundError("Notification");