Updated the styles to use Pico-css
This commit is contained in:
parent
d32233a20a
commit
9acde36f50
18 changed files with 691 additions and 2126 deletions
|
|
@ -119,6 +119,7 @@ enum GameStatus {
|
|||
DRAFT
|
||||
LIVE
|
||||
ENDED
|
||||
ARCHIVED
|
||||
}
|
||||
|
||||
enum TeamStatus {
|
||||
|
|
|
|||
|
|
@ -251,6 +251,56 @@ router.post('/:id/end', authenticate, async (req: AuthRequest, res: Response) =>
|
|||
}
|
||||
});
|
||||
|
||||
router.post('/:id/archive', authenticate, async (req: AuthRequest, res: Response) => {
|
||||
try {
|
||||
const id = req.params.id as string;
|
||||
|
||||
const game = await prisma.game.findUnique({ where: { id } });
|
||||
if (!game) {
|
||||
return res.status(404).json({ error: 'Game not found' });
|
||||
}
|
||||
|
||||
if (game.gameMasterId !== req.user!.id) {
|
||||
return res.status(403).json({ error: 'Not authorized' });
|
||||
}
|
||||
|
||||
const updated = await prisma.game.update({
|
||||
where: { id },
|
||||
data: { status: 'ARCHIVED' }
|
||||
});
|
||||
|
||||
res.json(updated);
|
||||
} catch (error) {
|
||||
console.error('Archive game error:', error);
|
||||
res.status(500).json({ error: 'Failed to archive game' });
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/:id/unarchive', authenticate, async (req: AuthRequest, res: Response) => {
|
||||
try {
|
||||
const id = req.params.id as string;
|
||||
|
||||
const game = await prisma.game.findUnique({ where: { id } });
|
||||
if (!game) {
|
||||
return res.status(404).json({ error: 'Game not found' });
|
||||
}
|
||||
|
||||
if (game.gameMasterId !== req.user!.id) {
|
||||
return res.status(403).json({ error: 'Not authorized' });
|
||||
}
|
||||
|
||||
const updated = await prisma.game.update({
|
||||
where: { id },
|
||||
data: { status: 'ENDED' }
|
||||
});
|
||||
|
||||
res.json(updated);
|
||||
} catch (error) {
|
||||
console.error('Unarchive game error:', error);
|
||||
res.status(500).json({ error: 'Failed to unarchive game' });
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/:id/invite', async (req: AuthRequest, res: Response) => {
|
||||
try {
|
||||
const id = req.params.id as string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue