TreyWW / MyFinances

MyFinances is a web application that can help you as an individual, or team, manage your finances!
https://docs.myfinances.cloud
GNU Affero General Public License v3.0
100 stars 144 forks source link

[Feature] Implement Client Deletion via the Client Management Dashboard #386

Closed TreyWW closed 3 months ago

TreyWW commented 4 months ago

Discussed in https://github.com/TreyWW/MyFinances/discussions/384

Originally posted by **artkolpakov** May 24, 2024 The application currently does not support client deletion via the Client Management Dashboard with the delete button being [disabled](https://github.com/TreyWW/MyFinances/blob/main/frontend/templates/pages/clients/dashboard/_rows.html#L14C73-L14C81): ![image](https://github.com/TreyWW/MyFinances/assets/91341345/53381cea-d0ca-4ee6-a06e-64709be2a851) ### Proposed Implementation: To implement the client deletion functionality, follow these steps: **1. Backend API Implementation:** - Implement the `DELETE` API endpoint (and a file for it) within the [backend/api/clients](https://github.com/TreyWW/MyFinances/tree/main/backend/api/clients) directory to handle client deletion logic. - Ensure that a client record is actually deleted from the database with a 200 status code when a user with appropriate permissions makes the request. Handle the 404 status code for cases where the client does not exist. - Add the `/delete` path for the implemented endpoint in the [backend/api/clients/urls.py](https://github.com/TreyWW/MyFinances/blob/main/backend/api/clients/urls.py) file. **2. Frontend Integration:** - Enable and hook up the delete button in the [pages/clients/dashboard/_rows.html](https://github.com/TreyWW/MyFinances/blob/main/frontend/templates/pages/clients/dashboard/_rows.html) file to call the client deletion API. - Implement pop-up messages on the Client Management Dashboard page to reflect the success of the API call (similar to the one indicating successful client creation). - Ensure that the deleted client is removed from the clients table in [pages/clients/dashboard/_table.html](https://github.com/TreyWW/MyFinances/blob/main/frontend/templates/pages/clients/dashboard/_table.html) upon successful deletion. The proposed implementation aims to allow users to delete clients using the client management dashboard, improving the overall functionality and user experience of the application.
Domejko commented 4 months ago

I will start working on that.

artkolpakov commented 4 months ago

I will start working on that.

It was meant to be my task (I proposed it, @TreyWW should've assigned it to me). I've already implemented the backend steps. How far is your progress? I guess it's a matter of whoever creates the PR first now...

TreyWW commented 4 months ago

Hey @artkolpakov, sorry about that - completely my fault. Since @Domejko has made some progress, would you mind checking out his PR #389 and see if any of his "todo" items have been complete by you?

Hopefully we can sort it out, sorry again

artkolpakov commented 4 months ago

Hey @artkolpakov, sorry about that - completely my fault. Since @Domejko has made some progress, would you mind checking out his PR #389 and see if any of his "todo" items have been complete by you?

Hopefully we can sort it out, sorry again

Sounds good, and no worries about it—it's also my fault, as I didn't realize you have to indicate you're working on the issue in the comment section. I'll probably let @Domejko finish it, and then I could work on implementing some client deletion unit tests or any further enhancements (either as part of this same PR or as a new PR).