feat(UserMatch): Logique des matchs et notifications

Affichage d'un modal lorsqu'une notification de match n'est pas consulté
This commit is contained in:
Laurian-Dufrechou
2023-05-16 00:59:05 +02:00
parent 9b4676f769
commit dbb60bd9f1
9 changed files with 4045 additions and 3801 deletions
+30
View File
@@ -0,0 +1,30 @@
const { PrismaClient } = require("@prisma/client");
const patch = async (req: any, res: any) => {
const prisma = new PrismaClient();
const { notificationId } = req.body;
try {
const notification = await prisma.notification.update({
where: {
id: notificationId,
},
data: {
hasBeenConsulted: true,
},
});
res.status(200).json(notification);
} catch (error) {
res.status(400).json({ message: "Something went wrong" });
} finally {
await prisma.$disconnect();
}
};
export default (req: any, res: any) => {
req.method === "PATCH"
? patch(req, res)
: res.status(404).send({ message: "Wrong method, please use POST" });
};