From 8f5cbd2ea4dd6b34f3f53122466a7367b3c0ddb1 Mon Sep 17 00:00:00 2001 From: Khalid Khurshid Siddiqui Date: Mon, 5 Aug 2024 11:12:55 +0000 Subject: [PATCH] improved create functionality by putting checks on description and published columns respectively --- app/controllers/tutorial.controller.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/controllers/tutorial.controller.js b/app/controllers/tutorial.controller.js index 15d0f99..e5ca2be 100644 --- a/app/controllers/tutorial.controller.js +++ b/app/controllers/tutorial.controller.js @@ -11,6 +11,18 @@ exports.create = (req, res) => { }); return; } + else if(!req.body.description) { + res.status(400).send({ + message: "Description should not be empty" + }); + return; + } + else if(!req.body.published){ + res.status(400).send({ + message: "published should not be empty" + }); + return; + } // Create a Tutorial const tutorial = {