const express = require("express");
const multer = require('multer');
const { createBlog, getBlogs, updateBlog, deleteBlog, bulkUploadBlogs } = require("../controllers/blogController");
const { validateBlog } = require("../validations");

const router = express.Router();
const upload = multer({ dest: 'uploads/' });

// Ensure each route has a properly defined controller function
router.post("/", upload.single('coverImage'), validateBlog, createBlog);
router.post("/bulk-upload", upload.single('csvFile'), bulkUploadBlogs);
router.get("/", getBlogs);
router.put("/:id", updateBlog);
router.delete("/:id", deleteBlog);

module.exports = router;


