Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
3ddabb7f2e |
@ -7,156 +7,7 @@ var app = express();
|
||||
app.use(bodyparser.json());
|
||||
|
||||
|
||||
//ROLE START
|
||||
//POST ROLE ADD
|
||||
app.post('/addRole',async(req,res)=>{
|
||||
|
||||
const data=
|
||||
{
|
||||
name:req.body.rolename,
|
||||
status:req.body.status,
|
||||
createdBy:req.body.createdBy,
|
||||
createdAt:Date.now()
|
||||
}
|
||||
|
||||
await models.role.create(data).then(result=>{
|
||||
res.status(201).json({
|
||||
Code:"1",
|
||||
Message:"Role Created Successfully",
|
||||
Data: result
|
||||
});
|
||||
}).catch(error=>{
|
||||
res.status(500).json({
|
||||
Code:"0",
|
||||
Message:"Something went wrong",
|
||||
Post: error
|
||||
});
|
||||
})
|
||||
});
|
||||
//GET COMPANY LIST
|
||||
app.get('/roles',async(req,res)=>{
|
||||
await models.role.findAll({where:{status:1}}).then(result=>{
|
||||
res.status(201).json({
|
||||
Code:"1",
|
||||
Message:"Users List",
|
||||
Data: result
|
||||
});
|
||||
}).catch(error=>{
|
||||
res.status(500).json({
|
||||
Code:"0",
|
||||
Message:"No Data"
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
//PUT COMPANY VIEW
|
||||
app.put('/viewRole/(:roleid)',async(req,res)=>{
|
||||
await models.role.findByPk(req.params.roleid).then(result=>{
|
||||
res.status(201).json({
|
||||
Code:"1",
|
||||
Message:"Success",
|
||||
Data: result
|
||||
});
|
||||
}).catch(error=>{
|
||||
res.status(500).json({
|
||||
Code:"0",
|
||||
Message:"No Data"
|
||||
});
|
||||
})
|
||||
});
|
||||
///PUT COMPANY - UPDATE
|
||||
app.put('/updateRole/(:roleid)',async(req,res)=>{
|
||||
const rid=req.params.roleid;
|
||||
const data=
|
||||
{
|
||||
name:req.body.rolename,
|
||||
status:req.body.status,
|
||||
updateBy:req.body.updatedBy,
|
||||
updatedAt:Date.now()
|
||||
}
|
||||
await models.role.update(data,{where:{id:rid}}).then(result=>{
|
||||
res.status(201).json({
|
||||
Code:"1",
|
||||
Message:"Successfully Updated",
|
||||
Data: result
|
||||
});
|
||||
}).catch(error=>{
|
||||
res.status(500).json({
|
||||
Code:"0",
|
||||
Message:"No Data"
|
||||
});
|
||||
})
|
||||
});
|
||||
///PUT COMPANY - DELETE
|
||||
app.put('/deleteRole/(:roleid)',async(req,res)=>{
|
||||
const rid=req.params.roleid;
|
||||
const data=
|
||||
{
|
||||
status:0
|
||||
}
|
||||
|
||||
await models.role.update(data,{where:{id:rid}}).then(result=>{
|
||||
res.status(201).json({
|
||||
Message:"Successfully Deleted",
|
||||
});
|
||||
}).catch(error=>{
|
||||
res.status(500).json({
|
||||
Message:"Something went wrong"
|
||||
});
|
||||
})
|
||||
});
|
||||
//POST BUSINESS - CREATE 2
|
||||
app.post('',async(req,res)=>{
|
||||
const data=
|
||||
{
|
||||
categoryId:req.body.categoryId,
|
||||
subcategoryId:req.body.subcategoryId,
|
||||
name:req.body.name,
|
||||
latitude:req.body.latitude,
|
||||
longitute:req.body.longitute,
|
||||
pincode:req.body.pincode,
|
||||
mobileNumber:req.body.mobileNumber,
|
||||
logo:req.body.logo,
|
||||
galleryId:req.body.galleryId,
|
||||
about:req.body.about,
|
||||
startTime:req.body.startTime,
|
||||
endTime:req.body.endTime,
|
||||
website:req.body.website,
|
||||
openClose:req.body.openClose,
|
||||
status:req.body.status,
|
||||
createdBy:req.body.createdBy,
|
||||
createdAt:Date.now()
|
||||
}
|
||||
models.business.create(data).then(result=>{
|
||||
res.status(201).json({
|
||||
code:"201",
|
||||
Message:"Business created successfully",
|
||||
Data:result
|
||||
});
|
||||
})
|
||||
.catch(error=>{
|
||||
result.status(500).json({
|
||||
Message:"Something went wrong"
|
||||
});
|
||||
})
|
||||
});
|
||||
//GET BUSINESS LIST
|
||||
app.get('/businesses',(req,res)=>
|
||||
{
|
||||
models.business.findAll({where:{status:0}}).then(result=>{
|
||||
res.status(500).json({
|
||||
code:"201",
|
||||
Message:"Business List",
|
||||
Data:result
|
||||
});
|
||||
})
|
||||
.catch(error=>{
|
||||
res.status(201).json({
|
||||
Message:"Something went wrong"
|
||||
});
|
||||
|
||||
})
|
||||
});
|
||||
//SERVICE START
|
||||
|
||||
//POST SERVICE ADD
|
||||
@ -189,7 +40,10 @@ app.post('/addService',async(req,res)=>{
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
//GET SERVICE LIST
|
||||
app.get('/',async(req,res)=>{
|
||||
res.send("welcome to open close");
|
||||
});
|
||||
//GET SERVICE LIST
|
||||
app.get('/service',async(req,res)=>{
|
||||
await models.service.findAll({where:{status:1}}).then(result=>{
|
||||
|
Loading…
Reference in New Issue
Block a user