import  Fees from '../models/Fees.js'

export const createFees = async(req,res) => {
    try{
   const fees = await Fees.create(req.body);
   res.status(201).json(fees);
    }catch(error){
  res.status(500).json({message:error.message});
    }
};

export const getFees = async(req,res) => {
    try{
        const fees = await Fees.find();
        res.status(200).json(fees);
    }catch(error){
        res.status(500).json({message:error.message});
    }
};

export const updateFees = async(req,res) => {
    try{
        const fees = await Fees.findByIdAndUpdate(req.body);
        res.status(200).json(fees);
    }catch(error){
        res.status(500).json({message:error.message});
    }
};
export const deleteFees = async (req,res) => {
    try{
    const fees = await Fees.findByIdAndDelete(req.params.id);
    res.status(200).json({message:"fee deleted succussfully"});
    }catch(error){
  res.status(500).json({message:error.message});
    }
};