Skip to content

Commit

Permalink
fix: duplicate resource in bundle entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinlinlee committed Feb 22, 2022
1 parent 92e7659 commit 1567a12
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/FHIRApiService/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ module.exports = async function(req, res, resourceType, paramsSearch) {
docs = [...docs, ...includeDocs, ...reincludeDocs];
let bundle = createBundle(req, docs, count, paginationSkip, paginationLimit, resourceType);
res.header('Last-Modified', new Date().toUTCString());
bundle.entry = _.uniqBy(bundle.entry, "fullUrl");
return doRes(200 , bundle);
} catch (e) {
console.error(`api ${process.env.FHIRSERVER_APIPATH}/${resourceType}/ has error, `, e);
Expand All @@ -89,7 +90,7 @@ module.exports = async function(req, res, resourceType, paramsSearch) {
return doRes(500 , operationOutcomeError);
}
};

//#region custom functions use in `include` and `revinclude`
function isValidHttpUrl(str) {
try {
let url = new URL(str);
Expand Down Expand Up @@ -137,6 +138,7 @@ function checkSearchParameterName(searchParamFields, resourceName, searchParam,
throw error;
}
}
//#endregion

//#region _include
/**
Expand Down

0 comments on commit 1567a12

Please sign in to comment.