Surya:route changes
This commit is contained in:
parent
c813d840a5
commit
70d83f3603
@ -8,7 +8,7 @@ const { logMsg } = require('../services/logger.js');
|
||||
|
||||
//statementmaster
|
||||
|
||||
// Retrieve all statementmaster from the database.
|
||||
// Retrieve all statements from the database.
|
||||
exports.StatmentList = (req, res) => {
|
||||
|
||||
Statementsmaster.findAll({where : { is_active : 1 } })
|
||||
@ -18,7 +18,7 @@ exports.StatmentList = (req, res) => {
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while retrieving tutorials." ,'data': "No data" });
|
||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||
});
|
||||
};
|
||||
|
||||
@ -34,35 +34,16 @@ exports.Insertstatement = (req, res) => {
|
||||
|
||||
// Save Tutorial in the database
|
||||
Statementsmaster.create(statement)
|
||||
.then(data => {
|
||||
res.send(data);
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message:
|
||||
err.message || "Some error occurred while creating the statement."
|
||||
});
|
||||
});
|
||||
.then(data => {
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while insertinging statements." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
// Post a statement
|
||||
// insert datas into statementmaster table.
|
||||
// exports.Insertstatement = (req, res) => {
|
||||
|
||||
// Statementsmaster.create({
|
||||
// statement: req.body.statement,
|
||||
// is_active: req.body.is_active,
|
||||
// createdby: req.body.createdby,
|
||||
// updatedby: req.body.updatedby,
|
||||
// })
|
||||
// .then(data => {
|
||||
// res.send({'status':200,'message':"success",'data':data});
|
||||
// logMsg.info("Success :"(data));
|
||||
// })
|
||||
// .catch(err => {
|
||||
// res.status(500).send({'status':404,
|
||||
// message: err.message || "Some error occurred while retrieving tutorials." ,'data': "No data" });
|
||||
// });
|
||||
// };
|
||||
|
||||
// updates datas into statementmaster table.
|
||||
exports.Updatestatement = (req, res) => {
|
||||
@ -73,19 +54,18 @@ exports.Updatestatement = (req, res) => {
|
||||
})
|
||||
.then(num => {
|
||||
if (num == 1) {
|
||||
res.send({
|
||||
message: "statement was updated successfully."
|
||||
});
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
} else {
|
||||
res.send({
|
||||
message: `Cannot update statement with id=${id}. Maybe statement was not found or req.body is empty!`
|
||||
message: `Cannot update statement with id= ${id}. Maybe statement was not found or req.body is empty!`
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message: "Error updating statement with id=" + id
|
||||
});
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@ -98,9 +78,8 @@ exports.Deletestatement = (req, res) => {
|
||||
})
|
||||
.then(num => {
|
||||
if (num == 1) {
|
||||
res.send({
|
||||
message: "statement was deleted successfully!"
|
||||
});
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
} else {
|
||||
res.send({
|
||||
message: `Cannot delete statement with id=${id}. Maybe statement was not found!`
|
||||
@ -108,9 +87,9 @@ exports.Deletestatement = (req, res) => {
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message: "Could not delete statement with id=" + id
|
||||
});
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while Deletiing statements." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@ -143,15 +122,15 @@ exports.Insertsection = (req, res) => {
|
||||
|
||||
// Save section in the database
|
||||
Sectionsmaster.create(section)
|
||||
.then(data => {
|
||||
res.send(data);
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message:
|
||||
err.message || "Some error occurred while creating the section."
|
||||
});
|
||||
});
|
||||
.then(data => {
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while insertinging sectino." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.Updatesection = (req, res) => {
|
||||
@ -162,9 +141,8 @@ exports.Updatesection = (req, res) => {
|
||||
})
|
||||
.then(num => {
|
||||
if (num == 1) {
|
||||
res.send({
|
||||
message: "section was updated successfully."
|
||||
});
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
} else {
|
||||
res.send({
|
||||
message: `Cannot update section with id=${id}. Maybe section was not found or req.body is empty!`
|
||||
@ -172,9 +150,9 @@ exports.Updatesection = (req, res) => {
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message: "Error updating section with id=" + id
|
||||
});
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while updating sectinos." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@ -187,9 +165,8 @@ exports.Deletesection = (req, res) => {
|
||||
})
|
||||
.then(num => {
|
||||
if (num == 1) {
|
||||
res.send({
|
||||
message: "section was deleted successfully!"
|
||||
});
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
} else {
|
||||
res.send({
|
||||
message: `Cannot delete section with id=${id}. Maybe section was not found!`
|
||||
@ -197,9 +174,9 @@ exports.Deletesection = (req, res) => {
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message: "Could not delete section with id=" + id
|
||||
});
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while Deleting statements." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@ -233,15 +210,15 @@ exports.Insertsubsection = (req, res) => {
|
||||
|
||||
// Save Tutorial in the database
|
||||
Subsectionsmaster.create(subsection)
|
||||
.then(data => {
|
||||
res.send(data);
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message:
|
||||
err.message || "Some error occurred while creating the subsection."
|
||||
});
|
||||
});
|
||||
.then(data => {
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while insertinging subsection." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.Updatesubsection = (req, res) => {
|
||||
@ -252,9 +229,8 @@ exports.Updatesubsection = (req, res) => {
|
||||
})
|
||||
.then(num => {
|
||||
if (num == 1) {
|
||||
res.send({
|
||||
message: "subsection was updated successfully."
|
||||
});
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
} else {
|
||||
res.send({
|
||||
message: `Cannot update subsection with id=${id}. Maybe subsection was not found or req.body is empty!`
|
||||
@ -262,9 +238,9 @@ exports.Updatesubsection = (req, res) => {
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message: "Error updating subsection with id=" + id
|
||||
});
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@ -277,9 +253,8 @@ exports.Deletesubsection = (req, res) => {
|
||||
})
|
||||
.then(num => {
|
||||
if (num == 1) {
|
||||
res.send({
|
||||
message: "subsection was deleted successfully!"
|
||||
});
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
} else {
|
||||
res.send({
|
||||
message: `Cannot delete subsection with id=${id}. Maybe subsection was not found!`
|
||||
@ -287,9 +262,9 @@ exports.Deletesubsection = (req, res) => {
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message: "Could not delete subsection with id=" + id
|
||||
});
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@ -328,15 +303,15 @@ exports.Insertitem = (req, res) => {
|
||||
|
||||
// Save Tutorial in the database
|
||||
Itemsmaster.create(item)
|
||||
.then(data => {
|
||||
res.send(data);
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message:
|
||||
err.message || "Some error occurred while creating the item."
|
||||
});
|
||||
});
|
||||
.then(data => {
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while insertinging items." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.Updateitem = (req, res) => {
|
||||
@ -347,9 +322,8 @@ exports.Updateitem = (req, res) => {
|
||||
})
|
||||
.then(num => {
|
||||
if (num == 1) {
|
||||
res.send({
|
||||
message: "item was updated successfully."
|
||||
});
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
} else {
|
||||
res.send({
|
||||
message: `Cannot update item with id=${id}. Maybe item was not found or req.body is empty!`
|
||||
@ -357,9 +331,9 @@ exports.Updateitem = (req, res) => {
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message: "Error updating item with id=" + id
|
||||
});
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@ -372,9 +346,8 @@ exports.Deleteitem = (req, res) => {
|
||||
})
|
||||
.then(num => {
|
||||
if (num == 1) {
|
||||
res.send({
|
||||
message: "item was deleted successfully!"
|
||||
});
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
logMsg.info("Success :"(data));
|
||||
} else {
|
||||
res.send({
|
||||
message: `Cannot delete item with id=${id}. Maybe statement was not found!`
|
||||
@ -382,9 +355,9 @@ exports.Deleteitem = (req, res) => {
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({
|
||||
message: "Could not delete item with id=" + id
|
||||
});
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
modelName: 'Brokenperiods',
|
||||
createdAt: 'createdon',
|
||||
updatedAt: 'updatedon',
|
||||
|
||||
}
|
||||
)
|
||||
return Brokenperiods
|
||||
|
||||
@ -25,7 +25,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
biz_act_desc: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
|
||||
@ -5,7 +5,7 @@ module.exports = app => {
|
||||
var router = require("express").Router();
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @openapi
|
||||
* /api/EntitiesList:
|
||||
* get:
|
||||
@ -25,24 +25,173 @@ module.exports = app => {
|
||||
|
||||
//master.controller api's
|
||||
// get statment master data
|
||||
/**
|
||||
* @openapi
|
||||
* /api/StatementsList:
|
||||
* get:
|
||||
* description: This is List api statement!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.get("/StatementsList", master.StatmentList);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Insertstatement:
|
||||
* get:
|
||||
* description: This is Insert api statement!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.post("/Insertstatement", master.Insertstatement);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Updatestatement/:id:
|
||||
* get:
|
||||
* description: This is update api statement!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.put("/Updatestatement/:id", master.Updatestatement);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Deletestatement/:id:
|
||||
* get:
|
||||
* description: This is Delete api statement!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.put("/Deletestatement/:id", master.Deletestatement);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* /api/SectionList:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
|
||||
router.get("/SectionList", master.SectionList);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Insertsection:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.post("/Insertsection", master.Insertsection);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Updatesection/:id:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.put("/Updatesection/:id", master.Updatesection);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Deletesection/:id:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.put("/Deletesection/:id", master.Deletesection);
|
||||
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* /api/SubsectionList:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.get("/SubsectionList", master.SubsectionList);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Insertsubsection:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.post("/Insertsubsection", master.Insertsubsection);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Updatesubsection/:id:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.put("/Updatesubsection/:id", master.Updatesubsection);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Deletesubsection/:id:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.put("/Deletesubsection/:id", master.Deletesubsection);
|
||||
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* /api/ItemList:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.get("/ItemList", master.ItemList);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Insertitem:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.post("/Insertitem", master.Insertitem);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Updateitem/:id:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.put("/Updateitem/:id", master.Updateitem);
|
||||
/**
|
||||
* @openapi
|
||||
* /api/Deleteitem/:id:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.put("/Deleteitem/:id", master.Deleteitem);
|
||||
|
||||
//sample
|
||||
|
||||
Loading…
Reference in New Issue
Block a user