Uploaded image for project: 'Webservices REST Module'
  1. Webservices REST Module
  2. RESTWS-706

Add sorting to Order object

    XMLWordPrintable

    Details

      Description

      This ticket involves adding the option to sort the result of the Order object. Adding this support allows calling the `/order` REST API endpoint and providing the option to sort orders according to the most recent or oldest.

      Design suggestions from Mark G:

      Modify the doSearch method in the OrderResource, so that the list of Orders is sorted by dateActivated, descending (most recent first), before being passed to the NeedsPaging constructor:

      https://github.com/openmrs/openmrs-module-webservices.rest/blob/2.22.0/omod-1.10/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_10/OrderResource1_10.java#L246

      I think it is fine to do this by default... there's really no reason not to return a sorted list.

      As an additional you could add a query paramter "sort" with values "ASC" and "DESC" and if it's "ASC" sort by ascending (oldest first) instead of descending.  (Would be worth to see if there is any convention for a "sort" criteria on any existing resources and follow that pattern if it's different that this).

       

      cc: Mark Goodrich Darius Jazayeri Daniel Kayiwa Kennedy Odero

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              harisu harisu fanyui
              Reporter:
              fred Fredrick Mgbeoma
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: