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

SIMSBIOHUB-494: Secure data validation with Survey ID #1226

Merged
merged 36 commits into from
Mar 6, 2024

Conversation

curtisupshall
Copy link
Contributor

@curtisupshall curtisupshall commented Feb 29, 2024

Links to Jira Tickets

Description of Changes

  • Added projectId or surveyId as a required parameter for functions that get or modify project- or survey-adjacent data, e.g. observations, sampling sites, project participants etc.
    • Modified several SQL queries to facilitate this.
    • Added ancillary service/repo methods to facilitate this, when needed.
  • Replaced references to req.body.surveyId with req.params.surveyId.
  • Noted outstanding technical debt with some @TODO comments.
  • Minor tech debt changes:
    • Renamed functions found in utils/pagination.
    • Renamed service and repo methods associated with deleting project and survey attachments.
    • Refactored endpoint logic for modifying participants on surveys and projects, as well as some service/repo method renaming.
    • Cleaned up endpoints associated with survey critters.
    • Refactored code related to getting observation counts for surveys and sampling sites.
    • Replaced all instances of return await with return.

Testing Notes

Because this PR touches more than 35 endpoints, thorough testing of all features in the app should be peformed.

@codecov-commenter
Copy link

codecov-commenter commented Feb 29, 2024

Codecov Report

Attention: Patch coverage is 70.37037% with 48 lines in your changes are missing coverage. Please review.

Project coverage is 55.12%. Comparing base (7e103a2) to head (1638f97).

Files Patch % Lines
api/src/repositories/observation-repository.ts 16.66% 9 Missing and 1 partial ⚠️
...eMethodId}/sample-period/{surveySamplePeriodId}.ts 0.00% 5 Missing ⚠️
api/src/services/observation-service.ts 0.00% 5 Missing ⚠️
...thod/{surveySampleMethodId}/sample-period/index.ts 0.00% 4 Missing ⚠️
api/src/repositories/attachment-repository.ts 0.00% 2 Missing and 2 partials ⚠️
api/src/services/sample-period-service.ts 72.72% 1 Missing and 2 partials ⚠️
...rojectId}/participants/{projectParticipationId}.ts 85.71% 0 Missing and 2 partials ⚠️
...veyId}/observations/{surveyObservationId}/index.ts 0.00% 2 Missing ⚠️
...e-site/{surveySampleSiteId}/sample-method/index.ts 81.81% 1 Missing and 1 partial ⚠️
api/src/repositories/sample-location-repository.ts 60.00% 1 Missing and 1 partial ⚠️
... and 7 more
Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1226   +/-   ##
=======================================
  Coverage   55.12%   55.12%           
=======================================
  Files         603      603           
  Lines       18272    18292   +20     
  Branches     2810     2817    +7     
=======================================
+ Hits        10072    10084   +12     
- Misses       7538     7541    +3     
- Partials      662      667    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…sForSurveyMethodId and samplePeriodService.deleteSamplePeriodRecord
…hodPeriod, sampleMethodService.updateSampleMethod, sampleMethodService.deleteSampleMethodRecord.
…ermine observation counts associated with sampling site/method/period
@curtisupshall curtisupshall changed the title SIMSBIOHUB-494 SIMSBIOHUB-494: Secure data validation with Survey ID Mar 5, 2024
@curtisupshall curtisupshall marked this pull request as ready for review March 5, 2024 01:05
@curtisupshall curtisupshall added the Not Ready For Review Addressing feedback and/or refactoring label Mar 5, 2024
@curtisupshall curtisupshall added Early Feedback Welcome PR is not finished, but early review feedback is welcomed and removed Not Ready For Review Addressing feedback and/or refactoring labels Mar 5, 2024
NickPhura
NickPhura previously approved these changes Mar 5, 2024
Copy link
Collaborator

@NickPhura NickPhura left a comment

Choose a reason for hiding this comment

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

Just did a static read through since Jer was doing a thorough testing already.

Looks great, I like the extra cleanup around some of the function names and variables as well.

Copy link
Contributor

@jeznorth jeznorth left a comment

Choose a reason for hiding this comment

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

Tested locally. No issues

Copy link

sonarqubecloud bot commented Mar 5, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Copy link
Collaborator

@NickPhura NickPhura left a comment

Choose a reason for hiding this comment

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

🔐

@jeznorth jeznorth self-requested a review March 5, 2024 23:23
@curtisupshall curtisupshall merged commit 023d292 into dev Mar 6, 2024
16 of 17 checks passed
@curtisupshall curtisupshall deleted the SIMSBIOHUB-494 branch March 6, 2024 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Early Feedback Welcome PR is not finished, but early review feedback is welcomed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants