Skip to content

fix(plugin-id/ui): map scope name to Integer ID before save (Company + Group)#25

Merged
fdaugan merged 1 commit into
feature/vuejsfrom
norman/fix-scope-payload-id
May 19, 2026
Merged

fix(plugin-id/ui): map scope name to Integer ID before save (Company + Group)#25
fdaugan merged 1 commit into
feature/vuejsfrom
norman/fix-scope-payload-id

Conversation

@Terracosmos
Copy link
Copy Markdown
Collaborator

After fixing the @post 405 (PR norman/fix-container-resource-post),
POST /group returned 400 with {"errors":{"scope":[{"rule":"Integer"}]}}.

Cause

The backend expects scope as the container scope's Integer ID, but the
frontend 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 scopeAll list
(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

  • CompanyEditView.vue (save())
  • GroupEditView.vue (save())

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.

…+ 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.
@Terracosmos Terracosmos requested a review from fdaugan May 19, 2026 11:42
@sonarqubecloud
Copy link
Copy Markdown

@sonarqubecloud
Copy link
Copy Markdown

@fdaugan fdaugan merged commit aad29ca into feature/vuejs May 19, 2026
4 of 5 checks passed
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.

2 participants