LVT-40: Warn user if manually entered match info doesn't match schedule#53
Open
jackattack-4 wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a manager endpoint intended to validate whether a manually-entered match reference (tournament/team/match number/type) corresponds to an existing scheduled match, supporting UI warnings when user input doesn’t match the schedule.
Changes:
- Added a new Manager API route (
GET /v1/manager/checkmatch) and OpenAPI documentation for it. - Implemented
checkMatchExistshandler that ensures tournament matches are loaded and queriesteamMatchDatafor the requested match row.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/routes/manager/manager.routes.ts | Registers OpenAPI spec for /checkmatch and wires the Express route into the manager router. |
| src/handler/manager/checkMatchExists.ts | New handler to validate query params, load tournament matches, and look up teamMatchData for the requested match. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
🚅 Deployed to the lovat-server-pr-53 environment in lovat
|
| router.get("/teams", requireAuth, getTeams); | ||
| router.get("/tournaments", requireAuth, getTournaments); | ||
|
|
||
| router.get("/checkmatch", checkMatchExists); |
Comment on lines
+140
to
+159
| request: { | ||
| query: z.object({ | ||
| tournamentKey: z.string(), | ||
| teamNumber: z.coerce.number().int(), | ||
| matchNumber: z.coerce.number().int(), | ||
| isElim: z.coerce.boolean(), | ||
| }), | ||
| }, | ||
| responses: { | ||
| 200: { | ||
| description: "Match Data Row (or null if not found)", | ||
| content: { | ||
| "application/json": { schema: TeamMatchDataSchema.nullable() }, | ||
| }, | ||
| }, | ||
| 400: { description: "Invalid parameters" }, | ||
| 401: { description: "Unauthorized" }, | ||
| }, | ||
| security: [], | ||
| }); |
Comment on lines
+14
to
+18
| tournamentKey: z.string(), | ||
| teamNumber: z.coerce.number().int(), | ||
| matchNumber: z.coerce.number().int(), | ||
| isElim: z.coerce.boolean(), | ||
| }) |
Comment on lines
+35
to
+37
| matchType: params.isElim | ||
| ? MatchType.QUALIFICATION | ||
| : MatchType.ELIMINATION, |
Comment on lines
+42
to
+45
| res | ||
| .status(200) | ||
| .send({ match, alliance: Number(match.key[-1]) < 3 ? "RED" : "BLUE" }); | ||
| return; |
| TournamentSchema, | ||
| } from "../../lib/prisma-zod.js"; | ||
| import { requireVerifiedTeam } from "../../lib/middleware/requireVerifiedTeam.js"; | ||
| import { MatchType } from "@prisma/client"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.