Add logging to check in/out

This commit is contained in:
Kalle
2024-03-21 22:32:43 +02:00
parent 31e14b1207
commit 4d94fbfa78
2 changed files with 12 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ import { tournamentIdFromParams } from "../tournament-utils";
import { useTournament } from "./to.$id";
import { findMapPoolByTeamId } from "~/features/tournament-bracket/queries/findMapPoolByTeamId.server";
import { Input } from "~/components/Input";
import { logger } from "~/utils/logger";
export const action: ActionFunction = async ({ request, params }) => {
const user = await requireUserId(request);
@@ -162,6 +163,9 @@ export const action: ActionFunction = async ({ request, params }) => {
// 0 = regular check in
bracketIdx: data.bracketIdx === 0 ? null : data.bracketIdx,
});
logger.info(
`Checked out: tournament team id: ${data.teamId} - user id: ${user.id} - tournament id: ${tournamentId} - bracket idx: ${data.bracketIdx}`,
);
break;
}
case "REMOVE_MEMBER": {

View File

@@ -78,6 +78,7 @@ import { findMapPoolByTeamId } from "~/features/tournament-bracket/queries/findM
import { filterOutFalsy } from "~/utils/arrays";
import { MapPoolStages } from "~/components/MapPoolSelector";
import { Section } from "~/components/Section";
import { logger } from "~/utils/logger";
export const action: ActionFunction = async ({ request, params }) => {
const user = await requireUser(request);
@@ -186,6 +187,10 @@ export const action: ActionFunction = async ({ request, params }) => {
break;
}
case "CHECK_IN": {
logger.info(
`Checking in (try): tournament team id: ${ownTeam?.id} - user id: ${user.id} - tournament id: ${tournamentId}`,
);
validate(tournament.regularCheckInIsOpen, "Check in is not open");
validate(ownTeam);
validate(!ownTeamCheckedIn, "You have already checked in");
@@ -197,6 +202,9 @@ export const action: ActionFunction = async ({ request, params }) => {
);
checkIn(ownTeam.id);
logger.info(
`Checking in (success): tournament team id: ${ownTeam.id} - user id: ${user.id} - tournament id: ${tournamentId}`,
);
break;
}
case "ADD_PLAYER": {