Party name and quality
1. Isme jo hai el lot number generate hoga low number hmesha jo current
month hai uske 3 charracter then after it s in serires of 1,2,3 make sure lot
number is unique to make sure it entry in db
2. Entry wali files main jo party name “ http://localhost:4000/api/entries" is api
ki entry main jitne party name aae hai vhii show honge or in party k andar jo
quality hai vo show hongi
3. Isem ye hoga jaise ki quality select ki to is quality k andr jitne challan no. hai
vo sare show ho jaenge
4.
Party name ,challan number,quality,kg,meter,roll,shade , process take this data
from form and save it entry in db , make all curd operation controller for and user
can select multiple quality and enter their kg meter role, user can enter multiple
entry under a single lot number
now create files schema ,controller and routed for process , full, half , finish
app.js -->config-->controller--> models -->routes
Party And Quality API
Below is a well-defined document for all party and quality
APIs that you can hit in Postman:
Party APIs
Create Party
- Method: POST
- URL: http://localhost:3000/api/party
- Request Body:
json
{
"name": "Party Name",
"location": "Location",
"date": "YYYY-MM-DD"
}
- Description: Create a new party by providing its name, location, and date.
Get All Parties
- Method: GET
- URL: http://localhost:3000/api/party
- Description: Retrieve details of all parties available in the system.
Get Party by ID
- Method: GET
- URL: http://localhost:3000/api/party/:partyId
- Description: Replace :partyId with the ID of the party you want to retrieve
details for.
Update Party
- Method: PUT
- URL: http://localhost:3000/api/party/:partyId
- Request Body:
json
{
"name": "New Party Name",
"location": "New Location",
"date": "New Date"
}
- Description: Replace :partyId with the ID of the party you want to update,
and provide the updated details in the request body.
Delete Party
- Method: DELETE
- URL: http://localhost:3000/api/party/:partyId
- Description: Replace :partyId with the ID of the party you want to delete.
Quality APIs
Get All Qualities of a Party
- Method: GET
- URL: http://localhost:3000/api/party/:partyId/qualities
- Description: Replace :partyId with the ID of the party to get all qualities
associated with that party.
Update Quality of a Party
- Method: PUT
- URL: http://localhost:3000/api/party/:partyId/qualities/:qualityId
- Request Body:
json
{
"newQuality": "New Quality Name"
}
- Description: Replace :partyId with the ID of the party, and :qualityId with
the ID of the quality you want to update. Provide the new quality name in the
request body.
Delete Quality of a Party
- Method: DELETE
- URL: http://localhost:3000/api/party/:partyId/qualities/:qualityId
- Description: Replace :partyId with the ID of the party, and :qualityId with
the ID of the quality you want to delete.
Account Form API
1. Create Entry
Method: POST
URL: http://localhost:5000/api/entries
Headers:
- Content-Type: application/json
Body (raw JSON):
json
{
"partyName": "Example Party",
"challanNumber": "CH123",
"qualities": [
{
"quality": "Quality A",
"kg": 100,
"meter": 200,
"roll": 2
},
{
"quality": "Quality B",
"kg": 150,
"meter": 250,
"roll": 3
}
]
}
2. Get All Entries
Method: GET
URL: http://localhost:5000/api/entries
Headers: None
3. Get Entry By ID
Method: GET
URL: http://localhost:5000/api/entries/:id
Replace :id with the actual entry ID.
Headers: None
4. Update Entry
Method: PUT
URL: http://localhost:5000/api/entries/:id
Replace :id with the actual entry ID.
Headers:
- Content-Type: application/json
Body (raw JSON):
json
{
"partyName": "Updated Party",
"challanNumber": "CH123",
"qualities": [
{
"quality": "Quality A",
"kg": 110,
"meter": 210,
"roll": 2
},
{
"quality": "Quality B",
"kg": 160,
"meter": 260,
"roll": 3
}
]
}
5. Delete Entry
Method: DELETE
URL: http://localhost:5000/api/entries/:id
Replace :id with the actual entry ID.
Headers: None
6. Get Qualities by Challan Number
Method: GET
URL: http://localhost:5000/api/entries/challan/:challanNumber
Replace :challanNumber with the actual challan number.
Headers: None
Step-by-Step Testing in Postman
1. Create Entry:
- Open Postman.
- Select POST method.
- Enter the URL http://localhost:5000/api/entries.
- Go to the Headers tab and add Content-Type: application/json.
- Go to the Body tab, select raw, and enter the JSON payload provided
above.
- Click Send.
2. Get All Entries:
- Select GET method.
- Enter the URL http://localhost:5000/api/entries.
- Click Send.
3. Get Entry By ID:
- Select GET method.
- Enter the URL http://localhost:5000/api/entries/:id (replace :id with a valid
entry ID).
- Click Send.
4. Update Entry:
- Select PUT method.
- Enter the URL http://localhost:5000/api/entries/:id (replace :id with a valid
entry ID).
- Go to the Headers tab and add Content-Type: application/json.
- Go to the Body tab, select raw, and enter the JSON payload provided
above.
- Click Send.
5. Delete Entry:
- Select DELETE method.
- Enter the URL http://localhost:5000/api/entries/:id (replace :id with a valid
entry ID).
- Click Send.
6. Get Qualities by Challan Number:
- Select GET method.
- Enter the URL http://localhost:5000/api/entries/challan/:challanNumber
(replace :challanNumber with a valid challan number).
- Click Send.
Grey Work