Skip to content

Commit

Permalink
fix: don't change org type for children
Browse files Browse the repository at this point in the history
  • Loading branch information
nmcharlton committed Jan 16, 2022
1 parent 6ff4916 commit 840e6b9
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/controllers/organization.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,13 @@ export class OrganizationController {
@param.query.object('filter', getFilterSchemaFor(Organization))
filter?: OrganizationFilter,
): Promise<Organization[]> {
// if logged in as an org-account then filter for the sub-orgs
if (organizationId && filter?.where) {
filter.where = { ...filter.where, type: 'o' };
}

// create query to get all orgs and their planters
if (filter?.where) {
filter.where = await this.organizationRepository.applyOrganizationWhereClause(
filter.where,
organizationId.valueOf(),
);
filter.where =
await this.organizationRepository.applyOrganizationWhereClause(
filter.where,
organizationId.valueOf(),
);
}

const childOrgs = await this.organizationRepository.find(filter);
Expand Down

0 comments on commit 840e6b9

Please sign in to comment.