Repository navigation
Check the stored customer group before an API update - #1108
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: bugfix
Issue
PUT /CustomerGroupdecided whether a group is a system group from theIsSystemvalue in the request body. A client that sentIsSystem: falsecould edit a system group, and one that sentIsSystem: truefor an ordinary group got 400.PATCHandDELETEalready check the stored group.Edit/{id}?ProductId={productId}. The edit form no longer forwards that value (Keep the product, customer and rating of a review out of the edit form #1086), so the query string did nothing.Solution
Putloads the stored group: 404 when it does not exist, 400 when it is a system group. An emptyIdreturns 400, the same asPatchwith an empty key.Edit/{id}only.CustomerGroupControllerTestscoverPut(system, ordinary, unknown, without id) andPatchon a system group.Breaking changes
API
PUT /CustomerGroupon a system group now returns 400 whateverIsSystemsays in the body, and returns 404 for an unknown id.Testing
PUTa system group (e.g. Administrators) withIsSystem: falseand a changed name. Expect 400 and no change.PUTan ordinary group. Expect 200 and the change saved.dotnet test src/Tests/Grand.Module.Api.Testspasses.