fix(plugin-id/ui): map scope name to Integer ID before save (Company + Group)#25
Merged
Merged
Conversation
…+ Group) The backend expects `scope` as an Integer (container scope ID), not as the string name. The frontend v-autocomplete uses the name for display (item-value="name"), so we now resolve the ID from the preloaded scopeAll list at save() time. Unblocks POST /company and POST /group from the UI after the @post fix in PR norman/fix-container-resource-post. GroupEditView previously stored only the scope names in availableScopes (stripped at load time); add a parallel scopeAll ref holding the full {id, name, ...} objects so save() can resolve the ID.
|
|
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.



After fixing the @post 405 (PR norman/fix-container-resource-post),
POST /group returned 400 with {"errors":{"scope":[{"rule":"Integer"}]}}.
Cause
The backend expects
scopeas the container scope's Integer ID, but thefrontend was sending the string name (e.g. "Internal", "Functional")
because the v-autocomplete uses
item-value="name"for display purposes.Fix
At save() time, resolve the scope ID from the preloaded
scopeAlllist(loaded at mount via GET /container-scope/). This keeps the
v-model as a clean string for display while sending the correct integer
ID at the API boundary. A guard rejects unknown scope names with a toast
rather than sending an invalid payload.
Files
UserEditView.vue is not affected — User.company and User.groups accept
string names in the backend payload.
Tested
/id/company/new : created "TestCo" with scope "Internal" → save OK,
appears in list, redirect OK.