Skip to content

feat: customer cascade delete also removes messages, dependants, customer links and CRM events - #2969

Open
hongwei1 wants to merge 11 commits into
OpenBankProject:developfrom
hongwei1:feature/customer-cascade-delete
Open

hongwei1 wants to merge 11 commits into
OpenBankProject:developfrom
hongwei1:feature/customer-cascade-delete

Conversation

@hongwei1

@hongwei1 hongwei1 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

The Customer cascade delete (DELETE /obp/v4.0.0/management/cascading/banks/BANK_ID/customers/CUSTOMER_ID, role CanDeleteCustomerCascade, routed only when allow_cascade_delete=true) now also removes the customer's messages, dependants, links to other customers (on either side) and CRM events (matched on bank and customer number), on top of what it already removed. The Customer row is deleted last, so a failure of that step rolls back every earlier one, and the endpoint answers 404 (OBP-30046) for a Customer that belongs to a different bank than the one in the URL.

Tests: one scenario per newly covered table (each also checks that another customer's rows stay), a bank-ownership scenario, and a rollback scenario in CascadeDeleteAtomicityTest; the customer, atomicity, endpoint, account, bank, product, transaction, counterparty and Berlin Group consent-challenge cascade suites pass. Not covered: social media rows (they hold a customer number but no bank), standing orders, direct debits and mandates (they belong to the account, and the account cascade keeps them), card rows that name the customer, and child customers that point at a deleted parent.

The customer row is now the last task, with the customer-account links ahead of it, so a failure of the last step rolls back every earlier one.
CRM events are matched on bank and customer number. Social media rows hold no bank, so they are only deleted when no customer of another bank has the same number.
Mandates are tied to an account, and the account cascade keeps them, so the customer cascade leaves them too.
…er cascade

They are tied to an account, and the account cascade keeps them, so the customer cascade leaves them too.
Social media rows hold a customer number but no bank, so they cannot be told apart from those of a same-numbered customer at another bank. CRM events, which hold the bank, stay in the cascade.
@hongwei1 hongwei1 changed the title feat: customer cascade delete covers every table that carries the customer id feat: customer cascade delete also removes messages, dependants, customer links and CRM events Nov 16, 2026
@sonarqubecloud

Copy link
Copy Markdown

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