import express from 'express';

import {
    createExpense,
    getExpenses,
    getExpenseById,
    updateExpense,
    deleteExpense,
    getExpenseStats,
    getExpenseTrends
} from '../controller/expenseController.js';

import {
   receiptUpload,
   uploadErrorHandler
} from '../middleware/expenseUploadMiddleware.js';

const router = express.Router();

router.post('/create', receiptUpload,uploadErrorHandler, createExpense
); //done
router.get('/all',getExpenses); //done
router.get( '/stats', getExpenseStats)
router.get( '/trends', getExpenseTrends)
router.get( '/:id', getExpenseById);

router.put('/update/:id',receiptUpload,uploadErrorHandler,updateExpense);
router.delete('/delete/:id',deleteExpense);


export default router;
