Skip to content

Commit

Permalink
feat: add condition that whether response item in body or not
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinlinlee committed Oct 27, 2021
1 parent d7a834d commit 807154b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion api/FHIRApiService/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ module.exports = async function(req, res , resourceType) {
try {
let resFunc = {
"true": (doc) => {
return doRes(201 , doc);
if (process.env.ENABLE_RESPONSE_RESOURCE_WHEN_CREATE == "true") {
return doRes(201 , doc);
}
return res.status(201).send();
},
"false": (err) => {
let operationOutcomeMessage;
Expand Down
5 changes: 4 additions & 1 deletion api/FHIRApiService/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ module.exports = async function (req, res, resourceType) {
}
let resFunc = {
"true": (data) => {
return doRes(data.code, data.doc);
if (process.env.ENABLE_RESPONSE_RESOURCE_WHEN_CREATE == "true") {
return doRes(data.code, data.doc);
}
return res.status(data.code).send();
},
"false": (err) => {
let operationOutcomeMessage;
Expand Down
1 change: 1 addition & 0 deletions build/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ADMIN_USERNAME="admin"
ADMIN_PASSWORD="password"
ENABLE_CHECK_ALL_RESOURCE_ID=false
ENABLE_RESPONSE_RESOURCE_WHEN_CREATE=true
`;
fs.writeFileSync(".env" , envText);
console.log("Please config dotenv file first, the example dotenv file generated in root path");
Expand Down

0 comments on commit 807154b

Please sign in to comment.