WIP: Added menu items and images to api #251

Draft
laasyaaki wants to merge 4 commits from searchable_menus into main
laasyaaki commented 2026-03-23 02:32:35 +00:00 (Migrated from github.com)

The menu PNGs given by dining are now visible directly on cmueats. The items are all searchable and the locations serving those items will pop up. Search "lavender" for example will result in coffee shops showing up when it previously did not yield any results.

The menu PNGs given by dining are now visible directly on cmueats. The items are all searchable and the locations serving those items will pop up. Search "lavender" for example will result in coffee shops showing up when it previously did not yield any results.
sentry[bot] (Migrated from github.com) reviewed 2026-03-23 02:36:14 +00:00
@ -99,0 +101,4 @@
...timeRanges.map((rng) => ({
date: overrideDate,
startMinutesSinceMidnight:
rng.start.hour * 60 + rng.start.minute,
sentry[bot] (Migrated from github.com) commented 2026-03-23 02:36:14 +00:00

Bug: The menuItemsString field incorrectly returns "" instead of null for missing data, which violates the API's nullable schema definition.
Severity: MEDIUM

Suggested Fix

Change the nullish coalescing operator's fallback value from "" to null to align with the API schema. The line should be updated to menuItemsString: menuData?.menuItemsString ?? null. This ensures the API correctly signals the absence of data to clients.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/db/getLocations.ts#L57

Potential issue: The `getLocations` function incorrectly handles null values for the
`menuItemsString` field. It uses the nullish coalescing operator `?? ""` to convert
`null` values from the database into an empty string. However, the API schema explicitly
defines this field as nullable (`t.Nullable(t.String())`), and the data loading pipeline
intentionally stores `null` for missing data. This mismatch breaks the API contract, as
clients expecting `null` to signify "no data" will receive an empty string instead,
potentially leading to incorrect client-side logic.

Did we get this right? 👍 / 👎 to inform future reviews.

**Bug:** The `menuItemsString` field incorrectly returns `""` instead of `null` for missing data, which violates the API's nullable schema definition. <sub>Severity: MEDIUM</sub> <!-- BUG_PREDICTION --> <details> <summary><b title="Reference ID: `12164790/0`">Suggested Fix</b></summary> Change the nullish coalescing operator's fallback value from `""` to `null` to align with the API schema. The line should be updated to `menuItemsString: menuData?.menuItemsString ?? null`. This ensures the API correctly signals the absence of data to clients. </details> <details open> <summary><b title="Reference ID: `12164790/0`">Prompt for AI Agent</b></summary> ``` Review the code at the location below. A potential bug has been identified by an AI agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not valid. Location: src/db/getLocations.ts#L57 Potential issue: The `getLocations` function incorrectly handles null values for the `menuItemsString` field. It uses the nullish coalescing operator `?? ""` to convert `null` values from the database into an empty string. However, the API schema explicitly defines this field as nullable (`t.Nullable(t.String())`), and the data loading pipeline intentionally stores `null` for missing data. This mismatch breaks the API contract, as clients expecting `null` to signify "no data" will receive an empty string instead, potentially leading to incorrect client-side logic. ``` </details> <sub><i>Did we get this right? :+1: / :-1: to inform future reviews.</i></sub> <!-- <sub>Reference ID: `12164790`</sub>-->
This pull request has changes conflicting with the target branch.
  • src/db/getLocations.ts
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin searchable_menus:searchable_menus
git switch searchable_menus

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff searchable_menus
git switch searchable_menus
git rebase main
git switch main
git merge --ff-only searchable_menus
git switch searchable_menus
git rebase main
git switch main
git merge --no-ff searchable_menus
git switch main
git merge --squash searchable_menus
git switch main
git merge --ff-only searchable_menus
git switch main
git merge searchable_menus
git push origin main
Sign in to join this conversation.
No description provided.