Role
INFO
Every response arrives in the shared envelope — code, message, messages, status_code, time — with the payload in data. The tables below describe what is inside data.
POST /role/create
Create a role with its permission access map.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Role name |
access | object | Yes | permission map: key → access degree (a|s|r|d) |
web_access | object | No | permission map for the web back-office surface |
mobile_access | object | No | permission map for the mobile/POS surface |
json
{
"name": "string",
"access": {},
"web_access": {},
"mobile_access": {}
}Response
| Field | Type | Description |
|---|---|---|
_id | string | |
name | string | |
web | boolean | |
mobile | boolean |
json
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": {
"_id": "string",
"name": "string",
"web": false,
"mobile": false
},
"time": "2025-05-01T12:00:00Z"
}PUT /role/update
Update an existing role and its permission access map.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Role name |
access | object | Yes | permission map: key → access degree (a|s|r|d) |
web_access | object | No | permission map for the web back-office surface |
mobile_access | object | No | permission map for the mobile/POS surface |
_id | string | Yes |
json
{
"name": "string",
"access": {},
"web_access": {},
"mobile_access": {},
"_id": "string"
}Response
Same response shape as POST /role/create.
DELETE /role/delete/{id}
Delete a role
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Request body
No request body.
Response
json
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": "ok",
"time": "2025-05-01T12:00:00Z"
}GET /role/get-by-id/{id}
Get role using its _id
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Request body
No request body.
Response
Same response shape as POST /role/create.
POST /role/get-paging
Get roles by paging
Request body
| Field | Type | Required | Description |
|---|---|---|---|
page | number | Yes | Default: 1 |
limit | number | Yes | Default: 20 |
search | string | No | |
nin | string[] | No |
json
{
"page": 1,
"limit": 20,
"search": "string",
"nin": [
"63f8b0c4e4b0d3a2f8e4b0c4"
]
}Response
data.total is the total number of records and data.data[] holds the current page. The table below describes one record.
| Field | Type | Description |
|---|---|---|
_id | string | |
name | string | |
web | boolean | |
mobile | boolean |
json
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": {
"total": 0,
"data": [
{
"_id": "string",
"name": "string",
"web": false,
"mobile": false
}
]
},
"time": "2025-05-01T12:00:00Z"
}This page is generated from the OpenAPI spec.