TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/TheSerchCp/SEAM-API/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/v1/sidebar/:idItem/role/:idRole endpoint creates an entry in the roleXItem pivot table, linking a sidebar navigation item to a role. Once assigned, every user whose roleId matches the given role will have that item included in the sidebarItems array returned in their login response. The endpoint validates that both the item and the role exist before inserting the assignment, and returns a conflict error if the same pair is already linked.
Authentication
Requires a valid JWT in theAuthorization header. The authenticated user’s role must also have the permission POST /api/v1/sidebar/:idItem/role/:idRole registered in the permissions table and assigned via permissionXRole.
Request
Method:POSTPath:
/api/v1/sidebar/:idItem/role/:idRole
This endpoint accepts no request body — all inputs are provided as path parameters.
Path Parameters
Numeric ID of the sidebar item to assign. Must match
^\d+$. The item must already exist in the sidebarItems table. Use POST /api/v1/sidebar to create the item first if needed.Numeric ID of the role to assign the item to. Must match
^\d+$. The role must already exist in the roles table.Response
201 — Created
The item was successfully assigned to the role. The response data includes the IDs and names of both the role and the item for confirmation.Always
true for successful responses.Human-readable confirmation:
"Item asignado al rol exitosamente".Confirmation object describing the assignment that was created.
ID of the role the item was assigned to.
ID of the sidebar item that was assigned.
Display name of the role sourced from the
roles table (e.g. "Manager").Display label of the sidebar item sourced from the
sidebarItems table (e.g. "Reports").400 — Bad Request
Returned when either path parameter is not a valid numeric string.401 — Unauthorized
Returned when theAuthorization header is missing or the token is invalid/expired.
403 — Forbidden
Returned when the authenticated user’s role does not have thePOST /api/v1/sidebar/:idItem/role/:idRole permission.
404 — Not Found
Returned when either the specified role or the specified sidebar item does not exist. Each is validated independently byfindRoleById and findItemById before the assignment is created.
409 — Conflict
Returned when the item is already assigned to the specified role. TheroleXItem table is checked via SELECT 1 FROM roleXItem WHERE roleId = ? AND itemId = ? before insertion to prevent duplicates.
Example
Once an item is assigned to a role, all users with that role will see it in their sidebar. The updated item list is reflected at the user’s next login in the
sidebarItems field of the POST /api/v1/auth/login response.Full Workflow
Follow these steps to create a sidebar item and make it visible to users of a specific role:Create the sidebar item
Call
POST /api/v1/sidebar with the item’s name, optional icon, and optional route. Note the idItem returned in the response — you will need it in step 2.Assign the item to the role
Call
POST /api/v1/sidebar/:idItem/role/:idRole using the idItem from step 1 and the idRole of the target role. No request body is needed.Real-time Events
This endpoint emits Socket.IO events throughout the assignment lifecycle:| Event | Stage | Description |
|---|---|---|
sidebar:assign | start | Assignment process initiated |
sidebar:assign | processing | Validating role and item existence |
sidebar:assign | success | Assignment created, payload includes role name and item name |