Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/pdct-1777-support-multiple-geos-in-get #268

Merged
merged 32 commits into from
Jan 8, 2025

Conversation

odrakes-cpr
Copy link
Contributor

@odrakes-cpr odrakes-cpr commented Dec 19, 2024

Description

Support multiple geographies in the get request.

  • Create a subquery that aggregates all the family geographies into a list, insert this subquery into the main query.
  • Update the family_dto function to extract those values
  • To ensure backwards compatibility with the front-end add new property key with geographies, and for the current geography property select the first element of the list.
  • Update tests accordingly
  • Duplicated the query for the search endpoint, whilst we work on the get endpoint - this should enable backwards compatibility

Please include:

  • a summary of the changes
  • links to any related issue/ticket
  • any additional relevant motivation and context
  • details of any dependency updates that are required for this change

Proposed version

Please select the option below that is most relevant from the list below. This
will be used to generate the next tag version name during auto-tagging.

  • [] Skip auto-tagging
  • Patch
  • Minor version
  • Major version

Visit the Semver website to understand the
difference between MAJOR, MINOR, and PATCH versions.

Notes:

  • If none of these options are selected, auto-tagging will fail
  • Where multiple options are selected, the most senior option ticked will be
    used -- e.g. Major > Minor > Patch
  • If you are selecting the version in the list above using the textbox, make
    sure your selected option is marked [x] with no spaces in between the
    brackets and the x

Type of change

Please select the option(s) below that are most relevant:

  • Bug fix
  • New feature
  • Breaking change
  • GitHub workflow update
  • Documentation update
  • Remove legacy code
  • Dependency update

How Has This Been Tested?

Please describe the tests that you added to verify your changes.

Reviewer Checklist

  • DB_CLIENT DEPENDENCY IS ON THE LATEST VERSION
  • The PR represents a single feature (small drive-by fixes are also ok)
  • The PR includes tests that are sufficient for the level of risk
  • The code is sufficiently commented, particularly in hard-to-understand areas
  • Any required documentation updates have been made
  • Any TODOs added are captured in future tickets
  • No FIXMEs remain

@odrakes-cpr odrakes-cpr requested a review from a team as a code owner December 19, 2024 13:57
Copy link

linear bot commented Dec 19, 2024

@odrakes-cpr odrakes-cpr marked this pull request as draft December 19, 2024 13:57
@odrakes-cpr odrakes-cpr marked this pull request as ready for review December 23, 2024 13:49
@odrakes-cpr
Copy link
Contributor Author

get request
Screenshot 2024-12-23 at 13 38 07

@odrakes-cpr odrakes-cpr marked this pull request as draft December 23, 2024 13:55
Osneil Drakes and others added 8 commits December 23, 2024 14:05
- Have had to rework this one slightly because the get_query function
  for families has been updated for multi geos, the query no longer
      returns a row with the geography table and family geo table
      joined. As a query for a family will return multiple rows if there
      are more than one geography associated - these are now aggregated
      into a list of geographies. Therefore the filtering would no
      longer work, i have flipped the script and included a subquery
      that retrieves families import ids  associated with the
      geographies and then filters the query based on those.
@odrakes-cpr
Copy link
Contributor Author

Screenshot 2025-01-06 at 10 52 21

Refactored family/search/query params function

app/repository/family.py Outdated Show resolved Hide resolved
tests/helpers/family.py Outdated Show resolved Hide resolved
tests/helpers/family.py Outdated Show resolved Hide resolved
@odrakes-cpr odrakes-cpr marked this pull request as ready for review January 6, 2025 14:11
Osneil Drakes added 4 commits January 6, 2025 14:27
@odrakes-cpr odrakes-cpr changed the title feat: WIP - update query to accomodate for multi geos related to a fa… feature/pdct-1777-support-multiple-geos-in-get Jan 6, 2025
@odrakes-cpr odrakes-cpr requested a review from katybaulch January 6, 2025 15:59
Copy link
Contributor

@katybaulch katybaulch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, nice work!!

Osneil Drakes added 2 commits January 8, 2025 11:13
…ub.com:climatepolicyradar/navigator-admin-backend into feature/pdct-1777-support-multiple-geos-in-get
@odrakes-cpr odrakes-cpr merged commit 3d2f936 into main Jan 8, 2025
10 checks passed
@odrakes-cpr odrakes-cpr deleted the feature/pdct-1777-support-multiple-geos-in-get branch January 8, 2025 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants