Skip to content

BHBC-1962-1963: Validation refactoring and error handling#828

Merged
anissa-agahchen merged 114 commits into
devfrom
BHBC-1962
Oct 18, 2022
Merged

BHBC-1962-1963: Validation refactoring and error handling#828
anissa-agahchen merged 114 commits into
devfrom
BHBC-1962

Conversation

@anissa-agahchen
Copy link
Copy Markdown
Contributor

@anissa-agahchen anissa-agahchen commented Sep 30, 2022

Overview

Links to Jira tickets

https://quartech.atlassian.net/browse/BHBC-1963
https://quartech.atlassian.net/browse/BHBC-1962
https://quartech.atlassian.net/browse/BHBC-1975
https://quartech.atlassian.net/browse/BHBC-1982

Description of relevant changes

  • refactor submission endpoints to use a submission service and repository
  • refactor error-handling so that errors are captured in the database
  • add S3 key to EML being sent to Biohub
  • fix error on add existing users
  • relevant tests

@github-actions
Copy link
Copy Markdown

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 30, 2022

Codecov Report

Merging #828 (8102a3d) into dev (01d1fab) will increase coverage by 2.11%.
The diff coverage is 82.66%.

@@            Coverage Diff             @@
##              dev     #828      +/-   ##
==========================================
+ Coverage   70.75%   72.87%   +2.11%     
==========================================
  Files         341      349       +8     
  Lines       11538    11689     +151     
  Branches     2075     2124      +49     
==========================================
+ Hits         8164     8518     +354     
+ Misses       2931     2715     -216     
- Partials      443      456      +13     
Impacted Files Coverage Δ
api/src/app.ts 0.00% <0.00%> (ø)
api/src/models/project-view.ts 100.00% <ø> (ø)
api/src/models/survey-view.ts 100.00% <ø> (ø)
api/src/paths/dwc/scrape-occurrences.ts 0.00% <0.00%> (ø)
...hs/project/{projectId}/survey/{surveyId}/upload.ts 0.00% <ø> (ø)
api/src/paths/project/{projectId}/surveys.ts 0.00% <ø> (ø)
api/src/services/db-service.ts 100.00% <ø> (ø)
api/src/utils/db-constant-utils.ts 0.00% <ø> (ø)
api/src/utils/media/csv/csv-file.ts 59.13% <ø> (ø)
app/src/features/admin/users/ActiveUsersList.tsx 32.50% <0.00%> (-3.40%) ⬇️
... and 100 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@anissa-agahchen anissa-agahchen changed the title BHBC:1962 BHBC-1962: Validation error handling Oct 3, 2022
@AlfredRosenthal AlfredRosenthal marked this pull request as ready for review October 17, 2022 21:36
@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.1% 0.1% Duplication

Copy link
Copy Markdown
Contributor

@KjartanE KjartanE left a comment

Choose a reason for hiding this comment

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

Application is function on all pages, error handling works with invalid files. Validation is function. Looks and seems good! :D

@anissa-agahchen anissa-agahchen merged commit a4f1b99 into dev Oct 18, 2022
NickPhura added a commit that referenced this pull request Nov 17, 2022
* Fix/Enhancement: Port improved user access request functionality from Restoration, Adjust access request approval to account for existing bceid-basic-business identity sources (#771)

- Port improved user access request functionality from Restoration
  - Better/fixed handling for approving/denying user requests
  - Adjust access request approval to account for existing bceid-basic-business identity sources
- Existing access requests created before we accounted for bceid-basic-and-business identity sources should no longer throw an error when trying to approve/deny them.

* BHBC-1730: Use centerOfMass instead of centroid for project area center (#770)

* BHBC-1730: Use centerOfMass instead of centroid for project area center point.

* BHBC-1736: Fix Read More/Read Less idempotence bug (#772)

* BHBC-1736: Tighten qualification for string truncating

* BHBC-1736: Fix null coalesce

* BHBC-1736: Change variable name to be more descriptive

* Bugfix: Incorrect identity source enum (#776)

- account for the fact that openapi enums are case sensitive

* Create toDraft.yml (#779)

* Create toDraft.yml

* remove dependency

* Bump sqlite3 from 5.0.2 to 5.0.8 in /n8n (#773)

Bumps [sqlite3](https://github.com/TryGhost/node-sqlite3) from 5.0.2 to 5.0.8.
- [Release notes](https://github.com/TryGhost/node-sqlite3/releases)
- [Changelog](https://github.com/TryGhost/node-sqlite3/blob/master/CHANGELOG.md)
- [Commits](TryGhost/node-sqlite3@v5.0.2...v5.0.8)

---
updated-dependencies:
- dependency-name: sqlite3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nick Phura <nickphura@gmail.com>

* Fixed horizontal autoscaler and consolidate deployment files (#781)

* Fixed horizontal autoscaler and consolidate deployment files

* Some config changes

* Forgot one

* fix

* Set utilization as portion of reques, not maximum

* BHBC-1778: Make resources page publicly viewable (#783)

* BHBC-1776: Update docker-compose and related env vars (#782)

* BHBC-1759: Fix cypress tests (#784)

- Fix cypress tests
- Update n8n version/config

* BHBC-1755: Add backbone api env var and platform-service. (#780)

* BHBC-1755: Add backbone api env var and platform-service.
- Remove clamav hardcoded default values
- Improve checking for required clamav env vars before initializing scanner
- Add missing clamav env vars to api deployment yaml

* Node upgrade as Cypress needs a newer version of node (#785)

* Bump convict from 6.2.2 to 6.2.3 in /n8n (#786)

Bumps [convict](https://github.com/mozilla/node-convict) from 6.2.2 to 6.2.3.
- [Release notes](https://github.com/mozilla/node-convict/releases)
- [Changelog](https://github.com/mozilla/node-convict/blob/master/CHANGELOG.md)
- [Commits](mozilla/node-convict@v6.2.2...v6.2.3)

---
updated-dependencies:
- dependency-name: convict
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Updates the HPAs for APP and API (#790)

* BHBC-1783: Error When Editing Purpose and Methodology (#787)

Fixed an error that occurred when attempting to edit the ‘Purpose and Methodology’ section of a survey.

 - Updated schema validation for GET on purpose_methodology update endpoint.
 - BHBC-1783: Add API response validation testing to update endpoint (work in progress).
 - BHBC-1783: Amend platform-service and its test file w 'dwc/submission/create' endpoint.

* BHBC-1775, BHBC-1809: Templates in prod are still downloaded from S3 Dev (#793)

 - Replace hardcoded URLs in Resources page by implementing env. vars (BHBC-1775)
 - Fix API response validation bugs for Project Drafts (BHBC-1809)

* BHBC-1796-1810 : bug fix - xlsx observation upload not completing (#792)

BHBC-1796: Bug fix - Observation points not displaying on map
BHBC-1810: Bug fix - Transformation of large template file crashes API in Openshift

* fix display of occurrences on full-screen view (#794)

* BHBC-1789: EML Updates + Survey Service (#766)

Tech debt: survey-service
EML: major updates to EML creation code

* BUGFIX: Strip null values from vantage code array in SQL response

* Tech Debt: Fix Cypress Tests (#800)

Tech Debt: Fix Cypress Tests (#800)

* BHBC-1837: Fix survey attachment metadata endpoint (#801)

Bug fix for survey attachment view details

* BHBC-1201: Push project/survey metadata (EML) to backbone on project/survey create/update (#803)

BHBC-1201: Push project/survey metadata (EML) to backbone on create/update

* BHBC-1841: Remove Project/Survey Publish Buttons And Related Code (#804)

 - Project and survey UI no longer include publish button
 - API no longer has endpoints for publishing

* BHBC-1868: Push Observation Data to BioHub (#805)

System admin button + endpoint to submit project and survey EML + Observation data to BioHub Backbone.

* BHBC-1868-2: Handle error popup for BioHub Submit, remove some old logs, enable biohub submission env var for dev. (#806)

- Handle error popup for BioHub Submit
- remove some old logs
- enable biohub submission env var for dev

* TechDebt: Update Keycloak config - add pkce method (#807)

- Update keycloak config to include pkce option

* TechDebt: Port latest version of DataLoader hook (and related hooks/tests) to SIMS (#809)

* TechDebt: Update Template apiVersion from "v1" to "template.openshift.io/v1" (#810)

* BHBC-1893/1880: Update the Composition and SRB Survey Template (#808)

* BHBC-1867: Cant delete a system user that has no system role (#811)

- Fix issue that prevented deleting system users that had no system role.
- Fix bug that was displaying non-human users in the manage users list.

* Update Sims Template Validations (#812)

* BHBC-1914, 1918, 1920 (#816)

Updated validation for summary templates

* BHBC-1923: Update Resource Page (#814)

* BHBC-1912:  Remove the Table Preview for Submitted Observations and Summary Results (#815)

* edits for moose srb and comp validation

* add transect validation

* add sheep pop comp validation survey (broken)

* sheep validation functioning

* goat validation functioning

* fix edits for validations

* trigger build

* initial commit

* remove Observation and Summary CSV table and ref

* trigger build

* fix merge conflict

* more merge conflicts

Co-authored-by: Anissa Agahchen <anissa.agahchen@akimilabs.com>

* BHBC-1922: Add Attachments Datra To EML (#817)

* Include attachments metadata in EML
- adjusted EML pub date to short ISO format
- adjusted order of EML to conform with specification
- adjusted database smoke test script for usage as initial data population. while application now does not throw error, issues persist and have been documented in Jira

* added new elk summary template to resource page (#818)

Added Elk Summary Template to Resource Page

* BHBC-1930, 1931, 1932 (#820)- Elk Templates and summary results

* BHBC-1547: Create Project Improvements (#819)

Refactor create project page to a single form, removing the multi-step wizard

* BHBC-1925: Move Permits to Survey (#813)

- Adjusted permit model for model 1.2
- Adjusted db function project deletion routines
- Added smoke test file
- Purge old permit code from all project related components (frontend and backend)
- Add CustomFieldArray Component
- Move permit components/logic to Survey (from Project)

* BHBC-1966: Add 2 new items to the agency codes list (#825)

Add 2 new items to the agency codes list

* BHBC-1925: added permit servce test coverage (#824)

* BHBC-1904 (#822)

Removed all public views/ pages and supporting tests/ SQL. All unauthenticated users will now be directed to the login page

* BHBC-1949: Email notification to Users that access has been granted or denied

* BHBC-1950/BHBC-1951: Import/Validate Deer Survey Templates (#832)

* BHBC-1965: modifications to occurrence and summary details data model (#830)

 - addition of species descriptor to survey occurrence templates
- addition of templates concept to survey summary details

- adjusted file name

Co-authored-by: Kjartan <35311998+KjartanE@users.noreply.github.com>

* email link functioning (#833)

* BHBC-1937 - Enhance MapContainer with changes from BioHub (#827)

BHBC-1937: Ported MapContainer improvements over from platform:
 * Created new React components to encapsulate Map components and `wfs-utils` helper for rendering and selecting regional/mu layers
 * Updated tests and added type defs for map util functions.

* BHBC-1962-1963-1982-1975: Validation refactoring and error handling (#828)

* BHBC-1978: Data Administrator Permissions Are Incorrect (#838)

* BHBC-1972: Delete a Draft Project (#837)

* BHBC-1998, BHBC-1999 (#839)

Refactored Darwin core submission endpoint, added column to track Darwin core data as JSON

Co-authored-by: Anissa Agahchen <anissa.agahchen@akimilabs.com>

* BHBC:1992: bugfix - keycloak env not passed to api (#840)

Fixed keycloak envs so they are passed properly to API

* updated file name (#841)

Renamed migration to maintain standards

* BHBC-1979: Update Templates to Use New Identifiers (#835)

* BHBC 2009 (#836)

Added wrapped function to catch any errors thrown by database functions

* BHBC-2018 (#843) Addition of security review timestamp attribute for all documents

* BHBC-2052 (#847)

Fixed keycloak URL for SIMS/ BioHub intake

* PR fix (#844)

* BHBC-1976: Update API to utilize new DB changes for processing summary result templates (#834)

 * BHBC-1976: Enhance summary template validation to get validation schema from database.
 * Created a service and repository file for summary template validation.
 * Determine validation schema by performing search on template name, version and taxonomic code.
 * Read in template name and version from XLSX custom properties.

Co-authored-by: Curtis Upshall <curtisupshall@gmail.com>
Co-authored-by: Roland Stens <roland.stens@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Anissa Agahchen <anissa.agahchen@akimilabs.com>
Co-authored-by: Kjartan <35311998+KjartanE@users.noreply.github.com>
Co-authored-by: AlfredRosenthal <110939485+AlfredRosenthal@users.noreply.github.com>
Co-authored-by: Charlie Garrett-Jones <32178098+cgarrettjones@users.noreply.github.com>
NickPhura added a commit that referenced this pull request Nov 17, 2022
* Fix/Enhancement: Port improved user access request functionality from Restoration, Adjust access request approval to account for existing bceid-basic-business identity sources (#771)

- Port improved user access request functionality from Restoration
  - Better/fixed handling for approving/denying user requests
  - Adjust access request approval to account for existing bceid-basic-business identity sources
- Existing access requests created before we accounted for bceid-basic-and-business identity sources should no longer throw an error when trying to approve/deny them.

* BHBC-1730: Use centerOfMass instead of centroid for project area center (#770)

* BHBC-1730: Use centerOfMass instead of centroid for project area center point.

* BHBC-1736: Fix Read More/Read Less idempotence bug (#772)

* BHBC-1736: Tighten qualification for string truncating

* BHBC-1736: Fix null coalesce

* BHBC-1736: Change variable name to be more descriptive

* Bugfix: Incorrect identity source enum (#776)

- account for the fact that openapi enums are case sensitive

* Create toDraft.yml (#779)

* Create toDraft.yml

* remove dependency

* Bump sqlite3 from 5.0.2 to 5.0.8 in /n8n (#773)

Bumps [sqlite3](https://github.com/TryGhost/node-sqlite3) from 5.0.2 to 5.0.8.
- [Release notes](https://github.com/TryGhost/node-sqlite3/releases)
- [Changelog](https://github.com/TryGhost/node-sqlite3/blob/master/CHANGELOG.md)
- [Commits](TryGhost/node-sqlite3@v5.0.2...v5.0.8)

---
updated-dependencies:
- dependency-name: sqlite3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nick Phura <nickphura@gmail.com>

* Fixed horizontal autoscaler and consolidate deployment files (#781)

* Fixed horizontal autoscaler and consolidate deployment files

* Some config changes

* Forgot one

* fix

* Set utilization as portion of reques, not maximum

* BHBC-1778: Make resources page publicly viewable (#783)

* BHBC-1776: Update docker-compose and related env vars (#782)

* BHBC-1759: Fix cypress tests (#784)

- Fix cypress tests
- Update n8n version/config

* BHBC-1755: Add backbone api env var and platform-service. (#780)

* BHBC-1755: Add backbone api env var and platform-service.
- Remove clamav hardcoded default values
- Improve checking for required clamav env vars before initializing scanner
- Add missing clamav env vars to api deployment yaml

* Node upgrade as Cypress needs a newer version of node (#785)

* Bump convict from 6.2.2 to 6.2.3 in /n8n (#786)

Bumps [convict](https://github.com/mozilla/node-convict) from 6.2.2 to 6.2.3.
- [Release notes](https://github.com/mozilla/node-convict/releases)
- [Changelog](https://github.com/mozilla/node-convict/blob/master/CHANGELOG.md)
- [Commits](mozilla/node-convict@v6.2.2...v6.2.3)

---
updated-dependencies:
- dependency-name: convict
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Updates the HPAs for APP and API (#790)

* BHBC-1783: Error When Editing Purpose and Methodology (#787)

Fixed an error that occurred when attempting to edit the ‘Purpose and Methodology’ section of a survey.

 - Updated schema validation for GET on purpose_methodology update endpoint.
 - BHBC-1783: Add API response validation testing to update endpoint (work in progress).
 - BHBC-1783: Amend platform-service and its test file w 'dwc/submission/create' endpoint.

* BHBC-1775, BHBC-1809: Templates in prod are still downloaded from S3 Dev (#793)

 - Replace hardcoded URLs in Resources page by implementing env. vars (BHBC-1775)
 - Fix API response validation bugs for Project Drafts (BHBC-1809)

* BHBC-1796-1810 : bug fix - xlsx observation upload not completing (#792)

BHBC-1796: Bug fix - Observation points not displaying on map
BHBC-1810: Bug fix - Transformation of large template file crashes API in Openshift

* fix display of occurrences on full-screen view (#794)

* BHBC-1789: EML Updates + Survey Service (#766)

Tech debt: survey-service
EML: major updates to EML creation code

* BUGFIX: Strip null values from vantage code array in SQL response

* Tech Debt: Fix Cypress Tests (#800)

Tech Debt: Fix Cypress Tests (#800)

* BHBC-1837: Fix survey attachment metadata endpoint (#801)

Bug fix for survey attachment view details

* BHBC-1201: Push project/survey metadata (EML) to backbone on project/survey create/update (#803)

BHBC-1201: Push project/survey metadata (EML) to backbone on create/update

* BHBC-1841: Remove Project/Survey Publish Buttons And Related Code (#804)

 - Project and survey UI no longer include publish button
 - API no longer has endpoints for publishing

* BHBC-1868: Push Observation Data to BioHub (#805)

System admin button + endpoint to submit project and survey EML + Observation data to BioHub Backbone.

* BHBC-1868-2: Handle error popup for BioHub Submit, remove some old logs, enable biohub submission env var for dev. (#806)

- Handle error popup for BioHub Submit
- remove some old logs
- enable biohub submission env var for dev

* TechDebt: Update Keycloak config - add pkce method (#807)

- Update keycloak config to include pkce option

* TechDebt: Port latest version of DataLoader hook (and related hooks/tests) to SIMS (#809)

* TechDebt: Update Template apiVersion from "v1" to "template.openshift.io/v1" (#810)

* BHBC-1893/1880: Update the Composition and SRB Survey Template (#808)

* BHBC-1867: Cant delete a system user that has no system role (#811)

- Fix issue that prevented deleting system users that had no system role.
- Fix bug that was displaying non-human users in the manage users list.

* Update Sims Template Validations (#812)

* BHBC-1914, 1918, 1920 (#816)

Updated validation for summary templates

* BHBC-1923: Update Resource Page (#814)

* BHBC-1912:  Remove the Table Preview for Submitted Observations and Summary Results (#815)

* edits for moose srb and comp validation

* add transect validation

* add sheep pop comp validation survey (broken)

* sheep validation functioning

* goat validation functioning

* fix edits for validations

* trigger build

* initial commit

* remove Observation and Summary CSV table and ref

* trigger build

* fix merge conflict

* more merge conflicts

Co-authored-by: Anissa Agahchen <anissa.agahchen@akimilabs.com>

* BHBC-1922: Add Attachments Datra To EML (#817)

* Include attachments metadata in EML
- adjusted EML pub date to short ISO format
- adjusted order of EML to conform with specification
- adjusted database smoke test script for usage as initial data population. while application now does not throw error, issues persist and have been documented in Jira

* added new elk summary template to resource page (#818)

Added Elk Summary Template to Resource Page

* BHBC-1930, 1931, 1932 (#820)- Elk Templates and summary results

* BHBC-1547: Create Project Improvements (#819)

Refactor create project page to a single form, removing the multi-step wizard

* BHBC-1925: Move Permits to Survey (#813)

- Adjusted permit model for model 1.2
- Adjusted db function project deletion routines
- Added smoke test file
- Purge old permit code from all project related components (frontend and backend)
- Add CustomFieldArray Component
- Move permit components/logic to Survey (from Project)

* BHBC-1966: Add 2 new items to the agency codes list (#825)

Add 2 new items to the agency codes list

* BHBC-1925: added permit servce test coverage (#824)

* BHBC-1904 (#822)

Removed all public views/ pages and supporting tests/ SQL. All unauthenticated users will now be directed to the login page

* BHBC-1949: Email notification to Users that access has been granted or denied

* BHBC-1950/BHBC-1951: Import/Validate Deer Survey Templates (#832)

* BHBC-1965: modifications to occurrence and summary details data model (#830)

 - addition of species descriptor to survey occurrence templates
- addition of templates concept to survey summary details

- adjusted file name

Co-authored-by: Kjartan <35311998+KjartanE@users.noreply.github.com>

* email link functioning (#833)

* BHBC-1937 - Enhance MapContainer with changes from BioHub (#827)

BHBC-1937: Ported MapContainer improvements over from platform:
 * Created new React components to encapsulate Map components and `wfs-utils` helper for rendering and selecting regional/mu layers
 * Updated tests and added type defs for map util functions.

* BHBC-1962-1963-1982-1975: Validation refactoring and error handling (#828)

* BHBC-1978: Data Administrator Permissions Are Incorrect (#838)

* BHBC-1972: Delete a Draft Project (#837)

* BHBC-1998, BHBC-1999 (#839)

Refactored Darwin core submission endpoint, added column to track Darwin core data as JSON

Co-authored-by: Anissa Agahchen <anissa.agahchen@akimilabs.com>

* BHBC:1992: bugfix - keycloak env not passed to api (#840)

Fixed keycloak envs so they are passed properly to API

* updated file name (#841)

Renamed migration to maintain standards

* BHBC-1979: Update Templates to Use New Identifiers (#835)

* BHBC 2009 (#836)

Added wrapped function to catch any errors thrown by database functions

* BHBC-2018 (#843) Addition of security review timestamp attribute for all documents

* BHBC-2052 (#847)

Fixed keycloak URL for SIMS/ BioHub intake

* PR fix (#844)

* BHBC-1976: Update API to utilize new DB changes for processing summary result templates (#834)

 * BHBC-1976: Enhance summary template validation to get validation schema from database.
 * Created a service and repository file for summary template validation.
 * Determine validation schema by performing search on template name, version and taxonomic code.
 * Read in template name and version from XLSX custom properties.

* commit empty 2

* commit empty 3

* commit empty 4

* change readme

* change readme 2

Co-authored-by: Curtis Upshall <curtisupshall@gmail.com>
Co-authored-by: Roland Stens <roland.stens@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Anissa Agahchen <anissa.agahchen@akimilabs.com>
Co-authored-by: Kjartan <35311998+KjartanE@users.noreply.github.com>
Co-authored-by: AlfredRosenthal <110939485+AlfredRosenthal@users.noreply.github.com>
Co-authored-by: Charlie Garrett-Jones <32178098+cgarrettjones@users.noreply.github.com>
@NickPhura NickPhura deleted the BHBC-1962 branch December 22, 2022 23:25
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.

3 participants