Skip to content

Add quantity, bundle price, and link fields to listings

jedmund requested to merge jedmund/quantity-bundle-link into main

Summary

  • Add three columns to listings: quantity (int, default 1), bundle_price (int, nullable), and link (text, nullable). Migration 0004_unknown_kitty_pryde.sql.
  • Admin create/edit expose the new fields with validation (quantity >= 1; bundle price only applied when quantity > 1; link must start with http(s)://).
  • Public detail page renders "$X each", adds "N available" when quantity > 1, and "or $Y for all N" when a bundle price is set. "more info" blue underlined link renders below the description when the listing has one.

Test plan

  • pnpm db:migrate applies 0004 cleanly on existing data (existing rows default to quantity=1, null bundle, null link)
  • Create a new listing with quantity=3 and bundle price, confirm it renders "3 available" and "or $Y for all 3"
  • Edit an existing listing, add a link starting with https://, confirm the "more info" link renders and opens in a new tab
  • Submitting quantity=0 or a link without http(s):// returns the form error

Merge request reports

Loading