Skip to content

Config/user roles parameter template, userInfo updates and refactoring#724

Open
canptura wants to merge 12 commits intomainfrom
config/user-parameter-roles-template
Open

Config/user roles parameter template, userInfo updates and refactoring#724
canptura wants to merge 12 commits intomainfrom
config/user-parameter-roles-template

Conversation

@canptura
Copy link
Copy Markdown
Contributor

@canptura canptura commented Mar 23, 2026

This branch introduces two new virtual parameters and various changes in the storage/display of userInfo-Parameters as well as some refactorings.

  • introduces virtual parameters for:
    • a users roles
    • roles of an organization
      • with their corresponding users as subParameters
  • user and organization templates updated for roles
  • userInfo parameters updates
    • name fields changed to kebab-case
    • field parameters are no longer stored in the DB but generated on load
  • templates reordered in a fine grained manner
  • split helper functions into aas- and non-aas helper functions

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@canptura canptura marked this pull request as draft March 25, 2026 11:23
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@canptura canptura marked this pull request as ready for review March 27, 2026 15:03
@canptura canptura changed the title Config/user parameter roles template Config/user parameter roles template, userInfo updated and refactoring Mar 27, 2026
@canptura canptura changed the title Config/user parameter roles template, userInfo updated and refactoring Config/user roles parameter template, userInfo updates and refactoring Mar 27, 2026
Copy link
Copy Markdown
Contributor

@jjoderis jjoderis left a comment

Choose a reason for hiding this comment

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

At the moment it looks as if the user has the ability to change the virtual parameters like a users name. Is this intended or should this be changed before this PR is merged?

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

displayName: [{ text: `${lastName}, ${firstName}`, language: 'en' }],
subParameters: [dataParameter, rolesParameter, createTemplateUserInfo(membership.userId)],
}),
id: membership.id,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Couldn't you just pass this to "defaultParameter" as well? Then you could just return the result instead of spreading it into a new object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't know if we really want the ID of a parameter settable. For now I intentionally kept it so that always a new ID is generated. I don't know if that makes sense though. It just felt wrong

// mapping to {role, userData[]} objects
let roleUsersMapping = await asyncMap(rolesWithMembers, async (role) => ({
role: role,
users: await asyncMap(role.members, async (member) => await getUserById(member.id)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems to be a bit redundant since the "members" in "role" contain pretty much all the information that is returned by "getUserById". "getRolesWithMembers is more of a "getRolesWithUsers" if we consider "members" to mean the roleMappings. One thing you might miss from "getUserById" return value might be the phone number but you could potentially add that to the data returned by "getRolesWithMembers" if you need it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, but since we want to retrieve all userInfo I think using getUserById makes sense. It certainly is a bit redundant but the user-fields returned from getRolesWithMembers are hardcoded whereas getUserById returns all columns of the table. We might think about returning all user-fields with getRolesWithMembers if it doesn't break some stuff.

displayName: [{ text: e.lastName + ', ' + e.firstName, language: 'en' }],
origin: 'external',
}),
id: roleUsers.role.name + e.id, // hardcoded ID for frontend consistency
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Couldn't you pass "id" to "defaultParameter" as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

currently ID is always overwritten by a new random uuid. As mentioned above I don't know if that makes sense.

origin: 'external',
subParameters,
}),
id: roleUsers.role.name, // hardcoded ID for frontend consistency
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See above.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

CLOUDRUN ACTIONS

✅ Successfully created Preview Deployment.

https://pr-724---ms-server-staging-c4f6qdpj7q-ew.a.run.app

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