Bundles: protect their parts from deletion, show the saving #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bundle-parts-sale-price"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
A bundle card showed "1× Item (2 hours)" instead of the service names. Bundle parts are stored as JSON, not relations, so a service could be deleted, or made inactive, while bundles and codes still pointed at it. The public shop only loads active items, so it couldn't name the part. Bundles also didn't show that they're cheaper than buying the parts one by one.
What changes
onRecordDeletehook, so it also covers the PocketBase dashboard. The admin shows a message naming the bundle or code.guard.py(8 checks: delete refused for a bundle part, refused for a code with sessions left, allowed once the code is void, bundle refused with an inactive part, snapshot kept); scenarios 46/46 and passes 37/37 again on a fresh schema; and in a browser: the sale price on the card, the admin warnings, and the delete error banner.Deploying
Nothing to migrate: these are hook and app changes only. After deploying, check Services & products for bundles marked Not on sale. Any that point at an already-deleted service need that part re-added or removed in the bundle editor.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW