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

Bug - Change to API Response #529

Merged
merged 13 commits into from
Nov 11, 2024

Conversation

guninwasan
Copy link
Contributor

@guninwasan guninwasan commented Nov 10, 2024

Description

Resolves #517

This PR focuses on standardizing the response format by replacing Response with APIResponse. This change ensures consistency in how API responses are structured and handled.

Key changes include:

  • Replaced Response with APIResponse in def _wrapped_view to handle authentication and permission errors consistently (backend/core/api/public/decorators.py).
  • Updated the delete_invoice_endpoint to use APIResponse for handling invoice deletion outcomes (backend/core/api/public/endpoints/Invoices/delete.py).
  • Modified download to use APIResponse for handling PDF generation errors (backend/core/api/public/endpoints/Invoices/download_pdf.py).
  • Updated edit_invoice_endpoint to use APIResponse for handling invoice editing outcomes (backend/core/api/public/endpoints/Invoices/edit.py).
  • Changed get_invoices_endpoint to use APIResponse for handling invoice retrieval results (backend/core/api/public/endpoints/Invoices/get.py).
  • Updated client_delete_endpoint to use APIResponse for handling client deletion outcomes (backend/core/api/public/endpoints/clients/delete.py).
  • Modified system_health_endpoint to use APIResponse for handling system health check results (backend/core/api/public/endpoints/system_health.py).
  • Updated webhook_task_queue_handler_view_endpoint to use APIResponse for handling webhook task outcomes (backend/core/api/public/endpoints/webhooks/webhook_task_queue_handler.py).

Checklist

  • Ran the Black Formatter and
    djLint-er on any new code
    (checks
    will
    fail without)
  • Made any changes or additions to the documentation where required
  • Changes generate no new warnings/errors
  • New and existing unit tests pass locally with my
    changes

What type of PR is this?

  • 🐛 Bug Fix
  • ♻️ Code Refactor

Added/updated tests?

  • 🙅 no, because they aren't needed

Related PRs, Issues etc

@guninwasan guninwasan marked this pull request as ready for review November 10, 2024 04:35
Copy link
Owner

@TreyWW TreyWW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work thank you, really appreciate it

@TreyWW TreyWW merged commit a6f215c into TreyWW:main Nov 11, 2024
8 of 9 checks passed
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.

bug: replace all API "Response()" with new "APIResponse()"
2 participants