feat: Add and test the finance and task api routes

This commit is contained in:
2025-02-22 22:47:37 +05:30
parent 4897c53259
commit 0a43591739
8 changed files with 2724 additions and 41 deletions
+15 -15
View File
@@ -1,24 +1,24 @@
import express from "express";
import {
createFinanceRecord,
getFinanceRecords,
getFinanceById,
updateFinance,
deleteFinance,
const express = require("express");
const {
addTransaction,
} from "../controllers/financeController.js";
import { checkAuthenticated } from "../Middlewares/authentication.js";
createFinance,
getFinanceByFarm,
deleteTransaction,
getTransactions,
getFinancialSummary,
} = require("../Controllers/finance.controller.js");
const { checkAuthenticated } = require("../Middlewares/authentication.js");
const router = express.Router();
// Routes for finance management
router.post("/", checkAuthenticated, createFinanceRecord); // Create a new finance record
router.get("/", checkAuthenticated, getFinanceRecords); // Get all finance records
router.get("/:financeId", checkAuthenticated, getFinanceById); // Get a finance record by ID
router.put("/:financeId", checkAuthenticated, updateFinance); // Update finance record
router.delete("/:financeId", checkAuthenticated, deleteFinance); // Delete a finance record
router.post("/", checkAuthenticated, createFinance); // Create a new finance record
router.get("/:farmId", checkAuthenticated, getFinanceByFarm); // Get all finance records
router.get("/transactions/:financeId", checkAuthenticated, getTransactions); // Get a finance record by ID
router.get("/summary/:financeId", checkAuthenticated, getFinancialSummary); //
router.delete("/:financeId", checkAuthenticated, deleteTransaction); // Delete a finance record
// Add transactions (Expense/Revenue) to a finance record
router.post("/:financeId/transaction", checkAuthenticated, addTransaction);
export default router;
module.exports = router;