Steps to run this project:
- Run
npm i
command - Setup database settings inside
ormconfig.json
file - Run
npm run dev
command to run in development
https://dbdiagram.io/d/5fa67c4c3a78976d7b7ae7ac
{
success: true | undefined,
error: true | undefined,
message: 'Message regarding error' | undefined,
data: 'Data if success is true' | undefined,
errStack: 'Conditional Errors if error is true' | undefined
}
The whole API is divided into resources, and each resource has some CRUD api endpoints, with identical request and response formats.
They are:
- /list
- /readOne
- /updateOne
- /deleteOne
- /create
- /readMany (Unavailable in some)
For requesting a list of items, the request should be of POST
method with a filters
object
filters: {
pagination: {
page: <PAGE NUMBER>,
limit: <NUMBER OF ITEMS PER PAGE>
},
sort: {
field: <FIELD YOU WANT TO SORT>,
order: 'ASC' | 'DESC'
}
}
For example:
filters: {
pagination: { page: 1 , limit: 10 },
sort: { field: 'created_at', order: 'ASC' }
}
For requesting a particular item, the request should be of POST
method with the id
of the object
{
"id": 3 // ID of the object
}
For updating a particular item, the request should be of POST
method
You need to send three fields in the JSON request
id
: ID of the Itemfield
: Field of the item you want to update (Get the field from Schema Diagram)new_value
: New value of the field
{
"id": 3, // ID of the object
"field": "name",
"new_value": "John Doe"
}
You need to send two fields in the JSON request
id
: ID of the Itemdata
: The whole item with the updated values
{
"id": 3, // ID of the object
"data": {
"name": "John Doe"
}
}
For deleting a particular item, the request should be of POST
method with the id
of the object
{
"id": 3 // ID of the object
}
For creating a particular item, the request should be of POST
method with the values and fields as key names in the JSON request. You can get the field names from the Schema Diagram for a resource.
{
"name": "John Doe",
"address": "California, USA"
}
For requesting a list of particular items, the request should be of POST
method with an array id
of the objects
{
"ids": [1, 4, 8] // ID of the object
}
- collectionCentre
- dehydrationLocation
- dehydrationMaterialPayment
- dehydrationMaterialRecieved
- dehydrationMaterialRequired
- feAssignedVillages
- fieldExecutive
- marketInformation
- marketInformationGradewise
- me
- meFgCollectionDispatch
- meOperations
- prmWarehouseDelivery
- procuredRawMaterials
- rawMaterials
- rmDistribution
- rmFieldDelivery
- usersWarehouses
- villages
- warehouseRawMaterials
- warehouseRawMaterialsDispatch
- warehouseRawMaterialsProcessing
- taskForceMaterialRecievedCC
- taskForceMaterialRecievedTrader
- taskForceMaterialSentDehydration
- taskForceMaterialSentFreshB2B
- taskForcePaymentMadeCC
- taskForcePaymentMadeTrader
- collectionCentreSorting
- collectionCentreHarvestingTeam
- b2bMaterialPayment
- b2bMaterialRecieved
- collectionCentreMaterial