Skip to content

Commit eb4bf72

Browse files
authored
Updated module.js
1 parent 15b64db commit eb4bf72

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

controller/module.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function showModule(req, res) {
2323

2424
async function addModule(req, res) {
2525
const { no, name, contents, hrsPerModule, cognitiveLevels } = req.body;
26-
const isTopicValid = await isEntityIdValid(Topic, Topic);
26+
const isTopicValid = await isEntityIdValid(contents, Topic);
2727
try {
2828
if (isTopicValid) {
2929
const newModule = await addNewModule(
@@ -33,11 +33,9 @@ async function addModule(req, res) {
3333
hrsPerModule,
3434
cognitiveLevels,
3535
);
36-
res.json({ res: `added module ${newModule.name}` });
37-
res.json({ res: `added module ${newModule.id}` });
36+
res.json({ res: `added module ${newModule.name} ${newModule.id}` });
3837
} else {
39-
res.status(400).json({ err: "Invalid name" });
40-
res.status(400).json({ err: "Invalid id" });
38+
res.status(400).json({ err: "Invalid name" , err: "Invalid id"});
4139
}
4240
} catch (error) {
4341
logger.error("Error while inserting", error);

0 commit comments

Comments
 (0)