Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ability to soft delete fees #2233

Merged
merged 5 commits into from
Jul 8, 2024

Conversation

brunomiguelpinto
Copy link
Contributor

@brunomiguelpinto brunomiguelpinto commented Jul 1, 2024

Context
We already utilize the discard gem for soft deletion in other models within our application. However, the fees model currently lacks this functionality. Additionally, there is a need to ensure that fees associated with invoices are protected from deletion to maintain data integrity.

Description
This PR extends the use of the discard gem to the fees model, enabling the soft deletion of fees. Furthermore, a validation is added to ensure that only fees not attached to any invoice can be deleted. If a deletion attempt is made on a fee associated with an invoice, the system will respond with a 405 Method Not Allowed status and an error code invoiced_fee. This ensures that while fees can be logically removed from active use, those associated with invoices remain intact, preserving the integrity of invoice-related data.

Screenshot 2024-07-08 at 14 26 58

@brunomiguelpinto brunomiguelpinto self-assigned this Jul 1, 2024
@brunomiguelpinto brunomiguelpinto added API Related to the public API Fee labels Jul 1, 2024
@brunomiguelpinto brunomiguelpinto force-pushed the feat-add-fee-soft-deletion branch 3 times, most recently from 94cc5d4 to cced041 Compare July 5, 2024 18:23
@brunomiguelpinto brunomiguelpinto marked this pull request as ready for review July 5, 2024 18:23
@brunomiguelpinto brunomiguelpinto force-pushed the feat-add-fee-soft-deletion branch from cced041 to 25f0d13 Compare July 8, 2024 11:26
@brunomiguelpinto brunomiguelpinto merged commit 357c91d into main Jul 8, 2024
6 checks passed
@brunomiguelpinto brunomiguelpinto deleted the feat-add-fee-soft-deletion branch July 8, 2024 15:49
abdussamadbello pushed a commit to abdussamadbello/lago-api that referenced this pull request Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to the public API Fee
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants