Skip to content

Commit

Permalink
feat: use joi control _pretty, _total
Browse files Browse the repository at this point in the history
- Convert _pretty to boolean, and default to true
- Check _total value, and default to "estimate"
  • Loading branch information
Chinlinlee committed Nov 10, 2022
1 parent fc8eb70 commit 2029166
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion api/FHIR/Patient/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const config = require('../../../config/config');
if (_.get(config, "Patient.interaction.search", true)) {
router.get('/', FHIRValidateParams({
"_offset": joi.number().integer(),
"_count": joi.number().integer()
"_count": joi.number().integer(),
"_pretty": joi.boolean().default(true),
"_total": joi.string().allow("none", "estimate", "accurate").default("estimate")
}, "query", {
allowUnknown: true
}), require('./controller/getPatient'));
Expand Down
4 changes: 3 additions & 1 deletion api_generator/API_Generator_V2.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ function generateAPI(option) {
if (_.get(config, "${res}.interaction.search", true)) {
router.get('/', FHIRValidateParams({
"_offset": joi.number().integer(),
"_count": joi.number().integer()
"_count": joi.number().integer(),
"_pretty": joi.boolean().default(true),
"_total": joi.string().allow("none", "estimate", "accurate").default("estimate")
}, "query", {
allowUnknown: true
}), require('./controller/get${res}'));
Expand Down

0 comments on commit 2029166

Please sign in to comment.