Greenstand / treetracker-admin-api

Legacy API microservice for the admin panel
GNU Affero General Public License v3.0
31 stars 81 forks source link

refactor: create mixin to share helper functions across repos #597

Open gwynndp opened 2 years ago

gwynndp commented 2 years ago

Description

Organization of helper functions to reduce duplication across repositories

Please check if the PR fulfills these requirements

What kind of change does this PR introduce?

Issue

What is the current behavior?

There are duplicate functions to help build queries for filtering by organization information in the Trees, Planter, and Organization repositories

What is the new behavior?

Can now use a mixin with a repository to import the helper functions from utils.repository-mixin.ts

Steps taken:

Breaking change

Does this PR introduce a breaking change?

gwynndp commented 2 years ago

@nmcharlton Do you want me to write tests for the mixin or not to bother because we're moving to microservices?

I'm also not sure about the queries for "Not set" organizations. The queries filtered for null orgs and for any planters with null orgs. I tried working on this because the captures page was always getting the same result as "All" for "Not set", but the numbers aren't adding up.