diff --git a/src/repositories/planter.repository.ts b/src/repositories/planter.repository.ts index fb97cc5d..e9332f43 100644 --- a/src/repositories/planter.repository.ts +++ b/src/repositories/planter.repository.ts @@ -50,13 +50,11 @@ export class PlanterRepository extends UtilsRepositoryMixin< if (deviceIdentifier === null) { return `LEFT JOIN planter_registrations ON planter.id=planter_registrations.planter_id - WHERE (planter_registrations.device_identifier ISNULL) - GROUP BY planter.id`; + WHERE (planter_registrations.device_identifier ISNULL)`; } return `JOIN planter_registrations ON planter.id=planter_registrations.planter_id - WHERE (planter_registrations.device_identifier='${deviceIdentifier}') - GROUP BY planter.id`; + WHERE (planter_registrations.device_identifier='${deviceIdentifier}')`; } // default .find() wasn't applying the org filters @@ -72,10 +70,9 @@ export class PlanterRepository extends UtilsRepositoryMixin< try { if (this.dataSource.connector) { - const columnNames = this.dataSource.connector.buildColumnNames( - 'Planter', - filter, - ); + const columnNames = this.dataSource.connector + .buildColumnNames('Planter', filter) + .replace('"id"', 'planter.id as "id"'); let selectStmt; if (deviceIdentifier) {