Added unit and api tests
This commit is contained in:
parent
9f4204cc73
commit
fedf1eb4c5
34 changed files with 9205 additions and 20 deletions
3
backend/dist/routes/games.js
vendored
3
backend/dist/routes/games.js
vendored
|
|
@ -171,6 +171,9 @@ router.delete('/:id', auth_1.authenticate, async (req, res) => {
|
|||
if (game.gameMasterId !== req.user.id) {
|
||||
return res.status(403).json({ error: 'Not authorized' });
|
||||
}
|
||||
if (game.status !== 'DRAFT') {
|
||||
return res.status(400).json({ error: 'Only draft games can be deleted' });
|
||||
}
|
||||
await index_1.prisma.game.delete({ where: { id } });
|
||||
res.json({ message: 'Game deleted' });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue