Skip to content

Commit

Permalink
fix: add modelName to query to avoid ambiguous fields
Browse files Browse the repository at this point in the history
  • Loading branch information
gwynndp committed Nov 15, 2021
1 parent d6db27b commit 4f18f74
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
7 changes: 0 additions & 7 deletions src/mixins/utils.repository-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ export function UtilsRepositoryMixin<
const planterIds = await this.getNonOrganizationPlanterIds();
// if planter repository request
if (model === 'planter') {
// return {
// and: [
// { organizationId: null },
// { 'planter.id': { inq: planterIds } },
// ],
// };
// could just do this if we didn't need to use 'planter.id' to avoid errors with adding other filters
return { id: { inq: planterIds } };
} else {
// if trees or other repository request
Expand Down
10 changes: 0 additions & 10 deletions src/repositories/planter.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { Planter, PlanterRelations, PlanterRegistration } from '../models';
import { TreetrackerDataSource } from '../datasources';
import { PlanterRegistrationRepository } from './planterRegistration.repository';
import { UtilsRepositoryMixin } from '../mixins/utils.repository-mixin';
// import expect from 'expect-runtime';
import { buildFilterQuery } from '../js/buildFilterQuery';
import { utils } from '../js/utils';

Expand Down Expand Up @@ -70,15 +69,6 @@ export class PlanterRepository extends UtilsRepositoryMixin<

try {
if (this.dataSource.connector) {
// const columnNames = this.dataSource.connector
// .buildColumnNames('Planter', filter)
// .replace('"id"', 'planter.id as "id"')
// .replace('"first_name"', 'planter.first_name as "first_name"')
// .replace('"last_name"', 'planter.last_name as "last_name"')
// .replace('"email"', 'planter.email as "email"')
// .replace('"organization"', 'planter.organization as "organization"')
// .replace('"phone"', 'planter.phone as "phone"');

let selectStmt;
if (deviceIdentifier) {
selectStmt = `SELECT planter.* FROM planter ${this.getPlanterRegistrationJoinClause(
Expand Down

0 comments on commit 4f18f74

Please sign in to comment.