Surya:statement master crud apis & models changes
This commit is contained in:
commit
253c81a2c2
@ -8,19 +8,36 @@ const { logMsg } = require('../services/logger.js');
|
||||
|
||||
// menu list api
|
||||
exports.MenuList = async (req, res) => {
|
||||
|
||||
//findAll({ where :{is_active : 1} ,include : { association: 'sectionsmasterData' } });
|
||||
//findAll({ where :{is_active : 1} , include: { all: true, nested: true , where :{is_active : 1} }});
|
||||
try {
|
||||
const losid = req.params.losid
|
||||
//const MasterData = await Statementsmaster.findAll({include : 'sectionsmasterData'});
|
||||
let EntitiesData = await Entities.findAll({where : { losid } });
|
||||
|
||||
return res.send({'status':200,'message':"success",'data':EntitiesData});
|
||||
const MasterData = await Statementsmaster.findAll({
|
||||
where :{is_active : 1} ,
|
||||
include :[{
|
||||
association: 'sectionsmasterData' ,
|
||||
where :{is_active : 1} ,
|
||||
include :[{
|
||||
association: 'subsectionsmasterData' ,
|
||||
//where :{is_active : 1}
|
||||
}]
|
||||
}]
|
||||
});
|
||||
const EntitiesData = await Entities.findAll({where : { losid } });
|
||||
let data = [];
|
||||
EntitiesData.forEach((value, key)=>{
|
||||
obj_data = { ...value.dataValues , statementsmasterrData:MasterData}
|
||||
data.push(obj_data);
|
||||
});
|
||||
return res.send({'status':200,'message':"success",'data':data});
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
return res.status(500).json({'status':404,'message':"failed",'data':"No data"})
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Retrieve all Entities from the database.
|
||||
exports.findAllEntities = (req, res) => {
|
||||
|
||||
|
||||
@ -17,8 +17,13 @@ module.exports = (sequelize, DataTypes) => {
|
||||
}
|
||||
Statementsmaster.init(
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
statement: { type: DataTypes.STRING },
|
||||
is_active: { type: DataTypes.INTEGER },
|
||||
=======
|
||||
statement: { type: DataTypes.STRING },
|
||||
is_active: { type: DataTypes.INTEGER },
|
||||
>>>>>>> 58fe8288fbfafc85973b4d3718def076990ff1d2
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
|
||||
|
||||
@ -20,9 +20,9 @@ module.exports = (sequelize, DataTypes) => {
|
||||
Subsectionsmaster.init(
|
||||
{
|
||||
section: { type: DataTypes.INTEGER },
|
||||
subsection: { type: DataTypes.STRING },
|
||||
itemtext: { type: DataTypes.STRING },
|
||||
is_active: { type: DataTypes.INTEGER },
|
||||
subsection: { type: DataTypes.STRING },
|
||||
itemtext: { type: DataTypes.STRING },
|
||||
is_active: { type: DataTypes.INTEGER },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user