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

[Feature] Merge Basket with new data #21

Closed
poupryc opened this issue May 3, 2020 · 3 comments · Fixed by #29
Closed

[Feature] Merge Basket with new data #21

poupryc opened this issue May 3, 2020 · 3 comments · Fixed by #29
Assignees
Labels
enhancement New feature or request

Comments

@poupryc
Copy link

poupryc commented May 3, 2020

Hi!

I've just discovered Pantry (I haven't had the opportunity to test it yet). I looked at the documentation and there is one thing that seems to be missing: the ability to update a sneaker with new data without returning the full data.

For example, if I have a list of members and I want to add one more, if I understand correctly I have to return the entire new list of members.

I think a way to "insert" a single piece of data like with a UPSERT would just be amazing!

Thanks a lot

@imRohan
Copy link
Owner

imRohan commented May 4, 2020

Great Idea! Yes, right now performing a POST will create and update the basket inside your pantry. While I'd like to maintain the current behavior, I believe we can solve this issue by introducing the PUT method?

Essentially, if you were to use PUT vs POST the response could return a confirmation response, instead of the updated basket.

What do you think?

@imRohan imRohan self-assigned this May 4, 2020
@imRohan imRohan added the enhancement New feature or request label May 4, 2020
@poupryc
Copy link
Author

poupryc commented May 7, 2020

Hello!

I'm not sure I understand the behaviour you want to incorporate with the PUT method.

I still haven't tested pantry (shame on me) but here's how I see it :

  • POST the data of the basket is overwritten by the new data sent via the POST method.
  • PUT the data sent via PUT is merged with already existing data.

For example let's imagine I have a basketball like this.

{
  "authors": {
    "delta": { "votes": 42 },
    "omega": { "votes": -5 }
  },
  "global": { "votes": 37 } 
}

If I want to add a new author, I could just send in a PUT with

{
  "authors": {  "alpha": { "votes": 0 } }
}

What do you think ?

@imRohan imRohan mentioned this issue May 18, 2020
@imRohan imRohan linked a pull request May 18, 2020 that will close this issue
@imRohan
Copy link
Owner

imRohan commented May 18, 2020

@HelloEdit I agree with the comments above, and it seems that you're not alone with the request to update baskets! Ill work on this tonight, should have something for you to try out soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants