const admin = await Admin.findOne({ req.body.username }); if (!admin) { error("Admin doesn't exist"); } //split here? adminValidationDAO(); const isMatch = await bcrypt.compare(password, user.password); if(!isMatch){ error("Wrong password"); } //split here? passwordValidationDAO(); const email = new Email ({ text: req.body.text, title: req.body.title, }); const response = await email.save(); //split here? saveResponseDAO()? I am not even sure if the second one should be in a DAO layer, because bcrypt is not making any database call. This is why it's so frustrating. I am not sure how to split up my controller actions. Also, can we really call it a DAO layer if we use Mongoose functions?
Submitted November 16, 2019 at 09:27PM by jesusscript
No comments:
Post a Comment