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 delete endpoint (#345) #346

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

feat: add delete endpoint (#345) #346

wants to merge 2 commits into from

Conversation

psankhe28
Copy link
Contributor

@psankhe28 psankhe28 commented Aug 13, 2024

Description

It adds an endpoint to delete the drs object based on the object id

Fixes #(issue)
#333

Checklist

  • My code follows the contributing guidelines of this project.
  • I am aware that all my commits will be squashed into a single commit, using the PR title as the commit message.
  • I have performed a self-review of my own code.
  • I have commented my code in hard-to-understand areas.
  • I have updated the user-facing documentation to describe any new or changed behavior.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have not reduced the existing code coverage.

Comments

Summary by Sourcery

Add a delete endpoint to the API for removing DRS objects by ID and update the documentation to reflect this new functionality.

New Features:

  • Introduce a new endpoint to delete a DRS object based on its ID.

Documentation:

  • Update the README to include documentation for the new deleteObject function, detailing its parameters and usage.

Signed-off-by: Pratiksha Sankhe <[email protected]>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Copy link

changeset-bot bot commented Aug 13, 2024

⚠️ No Changeset found

Latest commit: 7b0a6b8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Aug 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
elixir-cloud-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 13, 2024 7:38pm

Copy link
Contributor

sourcery-ai bot commented Aug 13, 2024

Reviewer's Guide by Sourcery

This pull request implements a new endpoint to delete DRS objects by their ID. The changes include adding a new deleteObject function in the drsAPI.ts file and updating the README.md to document this new functionality. The implementation follows RESTful principles and includes error handling.

File-Level Changes

Files Changes
packages/ecc-client-elixir-drs-filer/src/API/Object/drsAPI.ts Implemented a new deleteObject function to handle DELETE requests for DRS objects
packages/ecc-client-elixir-drs-filer/src/API/Object/drsAPI.ts Added JSDoc comments to explain the postObject and deleteObject functions
packages/ecc-client-elixir-drs-filer/src/API/Object/drsAPI.ts Updated the export statement to include the new deleteObject function
packages/ecc-client-elixir-drs-filer/src/API/Object/README.md Added documentation for the new deleteObject endpoint in the README

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @psankhe28 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider improving error handling in the deleteObject function. The current implementation returns different structures for errors vs. success, which could lead to inconsistent behavior. Also, consider checking and handling specific HTTP status codes.
  • The JSDoc for the deleteObject function is less detailed compared to postObject. Please enhance the documentation to maintain consistency and provide more information about parameters and return values.
  • No tests have been added for the new deleteObject endpoint. Given that this is a data-modifying operation, it's crucial to have comprehensive tests to ensure correct functionality and handle various scenarios.
Here's what I looked at during the review
  • 🟡 General issues: 4 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟡 Documentation: 2 issues found

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

* @param {object} objectData - The data of the drs object to be posted.
* This should be an object containing the necessary fields for the drs object.
* Modify the structure according to your object requirements.
* @returns {string} - A string that denotes the object id
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: Update JSDoc to match actual return type of postObject

The JSDoc indicates that postObject returns a string, but the implementation suggests it returns an object. Please update the documentation to accurately reflect the function's behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

@psankhe28, please take a look at this

method: "DELETE",
});

if (!response) {
Copy link
Contributor

Choose a reason for hiding this comment

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

consider some more robust error handling like checking the status text, as checking for just the response object won't catch many errors that may occur.

Also consider this for the other postObject function.

@SalihuDickson
Copy link
Contributor

@psankhe28, please address the request changes and resolve conflicts with main so I can re-review.

@anuragxxd
Copy link
Member

Hey @psankhe28, can we have this merged?

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.

3 participants