This PR merges the species capture counts directly into the results of the standard species find query.
Unfortunately, LoopBack makes it quite fiddly to arbitrarily extend objects in API responses, so I've returned Promise<any[]> for simplicity.
I'm open to suggestions for a better solution.
Ideally, we'd do the species find and get the capture counts all in one SQL query, but LoopBack makes the former a little opaque.
That said, performing two separate queries and merging manually shouldn't add significant overhead.
I'll update the corresponding query in the client to not make separate api/trees/count queries (under Greenstand/treetracker-admin-client#115).
Resolves #573
This PR merges the species capture counts directly into the results of the standard species find query.
Unfortunately, LoopBack makes it quite fiddly to arbitrarily extend objects in API responses, so I've returned
Promise<any[]>
for simplicity. I'm open to suggestions for a better solution.Ideally, we'd do the species find and get the capture counts all in one SQL query, but LoopBack makes the former a little opaque. That said, performing two separate queries and merging manually shouldn't add significant overhead.
I'll update the corresponding query in the client to not make separate
api/trees/count
queries (under Greenstand/treetracker-admin-client#115).