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

Fix: Delete Expense Filter #632

Merged
merged 4 commits into from
Aug 19, 2024
Merged

Fix: Delete Expense Filter #632

merged 4 commits into from
Aug 19, 2024

Conversation

ruuushhh
Copy link
Contributor

@ruuushhh ruuushhh commented Aug 19, 2024

Summary by CodeRabbit

  • New Features
    • Added a new API endpoint for deleting expense filters, enhancing expense filter management.
  • Refactor
    • Separated the ExpenseFilterView into two classes: ExpenseFilterView for listing and creating, and ExpenseFilterDeleteView for deletion, improving code organization.
  • Chores
    • Updated Docker command syntax in GitHub Actions workflows for better alignment with current best practices.

Copy link

coderabbitai bot commented Aug 19, 2024

Walkthrough

This update refines the codebase by modernizing Docker commands in GitHub Actions workflows while enhancing the Fyle application's URL routing and view structure. The transition from docker-compose to docker compose maintains existing functionality, and a new view for handling expense filter deletions promotes clearer separation of concerns in the code.

Changes

Files Change Summary
.github/workflows/codecov.yml, .github/workflows/pytest_action.yml Updated Docker commands from docker-compose to docker compose syntax, preserving existing workflow logic.
apps/fyle/urls.py Added a new route for ExpenseFilterDeleteView to manage DELETE operations for expense filters.
apps/fyle/views.py Split ExpenseFilterView into ExpenseFilterView and ExpenseFilterDeleteView for better separation of concerns.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant API
    participant ExpenseFilterView
    participant ExpenseFilterDeleteView

    User->>API: Request list of expense filters
    API->>ExpenseFilterView: Fetch filters
    ExpenseFilterView-->>API: Return filters
    API-->>User: Display filters

    User->>API: Request DELETE expense filter
    API->>ExpenseFilterDeleteView: Delete filter
    ExpenseFilterDeleteView-->>API: Confirm deletion
    API-->>User: Acknowledge deletion
Loading

Poem

🐰 In code we hop, with joy we cheer,
New paths to delete, our purpose clear.
From docker-compose we now ascend,
To docker compose, our trusty friend.
With filters gone, our hearts take flight,
Clean code's a delight, oh what a sight! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ruuushhh ruuushhh added the deploy Triggers deployment of active branch to Staging label Aug 19, 2024
@ruuushhh ruuushhh added deploy Triggers deployment of active branch to Staging and removed deploy Triggers deployment of active branch to Staging labels Aug 19, 2024
Copy link

Tests Skipped Failures Errors Time
217 0 💤 0 ❌ 0 🔥 24.681s ⏱️

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 22cbd81 and ae33c46.

Files selected for processing (4)
  • .github/workflows/codecov.yml (1 hunks)
  • .github/workflows/pytest_action.yml (1 hunks)
  • apps/fyle/urls.py (2 hunks)
  • apps/fyle/views.py (2 hunks)
Files skipped from review due to trivial changes (2)
  • .github/workflows/codecov.yml
  • .github/workflows/pytest_action.yml
Additional comments not posted (2)
apps/fyle/views.py (2)

329-335: Verify the deletion logic in ExpenseFilterDeleteView.

The ExpenseFilterDeleteView class is correctly set up as a DestroyAPIView with a queryset and serializer. Ensure that any custom deletion logic, if needed, is implemented in this class.


Line range hint 338-343: Ensure separation of concerns in ExpenseFilterView.

The ExpenseFilterView class now handles only listing and creation. This separation of concerns is a good practice. Ensure that any logic previously in the delete method is appropriately handled in the new ExpenseFilterDeleteView.

@@ -28,6 +28,7 @@
path('expense_attributes/', ExpenseAttributesView.as_view(), name='expense-attributes'),
path('fyle_fields/', FyleFieldsView.as_view(), name='fyle-fields'),
path('fields/', FyleFieldsView.as_view(), name='fyle-fields-v2'),
path('expense_filters/<int:pk>/', ExpenseFilterDeleteView.as_view(), name='expense-filters'),
Copy link

Choose a reason for hiding this comment

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

Ensure consistent naming for URL patterns.

The new URL pattern added for ExpenseFilterDeleteView uses the name 'expense-filters', which is identical to the existing pattern for ExpenseFilterView. Consider using a more descriptive name to differentiate between the two, such as 'expense-filter-delete'.

-    path('expense_filters/<int:pk>/', ExpenseFilterDeleteView.as_view(), name='expense-filters'),
+    path('expense_filters/<int:pk>/', ExpenseFilterDeleteView.as_view(), name='expense-filter-delete'),
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
path('expense_filters/<int:pk>/', ExpenseFilterDeleteView.as_view(), name='expense-filters'),
path('expense_filters/<int:pk>/', ExpenseFilterDeleteView.as_view(), name='expense-filter-delete'),

Copy link

Tests Skipped Failures Errors Time
217 0 💤 1 ❌ 0 🔥 25.490s ⏱️

Copy link

Tests Skipped Failures Errors Time
217 0 💤 0 ❌ 0 🔥 25.869s ⏱️

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ae33c46 and e695e36.

Files selected for processing (2)
  • apps/fyle/urls.py (2 hunks)
  • tests/test_fyle/test_views.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/fyle/urls.py
Additional comments not posted (1)
tests/test_fyle/test_views.py (1)

353-360: New test case for expense filter deletion looks good!

The test case successfully verifies the deletion of an expense filter by asserting a 204 status code.

@ruuushhh ruuushhh merged commit a292aad into master Aug 19, 2024
1 check passed
ruuushhh added a commit that referenced this pull request Aug 19, 2024
* Fix: Delete Expense Filter

* fix pytest"

* add tests

* add tests

---------

Co-authored-by: GitHub Actions <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy Triggers deployment of active branch to Staging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants