cht-core icon indicating copy to clipboard operation
cht-core copied to clipboard

feat(#9193): add functionality of getting places as pages or async iterables in cht-datasource

Open sugat009 opened this issue 6 months ago • 0 comments

Description

Added functionality of getting places using pages or as AsyncGenerator using cht-datasource along with the addition of REST endpoint /api/v1/person which provides people as pages.

Issues: #9239 , #9240 , #9242

Usage:

  1. Pagination API
Place.v1.getPageByType(Qualifier.byContactType(placeType), cursor, limit); // limit and cursor are optional with defaults as 100 and "0" respectively
  1. Async Generator API
const getAllIterator = Place.v1.getByType(ctx)(Qualifier.byContactType('place'));
  1. REST API endpoint
HTTP GET api/v1/place

Query Params:

  • placeType - the contact_type of the place to fetch
  • limit - default is 100
  • cursor - default is 0

Code review checklist

  • [X] Readable: Concise, well named, follows the style guide, documented if necessary.
  • [X] Documented: Configuration and user documentation on cht-docs
  • [x] Tested: Unit and/or e2e where appropriate

Compose URLs

If Build CI hasn't passed, these may 404:

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

sugat009 avatar Aug 23 '24 12:08 sugat009