Org Web Adapter

pages/mmpy_155_remove_ability_to_delete_accounts.org

ID
fe1a44c6-e9ad-4804-a838-1810ea8f0a94

MMPY-155 Remove ability to delete accounts

- source :: https://multimediallc.atlassian.net/browse/MMPY-155

- tags :: Falcon Nest Project Story Falcon Nest Project

- epic :: MMPY-196 Django Admin Refinements

Background

Financial data that is associated with a payout cannot be deleted for 7 years

after it is used. There is a “delete” API endpoint for Accounts, created with

the idea that we might offer the end user the ability to delete their accounts

some day. This is not a phase 1 offering.

Requirements

DONE Investigate best way to avoid removing Account data

featureaccountsworkdjadminmultimediallcmmpy155spike
ID
6a073928-d9d2-3e0c-661e-33fc983eb1c9

- Note taken on

ChatGPT suggests overriding the `delete` method on the model:

#+begin_src python

def delete(self, *args, **kwargs):

if self.book_set.exists(): # Or whatever the related name is

raise ValidationError("Cannot delete author with books.")

super().delete(*args, **kwargs)

#+end_src

I think this will work, but we may also want to remove the delete option in the admin so as to not confuse anyone.

DONE Add delete override to PayeeAccount model to inhibit deletion

featurepayeeaccountworkmultimediallcmmpy155
ID
6e1813ec-cf2f-31d8-8a6e-a699e267bb95

DONE Remove ability to delete PayeeAccount instances in Django Admin

multimediallcdjadminpayeeaccountfeaturemmpy155
ID
cc909d5f-325a-43e1-d459-58875d7a4af7

DONE Fix PR changes

multimediallcdjadminpayeeaccountfeaturemmpy155
ID
c907588b-9caa-05d3-bdae-530887bca670

DONE Add NoDeleteMixin to digital accounts as well

multimediallcworkfeaturedjadminmmpy155payeeaccount
ID
f59085ea-d006-57d6-860d-3b72cf4fdbd5

DONE Add tests for digital accounts

multimediallctestsfeatureworkdjadminmmpy155payeeaccount
ID
471186df-6fb8-6a53-3a3b-7b653ac9252c

GIVEN

An account is tied to any transfers

WHEN

The account deletion is attempted

THEN

An error shows and the account is not deleted. This goes for both the payee

account object and the digital/mail/bank account object.

Alternative

Remove account deletion API and any account deletion capabilities via django

admin. We can add them in later when we are ready for a full fledged feature.