Skip to content

Abhinav kitchen inventory management planting trimming culling events#2109

Open
abhinav-TB wants to merge 4 commits intodevelopmentfrom
Abhinav-Kitchen-Inventory-Management-planting-trimming-culling-events
Open

Abhinav kitchen inventory management planting trimming culling events#2109
abhinav-TB wants to merge 4 commits intodevelopmentfrom
Abhinav-Kitchen-Inventory-Management-planting-trimming-culling-events

Conversation

@abhinav-TB
Copy link
Copy Markdown
Member

Description

image

Related PRS (if any):

This is a backend-only PR

Main changes explained:

  • Create src/models/transplantingEvent.js for introducing the transplanting event model (includes name, related_to, date, position_from, position_to).
  • Create src/models/harvestingEvent.js for introducing the harvesting event model (includes name, related_to, type, expected_date, yield).
  • Create src/controllers/transplantingController.js and src/routes/transplantingRouter.js to handle POST and GET requests for transplanting events.
  • Create src/controllers/harvestingController.js and src/routes/harvestingRouter.js to handle POST and GET requests for harvesting events, including an optional type filter query parameter.
  • Update src/startup/routes.js to register the new models and route definitions under the /api/kitchenandinventory path.

How to test:

  1. check into current branch Abhinav-Kitchen-Inventory-Management-Create-database-models-and-backend-API-endpoints-for-transplanting-and-harvesting-events
  2. do npm install and npm run dev to run this PR locally
  3. Open Postman or a similar API client.
  4. Log in as an admin user via the POST /api/login endpoint to obtain a JWT authentication token.
  5. Set the Authorization header to your JWT token.
  6. verify function "Create Transplanting Event" by sending a POST request to http://localhost:4500/api/kitchenandinventory/transplanting with a JSON body:
    {
      "name": "Tomato Transplant",
      "related_to": "Garden",
      "date": "2026-03-20",
      "position_from": "Greenhouse Bed A",
      "position_to": "Garden Plot 3"
    }

(Verify a 201 Created response).

  1. verify function "Get Transplanting Events" by sending a GET request to http://localhost:4500/api/kitchenandinventory/transplanting and ensuring the created event appears.

  2. verify function "Create Harvesting Event" by sending a POST request to http://localhost:4500/api/kitchenandinventory/harvesting with a JSON body:

json
{
"name": "Apple Harvest",
"related_to": "Orchard",
"type": "orchard harvesting",
"expected_date": "2026-09-15",
"yield": 150
}
verify function "Get Harvesting Events by Type" by sending a GET request to http://localhost:4500/api/kitchenandinventory/harvesting?type=orchard%20harvesting and verifying the data is filtered correctly.

Screenshots or videos of changes:

Screen.Recording.2026-03-14.at.11.38.58.AM.mov

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants