Skip to content

Commit

Permalink
fixing some more things
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonSharratt committed Feb 5, 2020
1 parent 4847971 commit dd5db07
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 0 additions & 1 deletion microservices/requestApi/routes/v2/db/model/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ model.getAll = function(query, limit, page, user, callback){

if ('_id' in query) {
db.Request.findById(query['_id'], (err3, req) => {
console.log("ID Query?", query['_id'], err3, req);
if ( (req !== null) && (typeof(req) !== "undefined") && (typeof(req.topic) !== "undefined") ){
getAllTopics(user, { id: req.topic }, queryRequests);
}else{
Expand Down
10 changes: 7 additions & 3 deletions microservices/requestApi/routes/v2/routes/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ var getRouter = function(db){
r = JSON.parse(formRes);
}catch(ex){}

res.status(r.status)
res.json(r);
});
});
Expand All @@ -55,6 +54,7 @@ var getRouter = function(db){
if (req.user.groups.indexOf(adminGroup) === -1){
res.status(403);
res.json({error: "Forbidden"});
return;
}
formioClient.postForm(req.body, function(formErr, formRes){
if (formErr){
Expand Down Expand Up @@ -491,7 +491,6 @@ var getRouter = function(db){
r = JSON.parse(formRes);
}catch(ex){}

res.status(r.status)
res.json(r);
});
});
Expand All @@ -502,6 +501,7 @@ var getRouter = function(db){
if (req.user.groups.indexOf(adminGroup) === -1){
res.status(403);
res.json({error: "Forbidden"});
return;
}
var formName = req.params.formName;
formioClient.putForm(formName, req.body, function(formErr, formRes){
Expand All @@ -527,6 +527,7 @@ var getRouter = function(db){
if (req.user.groups.indexOf(adminGroup) === -1){
res.status(403);
res.json({error: "Forbidden"});
return;
}
var formName = req.params.formName;
formioClient.putForm(formName, req.body, function(formErr, formRes){
Expand All @@ -540,7 +541,10 @@ var getRouter = function(db){
r = JSON.parse(formRes);
}catch(ex){}

res.status(r.status)
try{
res.status(r.status)
}catch(ex){}

res.json(r);
});
});
Expand Down
1 change: 1 addition & 0 deletions microservices/requestApi/test/v2/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ describe("Forms", function() {
}]
})
.end(function (err, res) {
console.log("should create form", res.status, res.body);
res.should.have.status(200);
res.body.should.have.property('_id');
done();
Expand Down

0 comments on commit dd5db07

Please sign in to comment.