Greenstand / treetracker-query-api

To fetch Greenstand map data for client's like web map, wallet app, and so on.
GNU General Public License v3.0
15 stars 58 forks source link

featured planter order #310

Open sebastiangaertner opened 1 year ago

sebastiangaertner commented 1 year ago

{"planters":[8870,5182,8380,4726,7260,6141,4755,7582,5896,4904,5896,8002,7704,3937,3952,7894,3953,3985,4031,4043,4787,5881,5925,6945,7181,7186,7188,7273,7276]}

when the above is displayed on the webmap it is not reading the json content in that specific order. It orders by uuid.

sebastiangaertner commented 1 year ago

Could this work???

......

   json_array_elements_text(data -> 'planters') AS planter_id,
      row_number() OVER () AS rn
    FROM 
      webmap.config 
    WHERE 
      name = 'featured-planter'
  ) AS t ON t.planter_id::text::integer = planter.id
ORDER BY t.rn;
dadiorchen commented 1 year ago

The problematic code should be here: https://github.com/Greenstand/treetracker-query-api/blob/d1e064c64a1e8f48f457cb0bb04347e44bfd8ef5/server/infra/database/PlanterRepository.ts#L167