Skip to content

feat(#972): develop and integrate standard unit history frontend with backend - #1012

Merged
craigyu merged 23 commits into
mainfrom
feat/972-develop-and-integrate-standard-unit-history-frontend-with-backend
Sep 12, 2025
Merged

feat(#972): develop and integrate standard unit history frontend with backend#1012
craigyu merged 23 commits into
mainfrom
feat/972-develop-and-integrate-standard-unit-history-frontend-with-backend

Conversation

@Abradat

@Abradat Abradat commented Sep 6, 2025

Copy link
Copy Markdown
Collaborator

Description

This PR implements:

  • New stocking standard history backend functionalities based on new design requirements
  • Implement frontend components for stocking standard unit history
  • Integrate backend with frontend

Fixes #972

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Documentation update

How Has This Been Tested?

  • New unit tests
  • New integrated tests
  • New component tests
  • New end-to-end tests
  • New user flow tests
  • No new tests are required
  • Manual tests (description below)
  • Updated existing tests

Checklist

  • I have read the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have already been accepted and merged

Further comments


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:

Renamed DTOs, projections, and service methods from 'OpeningStandardUnitHistory' to 'OpeningStockingHistoryWithComparison' to better reflect their purpose. Updated query constants, repository methods, endpoint signatures, and tests to use the new naming. This improves clarity and prepares for enhanced comparison features in stocking history retrieval.
…ties

Updated method names in OpeningRepository and related service and test classes to clarify that returned history details include comparison data. This improves code readability and consistency.
Introduced three new SQL query constants to fetch stocking standard unit, species, and layer data from archive tables. These queries support retrieval of historical stocking standard information for a given opening and event history.
Implemented new stocking standard history DTOs to be compatible with non history stocking DTOs. This would streamline the frontend implementation.
Introduces three new repository methods to fetch stocking history details, species, and layer archives by opening and event history IDs. This supports retrieval of archived stocking history data for openings.
Introduced getOpeningStockingHistoryDetails to OpeningDetailsService and implemented getOpeningStockingHistoryList in OpeningStandardUnitHistoryService to fetch detailed stocking history, including layers, species, and comments. Updated constructor and test setup to include SilvicultureCommentRepository dependency.
Renamed 'historyId' to 'eventHistoryId' in the SSU history details endpoint and updated the return type from OpeningStockingHistoryWithComparisonDto to OpeningStockingHistoryDto. The service method called was also changed to getOpeningStockingHistoryDetails for consistency with the new DTO.
@Abradat Abradat linked an issue Sep 6, 2025 that may be closed by this pull request
3 tasks
…iew DTO

Introduces isLatest and isOldest boolean fields to OpeningStockingHistoryOverviewDto to indicate the newest and oldest history records. Updates OpeningStandardUnitHistoryService to set these flags based on event timestamps and adds corresponding test assertions.
Replaces OpeningStandardUnitHistory* models and references with OpeningStockingHistory* equivalents throughout the OpenApi service. Updates type imports, endpoint parameters, and model definitions to reflect the new naming and structure. Also fixes type definitions for averageHeight fields.
Modified the LEFT JOIN between STOCKING_LAYER_ARCHIVE and STOCKING_LAYER_SPECIES_ARCHIVE to include STOCKING_EVENT_HISTORY_ID in the join condition to prevent duplicate species values.
Introduces a new formatDateTime function to format ISO date strings using a customizable format. Returns '--' for invalid or empty input.
Introduces a modal to view standard units history overview, adds dropdown to select historical stocking data, and updates components and styles to support displaying historical and latest standard unit data. Refactors logic to handle both current and historical stocking units and improves UI for history selection.
Introduces a comprehensive unit test to verify that getOpeningStockingHistoryList returns the correct stocking history list, including details, layers, species, and comments. This improves test coverage and ensures the method's correctness.
Replaces the use of codeDescriptionToDisplayText with direct access to the auditAction description, ensuring the correct text is shown or a placeholder if missing.
Remove opening-standard-units-history-modal-content class which has never been used
Introduces data-testid attributes to key elements in the OpeningStandardUnits history modal and related components to improve testability. Updates the e2e page object to reference these new test IDs for more robust automated testing.
@Abradat
Abradat marked this pull request as ready for review September 9, 2025 23:17
@Abradat
Abradat requested a review from Copilot September 11, 2025 19:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a new stocking standard unit history frontend and backend system based on updated design requirements. The implementation provides comprehensive history functionality for opening stocking standards with UI components for viewing historical data and comparison features.

  • Frontend components for displaying stocking standard unit history with dropdown selection and modal overview
  • Backend services for retrieving historical stocking data with comparison capabilities
  • Updated API models and endpoints to support the new history features

Reviewed Changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
frontend/src/utils/DateUtils.ts Adds datetime formatting utility function
frontend/src/services/OpenApi/services/OpeningEndpointService.ts Updates service method signatures for new history endpoints
frontend/src/services/OpenApi/models/* Refactors model names from "StandardUnit" to "Stocking" pattern and adds new history DTOs
frontend/src/components/OpeningDetails/OpeningStandardUnits/index.tsx Implements history dropdown, modal overview, and historical data display
backend/src/main/java/ca/bc/gov/restapi/results/oracle/service/opening/history/OpeningStandardUnitHistoryService.java Adds new service methods for retrieving stocking history with comparison features
backend/src/main/java/ca/bc/gov/restapi/results/oracle/endpoint/OpeningEndpoint.java Updates endpoint parameter names and return types
backend/src/main/java/ca/bc/gov/restapi/results/oracle/dto/opening/history/* Creates new DTOs for stocking history data structures

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

…ojection

Renamed OpeningStockingHistoryLayerSpeciesWithComaprisonProjection to OpeningStockingHistoryLayerSpeciesWithComparisonProjection across entity, repository, service, and test files to correct spelling and ensure consistency.

@craigyu craigyu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great work!

@craigyu
craigyu enabled auto-merge (squash) September 12, 2025 16:59
@craigyu
craigyu merged commit a23483d into main Sep 12, 2025
25 of 26 checks passed
@craigyu
craigyu deleted the feat/972-develop-and-integrate-standard-unit-history-frontend-with-backend branch September 12, 2025 17:12
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.

[DEV TASK]: Develop and Integrate Standard Unit History Frontend with Backend

3 participants