Query parameters passed into the readEndpoints middleware are Strings.
This works for simple lookups such as readEndpoints by name=test.
Mongoose supports more complex queries ie: readEndpoints - {createdAt: {$gte: '01-01-2020'}}.
The structure of the query requires Objects - therefore to implement this functionality String needs to be parsed into an object.
Query parameters passed into the
readEndpoints
middleware are Strings. This works for simple lookups such asreadEndpoints
byname=test
.Mongoose supports more complex queries ie: readEndpoints -
{createdAt: {$gte: '01-01-2020'}}
. The structure of the query requires Objects - therefore to implement this functionality String needs to be parsed into an object.This logic would probably be implemented here: https://github.com/jembi/openhim-mediator-mapping/blob/master/src/db/services/endpoints/index.js#L14
Similar logic will be needed for the deleteEndpoints API endpoint: https://github.com/jembi/openhim-mediator-mapping/blob/master/src/db/services/endpoints/index.js#L29