Skip to content

Added menu items and images to api#251

Draft
laasyaaki wants to merge 4 commits intomainfrom
searchable_menus
Draft

Added menu items and images to api#251
laasyaaki wants to merge 4 commits intomainfrom
searchable_menus

Conversation

@laasyaaki
Copy link
Copy Markdown
Collaborator

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.

@laasyaaki laasyaaki marked this pull request as draft March 23, 2026 02:35
Comment thread src/db/getLocations.ts
todaysSoups: specials[id]?.soups ?? [],
todaysSpecials: specials[id]?.specials ?? [],
images: menuData?.images ?? [],
menuItemsString: menuData?.menuItemsString ?? "",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant