Gestion des heures de fin des tentatives

This commit is contained in:
2024-12-08 22:49:47 +01:00
parent 50a9f3369c
commit 33689d9c76
3 changed files with 17 additions and 6 deletions

View File

@ -37,7 +37,10 @@ export class GameService {
})
}
else {
run = game.currentRun
run = await this.prisma.playerRun.update({
where: { id: game.currentRunId },
data: { end: null },
})
}
return await this.prisma.game.update({
where: { id: 1 },
@ -66,6 +69,11 @@ export class GameService {
},
})
await this.prisma.playerRun.update({
where: { id: game.currentRunId },
data: { end: new Date() },
})
const newRunnerId = game.currentRun.runnerId == 1 ? 2 : 1
const firstRun = await this.prisma.playerRun.findFirst({ where: { runnerId: newRunnerId } }) !== null
const newRun = await this.prisma.playerRun.create({
@ -95,11 +103,13 @@ export class GameService {
const game = await this.find()
if (!game.started)
throw new ConflictException("La partie n'a pas encore démarré.")
await this.prisma.playerRun.update({
where: { id: game.currentRunId },
data: { end: new Date() },
})
return await this.prisma.game.update({
where: { id: 1 },
data: {
started: false,
},
data: { started: false },
})
}