Skip to content

merge duplicate customers into one - #33

Merged
valyo merged 1 commit into
mainfrom
merge-customers
Oct 30, 2026
Merged

valyo merged 1 commit into
mainfrom
merge-customers

Conversation

@valyo

@valyo valyo commented Oct 30, 2026

Copy link
Copy Markdown
Owner

The same person can end up as two customers, for example with two email addresses, and neither can be deleted when both have bookings. Add a merge to the Customers page: open the customer to keep, pick the duplicate under "Merge a duplicate into this customer", check the preview and confirm.

  • POST /api/customer//merge moves the duplicate's Andelsbiodling and Lammandel bookings and its sales to the kept customer, then deletes the duplicate, all in one transaction. The kept customer keeps its own name and email; details it lacks are copied from the duplicate.
  • GET /api/customer//merge-preview reports what would move and changes nothing.
  • Refused when both customers have a booking of the same kind in the same season, since a customer can only have one booking per season. The error names both by name and email.
  • Tests cover access, validation, moving bookings and sales, detail copying, the same-season conflict and the preview.

The same person can end up as two customers, for example with two email
addresses, and neither can be deleted when both have bookings. Add a merge
to the Customers page: open the customer to keep, pick the duplicate under
"Merge a duplicate into this customer", check the preview and confirm.

- POST /api/customer/<id>/merge moves the duplicate's Andelsbiodling and
  Lammandel bookings and its sales to the kept customer, then deletes the
  duplicate, all in one transaction. The kept customer keeps its own name
  and email; details it lacks are copied from the duplicate.
- GET /api/customer/<id>/merge-preview reports what would move and changes
  nothing.
- Refused when both customers have a booking of the same kind in the same
  season, since a customer can only have one booking per season. The error
  names both by name and email.
- Tests cover access, validation, moving bookings and sales, detail
  copying, the same-season conflict and the preview.
@valyo
valyo merged commit b7bdeb4 into main Oct 30, 2026
3 checks passed
@valyo
valyo deleted the merge-customers branch October 30, 2026 18:18
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