Init design doc#53
Conversation
|
| WHERE c.run_at >= TIMESTAMPTZ '2026-01-01' | ||
| AND c.run_at < TIMESTAMPTZ '2027-01-01'; |
There was a problem hiding this comment.
The SQL query uses hardcoded dates '2026-01-01' and '2027-01-01' instead of parameterizing the {year} path variable. If implemented as written, the endpoint will ignore the year parameter and always return matches for 2026 only.
Fix: Replace with parameterized dates:
WHERE c.run_at >= TIMESTAMPTZ :year || '-01-01'
AND c.run_at < TIMESTAMPTZ (:year + 1) || '-01-01'| WHERE c.run_at >= TIMESTAMPTZ '2026-01-01' | |
| AND c.run_at < TIMESTAMPTZ '2027-01-01'; | |
| WHERE c.run_at >= TIMESTAMPTZ :year || '-01-01' | |
| AND c.run_at < TIMESTAMPTZ (:year + 1) || '-01-01'; | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
Graphite Automations"Request reviewers once CI passes" took an action on this PR • (07/11/26)2 reviewers were added to this PR based on Henry Chen's automation. |
| SELECT m.id, m.member_a_id, m.member_b_id, m.status, | ||
| to_char(c.run_at, 'YYYY-MM') AS month | ||
| FROM matches m | ||
| JOIN match_cycles c ON m.cycle_id = c.id |
There was a problem hiding this comment.
change match_cycle.id to an int
| ``` | ||
| * Figured a flat list is more flexible for rendering instead of grouping by month server side | ||
|
|
||
| ## /api/matches/{year} |
There was a problem hiding this comment.
Just have /api/matches/{match_cycle.id} instead of a year.
| ## /api/matches/{year}/{month} | ||
| * Join on match_cycles, filtered by run_at within month | ||
| ```sql | ||
| SELECT m.id, m.member_a_id, m.member_b_id, m.status, | ||
| to_char(c.run_at, 'YYYY-MM') AS month | ||
| FROM matches m | ||
| JOIN match_cycles c ON m.cycle_id = c.id | ||
| WHERE c.run_at >= TIMESTAMPTZ '2026-01-01' | ||
| AND c.run_at < TIMESTAMPTZ '2026-02-01'; | ||
| ``` |
There was a problem hiding this comment.
No need to break this up by year
|
|
||
| | Method | Path | Description | | ||
| |--------|------|-------------| | ||
| | GET | /api/matches/{year} | List pairings by year | |
There was a problem hiding this comment.
We should have a /api/matches/list endpoint that takes in search params




No description provided.