// import express from 'express';

// import {
//     createInvoice,
//     getInvoices,
//     getInvoiceById,
//     updateInvoice,
//     deleteInvoice
// } from '../controller/invoiceController.js';
// import { singleUpload, uploadErrorHandler } from '../middleware/uploadMiddleware.js';

// const router = express.Router();

// router.post('/create', singleUpload, uploadErrorHandler, createInvoice);
// // router.patch('/create', singleUpload, uploadErrorHandler, createInvoice);
// router.get('/all', getInvoices);
// router.get('/:id', getInvoiceById);
// router.put('/update/:id', updateInvoice);
// router.delete('/delete/:id', deleteInvoice);


// export default router;

import express from 'express';

import {
    createInvoice,
    getInvoices,
    getInvoiceById,
    updateInvoice,
    deleteInvoice
} from '../controller/invoiceController.js';

import {
    singleUpload,
    uploadErrorHandler
} from '../middleware/uploadMiddleware.js';
import {getClientList} from "../controller/invoiceController.js"

const router = express.Router();

router.post(
    '/create',
    singleUpload,
    uploadErrorHandler,
    createInvoice
);

router.get('/all', getInvoices); //done
router.get('/list', getClientList);

router.get('/:id', getInvoiceById); //done

router.put(
    '/update/:id',
    singleUpload,
    uploadErrorHandler,
    updateInvoice
); //done

router.delete('/delete/:id', deleteInvoice); //done


export default router;