feat: add confirmation check to buy buttom
authorxangelo <me@xangelo.ca>
Mon, 20 Jan 2025 15:55:54 +0000 (10:55 -0500)
committerxangelo <me@xangelo.ca>
Mon, 20 Jan 2025 15:55:54 +0000 (10:55 -0500)
commitf9963664708e5c6c9b6823ed35f763495ca35fff
tree16c8ec0c7f268382a19dc0d7e346202ae62e43e8
parent8688e076bf2eca024d8df98863e796bf058db140
feat: add confirmation check to buy buttom

This was a small feature that ended up fixing a data deviation between
the equipment and items tables. Equipment had a cost column, but items
had a price_per_unit column. I've renamed the price_per_unit column
to cost and updated the seeds to reflect that.

This allowed me to simplify the purchase and check code and allow for
a consistent interface for the two item types. In addition, when you
click on the buy button it now checks the db for the actual cost of the
item and only lets you purchase it if you have enough gold.

Previously it would always display the confirm button and only show you
and error after.
migrations/20250120155039_rename_price_per_unit_to_cost.ts [new file with mode: 0644]
public/assets/bundle.js
seeds/shop_items.ts
src/client/htmx.ts
src/server/api.ts
src/server/routes/locations/stores.ts
src/server/views/stores.ts
src/shared/items/index.ts