const Healtharticle = require("../models/healtharticle");




exports.healtharticlecreate = async function (req, res ,next) {
		  try {
			  
				let healtharticlesave = new Healtharticle(
        {
            speciality: req.body.speciality,
            subject: req.body.subject,
			description: req.body.description,
			doctorid: req.body.doctorid,
        }
    );
	healtharticlesave.save(function (err) {
        if (err) {
            return next(err);
        }
		res.status(200).json({
              message:
                "Health Article Created successfully" ,
            });
      
    })
			
}
		  catch (err) {
			console.log(err)
		}
		  
		  
      
};	


exports.healtharticlelist = (req, res, next) => {
	Healtharticle.find({doctorid: req.body.doctorid,})
    .then((healtharticle) => {
      res.status(200).json({healtharticlelist:healtharticle});
    })
    .catch((err) => {
      console.log(err);
    });

};
exports.healtharticleuserlist = (req, res, next) => {
	Healtharticle.find({})
    .then((healtharticle) => {
      res.status(200).json({healtharticlelist:healtharticle});
    })
    .catch((err) => {
      console.log(err);
    });

};