feat:Create and Test user,crop,farm
This commit is contained in:
@@ -1,20 +1,25 @@
|
||||
import express from "express";
|
||||
import {
|
||||
const express = require("express");
|
||||
const {
|
||||
createCrop,
|
||||
getCrops,
|
||||
getCropsByFarm,
|
||||
getCropById,
|
||||
updateCrop,
|
||||
deleteCrop,
|
||||
} from "../controllers/cropController.js";
|
||||
import { checkAuthenticated } from "../Middlewares/authentication.js";
|
||||
updateHealthStatus,
|
||||
updateGrowthStage,
|
||||
} = 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, createCrop); // Create a new crop
|
||||
router.get("/", checkAuthenticated, getCrops); // Get all crops
|
||||
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);
|
||||
|
||||
export default router;
|
||||
module.exports = router;
|
||||
|
||||
Reference in New Issue
Block a user