-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from nzzdev/release-4.0.0
Release 4.0.0
- Loading branch information
Showing
7 changed files
with
161 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,33 @@ | ||
const Boom = require('boom'); | ||
const Joi = require('joi'); | ||
const Boom = require("boom"); | ||
const Joi = require("joi"); | ||
|
||
module.exports = { | ||
path: '/search', | ||
method: 'POST', | ||
path: "/search", | ||
method: "GET", | ||
options: { | ||
validate: { | ||
payload: Joi.object().required() | ||
query: { | ||
limit: Joi.number().optional(), | ||
bookmark: Joi.string().optional(), | ||
tool: Joi.alternatives() | ||
.try(Joi.array().items(Joi.string()), Joi.string()) | ||
.optional(), | ||
createdBy: Joi.string().optional(), | ||
department: Joi.string().optional(), | ||
publication: Joi.string().optional(), | ||
active: Joi.boolean().optional(), | ||
searchString: Joi.string().optional() | ||
} | ||
}, | ||
tags: ['api', 'editor'] | ||
tags: ["api", "editor"] | ||
}, | ||
handler: async (request, h) => { | ||
return request.server.methods.db.item.search(request.payload); | ||
// Creates new object filterProperties which contains all properties but bookmark and limit | ||
const { bookmark, limit, ...filterProperties } = request.query; | ||
return request.server.methods.db.item.search( | ||
filterProperties, | ||
limit, | ||
bookmark | ||
); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters