Skip to content

Commit

Permalink
feat: add device manufacturer to planter registration data for org ac…
Browse files Browse the repository at this point in the history
…counts
  • Loading branch information
gwynndp committed Jan 9, 2022
1 parent b1eeb08 commit b016d72
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/controllers/planterOrganization.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,16 @@ export class PlanterOrganizationController {
): Promise<PlanterRegistration[]> {
// console.log('/organization/{organizationId}/planter-registration');

const sql = `SELECT * FROM planter_registrations
const sql = `SELECT *, devices.manufacturer FROM planter_registrations
JOIN devices ON devices.android_id=planter_registrations.device_identifier
LEFT JOIN (
SELECT region.name AS country, region.geom FROM region, region_type
WHERE region_type.type='country' AND region.type_id=region_type.id
) AS region ON ST_DWithin(region.geom, planter_registrations.geom, 0.01)`;
SELECT
region.name AS country,
region.geom FROM region, region_type
WHERE region_type.type='country'
AND region.type_id=region_type.id
) AS region
ON ST_DWithin(region.geom, planter_registrations.geom, 0.01)`;

const params = {
filter,
Expand Down

0 comments on commit b016d72

Please sign in to comment.