Added shome shit to invert who is home and away.

This commit is contained in:
didier committed 2025-05-28 14:23:38 -04:00
1 parent 3bc18baa30
commit 514bb0ac47
3 files changed
+40

No files matched your search

+19
View File
@@ -187,6 +187,25 @@ memberRouter.post("/games/:gameId", async (ctx) => {
: `<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>`;
});
memberRouter.post("/games/:gameId/switch", async (ctx) => {
if (!(await loginService.isLoggedIn(ctx))) {
ctx.response.redirect("/membre");
return;
}
const success = await gameService.switchVisitors(ctx.params.gameId);
if (!success) {
ctx.response.body = `<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>`;
}
const template = await env.load("templates/partials/single-game-editor.vto");
const game = await gameService.getGameById(ctx.params.gameId);
const result = await template({
tab: "membre",
game: game,
});
ctx.response.headers.set("game-id", game?.id ?? "");
ctx.response.body = result.content;
});
const apiRouter = new Router();
apiRouter.get("/results/:year.json", async (ctx) => {