const db = require('../ConnectionDb'); // Import your database module

const Faculty = require('../models/Faculty'); // Your Mongoose model for faculty

exports.getFaculties = async (req, res) => {
  try {
    const faculties = await Faculty.find(); // Fetch all faculty documents from the 'faculties' collection
    res.status(200).json(faculties);
  } catch (error) {
    console.error("Error fetching faculties:", error.message);
    res.status(500).json({ error: "Failed to fetch faculties" });
  }
};
