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

feat: 1083 fetch spz by spu #1127

Merged
merged 33 commits into from
May 16, 2024
Merged

feat: 1083 fetch spz by spu #1127

merged 33 commits into from
May 16, 2024

Conversation

craigyu
Copy link
Collaborator

@craigyu craigyu commented May 14, 2024

Description

Closes #979, #1083

When a seedlot is submitted, the area of use data is fetched from Oracle and then set in Postgres.

Separated the put seedlot form endpoint for normal users and tsc-admin users, although tsc-admin's endpoint is not being used and need more work on it later.

The seedlot service's save seedlot form function now does two more things:

  1. Calculate the parent tree contribution and then set the data in the seedlot table
  2. Use the calculated data from step 1 and fetched data from Oracle to set the area of use data in the seedlot table

Changelog

New

  • oracle endpoint /api/orchards/area-of-use/spu/{spuId}
  • a few repository and entities related to tested parent tree area of use
  • two new migration files
    1. V32 - add the primary_ind to the seedlot_seed_plan_zone table to indicate which spz is the primary, ensures only 1 spz for a seedlot can be true
    2. V33 - add primary_ind for table seedlot_orchard, ensures only 1 orchard for a seedlot can be primary, and the seedlot + orchard combination has to be unique. Existing data in that table will have the least updated orchard set as the primary orchard.

Changed

  • renamed postgres put seedlot endpoint from /a-class-form-submission to /a-class-submission so it's less wordy.
  • the seedlot service for put seedlot endpoint is renamed to updateSeedlotWithForm
    • the new param isTscAdmin ensures that only tsc admin can replace records for non pending and incomplete seedlots
    • the new param statusOnSuccess specifies what the status of the seedlot should be upon a successful update

Removed

  • unused spz endpoint and services from before

How was this tested?

  • 🧠 Not needed
  • 👀 Eyeball
  • 🤖 Added tests

What gif/image best describes this PR or how it makes you feel?


Thanks for the PR!

Deployments, as required, will be available below:

Please create PRs in draft mode. Mark as ready to enable:

After merge, new images are deployed in:

@craigyu craigyu added the full-stack full-stack related task label May 14, 2024
@craigyu craigyu self-assigned this May 14, 2024
@craigyu craigyu linked an issue May 14, 2024 that may be closed by this pull request
8 tasks
@craigyu craigyu changed the title Feat/1083 fetch spz by spu feat: 1083 fetch spz by spu May 14, 2024
This was linked to issues May 14, 2024
Copy link
Contributor

@mgaseta mgaseta left a comment

Choose a reason for hiding this comment

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

Phew! Nice work!
Added only one non-blocking comment!

Copy link
Collaborator

@RMCampos RMCampos left a comment

Choose a reason for hiding this comment

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

Great job! Nothing more than suggestions. Please go ahead! 🥇 ⏫

@craigyu craigyu enabled auto-merge (squash) May 16, 2024 16:56
@craigyu craigyu disabled auto-merge May 16, 2024 16:56
@craigyu craigyu merged commit 923b16a into main May 16, 2024
26 of 28 checks passed
@craigyu craigyu deleted the feat/1083-fetch-spz-by-spu branch May 16, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full-stack full-stack related task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fetch spz by spu Build table for SPZ data in post gres ⏫ Fill in geospatial values on seedlot table
3 participants