changement

This commit is contained in:
Emma781227
2026-07-23 13:45:53 +02:00
parent 7f816c165b
commit 902e304a5e
8 changed files with 131 additions and 4 deletions

View File

@@ -1,10 +1,18 @@
const prisma = require("../config/prisma");
const { getGameWindow, expireOverdueClaims } = require("../utils/gameWindow");
const participate = async (req, res) => {
try {
const { code } = req.body;
const userId = req.user.id;
const gameWindow = await getGameWindow();
if (!gameWindow.isOpen) {
return res.status(410).json({
message: "Le jeu-concours est terminé. Vous ne pouvez plus tester de code ni réclamer de lot.",
});
}
const ticket = await prisma.ticket.findUnique({
where: { code },
include: {
@@ -83,6 +91,8 @@ const myGains = async (req, res) => {
try {
const userId = req.user.id;
await expireOverdueClaims();
const participations = await prisma.participation.findMany({
where: { userId },
include: {