ERP Customization Guide
API Operations
Create API
Below is a sample implementation of a customized Create API in Supista ERP:
async function customizeERP(userData, apiOperations) {
// Your Code Starts Here
const tableName = "Your Table Name";
const { createOp } = apiOperations;
return new Promise(async (resolve, reject) => {
const payload = {
"__d3__newData": {}
}
const createdData = await createOp(tableName, payload);
resolve(createdData);
})
}
The Output structure should be this:
{
"result": {
"id": 12,
"columnName1": "newValue1",
"columnName2": "newValue2"
}
}
Read API
Below is a sample implementation of a customized Read API in Supista ERP:
async function customizeERP(userData, apiOperations) {
// Your Code Starts Here
const tableName = "Your Table Name";
const { readOp } = apiOperations;
return new Promise(async (resolve, reject) => {
const payload = {
_d3_filterdata: {
where: {}
}
}
const rowsData = await readOp(tableName, payload);
resolve(rowsData);
})
}
The Output structure should be this:
{
"result": {
"count": 2,
"rows": [
{
"columnName1": "newValue1",
"columnName2": "newValue2"
},
{
"columnName1": "newValue1",
"columnName2": "newValue2"
}
]
}
}
Update API
Below is a sample implementation of a customized Update API in Supista ERP:
async function customizeERP(userData, apiOperations) {
// Your Code Starts Here
const tableName = "Your Table Name";
const { updateOp } = apiOperations;
return new Promise(async (resolve, reject) => {
const payload = {
"__d3__newData": {},
"__d3__id": 12
}
const updatedData = await updateOp(tableName, payload);
resolve(updatedData);
})
}
The Output structure should be this:
{
"result": {
"affectedCount": [1]
}
}
Delete API
Below is a sample implementation of a customized Delete API in Supista ERP:
async function customizeERP(userData, apiOperations) {
// Your Code Starts Here
const tableName = "Your Table Name";
const { removeOp } = apiOperations;
return new Promise(async (resolve, reject) => {
const payload = {
"__d3__id": [12]
}
const deletedData = await removeOp(tableName, payload);
resolve(deletedData);
})
}
The Output structure should be this:
{
"result": {
"deletedObjNo": 22
}
}