Added Salvi's backend folder from backend branch to allow ombase to continue testing.

This commit is contained in:
K
2025-02-23 09:05:16 +05:30
parent 3f9e6d3dee
commit 7da2809399
28 changed files with 6979 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
const express = require("express");
const {
createCrop,
getCropsByFarm,
getCropById,
updateCrop,
deleteCrop,
updateHealthStatus,
updateGrowthStage,
cropSuggest,
} = require("../Controllers/crop.controller.js");
const { checkAuthenticated } = require("../Middlewares/authentication.js");
const upload = require("../Middlewares/multer.js");
const router = express.Router();
// Routes for crop management
router.post("/", checkAuthenticated, upload.single("image"), createCrop); // Create a new crop
router.get("/farm/:farmId", checkAuthenticated, getCropsByFarm); // Get all crops
router.get("/:cropId", checkAuthenticated, getCropById); // Get a crop by ID
router.put("/:cropId", checkAuthenticated, updateCrop); // Update crop details
router.delete("/:cropId", checkAuthenticated, deleteCrop); // Delete a crop
router.put("/health/:cropId", checkAuthenticated, updateHealthStatus);
router.put("/growth/:cropId", checkAuthenticated, updateGrowthStage);
router.get("/suggest/:cropId", checkAuthenticated, cropSuggest);
module.exports = router;