const express = require('express');
const router = express.Router();
const upload = require('../config/multer'); // Import multer config
const {
    createPost,
    getPosts,
    getPostById,
    updatePost,
    deletePost
} = require('../controllers/cafePostController'); // Import your controllers

// Route to handle item creation with image upload
router.post('/', upload.single('image'), createPost);

// Route to get all posts
router.get('/', getPosts);

// Route to get a post by ID
router.get('/:id', getPostById);

// Route to update a post by ID
router.put('/:id', upload.single('image'), updatePost);

// Route to delete a post by ID
router.delete('/:id', deletePost);

module.exports = router;
