feat: read by user
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
This commit is contained in:
parent
ae252acbb8
commit
34af1f9dcd
1 changed files with 8 additions and 1 deletions
|
|
@ -67,7 +67,14 @@ export class NotificationController extends Controller {
|
||||||
@Get("{notificationId}")
|
@Get("{notificationId}")
|
||||||
@Security("keycloak")
|
@Security("keycloak")
|
||||||
async getNotification(@Request() req: RequestWithUser, @Path() notificationId: string) {
|
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");
|
if (!record) throw notFoundError("Notification");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue