Fetch Users
Retrieve user records by providing a list of user IDs.
This function internally queries the database using Sequelize dataModel.findAll().
Usage
const usersData = await fetchUsers(payload);Payload Structure
The payload object must contain a list of user IDs:
{
usersList: [1, 3, 5] // Array of user IDs
}Parameter Details
usersList (Required)
An array of numeric user IDs to retrieve.
usersList: [1, 3, 5]Return Value
Returns a list of user records from the database.
Sample Output
[
{
columnName1: "columnValue1",
columnName2: "columnValue2",
columnName3: "columnValue3"
},
{
columnName1: "columnValue1",
columnName2: "columnValue2",
columnName3: "columnValue3"
}
]Example Implementation
async function customizeERP(userData, apiOperations) {
return new Promise(async (resolve, reject) => {
const payload = {
usersList: userData.usersList
};
const rowsData = await fetchUsers(payload);
if (rowsData) {
resolve({ result: rowsData });
} else {
resolve({
result: {},
popupMsg: {
type: "error",
message: "Could Not read data! Please try again later"
}
});
}
});
}Example Input
{
"usersList": [1]
}Example Output
{
"response": {
"__d3__result": {
"result": [
{
"id": 1,
"userID": 1,
"emailID": "johnDoe@gmail.com",
"role": ["Admin"],
"ITStakeholder": ["ITAdmin"],
"erpRole": ["Admin"],
"firstName": "joh",
"lastName": "doe",
"phone": "(+011) 9999999999",
"addedByUserID": null,
"addedByEmailID": null,
"userInfo": {
"manager": [],
"coach": [],
"subordinates": [[2, 3]],
"coachees": [[2, 3]]
},
"manager": null,
"coach": null,
"__d3__createdAt": "2025-04-19T10:45:47.057Z",
"__d3__updatedAt": "2025-05-24T16:19:11.541Z",
"__d3__deletedAt": null
}
]
},
"__d3__error": false,
"printConsole": []
}
}