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/refaktorere dokumenter fra bestilling og maler #3698

Merged

Conversation

krharum
Copy link
Contributor

@krharum krharum commented Dec 13, 2024

No description provided.

krharum and others added 11 commits December 10, 2024 11:21
Add a new SQL migration script to create the 'dokument' table. This table includes columns for 'id', 'sist_oppdatert', 'versjon', and 'contents'. It ensures the table exists by using the IF NOT EXISTS clause.
Implemented database migration for managing documents tied to orders and templates. Added entity, repository, service, and controller layers to support retrieving and persisting documents. Introduced new endpoints for fetching documents by order ID.
Renamed variables for clarity and added logic to update `bestilling` objects with serialized `utvidetBestilling`. This ensures the data remains consistent after processing and improves maintainability.
Documents are now saved to the database and referenced by unique IDs, removing the need to handle raw document data directly in requests. This improves security and aligns better with best practices. Also, refactored related service and mapping logic to accommodate this change.
The `brevkode` and `tittel` fields were removed from the `DokumentInfo` class as they are no longer needed. This helps simplify the code and reduces potential maintenance overhead.
Renamed the service directory from 'person-altinn3-tilgang-service' to 'testnav-altinn3-tilgang-service' in the build context. This ensures the correct service path is used during the build process.
Extended DokumentService to retrieve documents by template ID and document ID list. Updated the corresponding controllers and repositories to support these operations. Refactored existing methods for clarity and streamlined the Histark and Dokarkiv clients by removing redundant code.
Add environment data directly during template creation in `MalBestillingService`. Ensure physical document contents are cleared after reference creation in `MigrateDokumentService`. Fix typos in API documentation for `DokumentController`.
Eliminated an unused import from MigrateDokumentService to clean up the code. Added a new functional interface `TriConsumer` in the service package to support operations with three input parameters.
@krharum krharum marked this pull request as ready for review January 9, 2025 09:01
@krharum krharum requested a review from a team as a code owner January 9, 2025 09:01
Annotated `MigrationConfig` with `@Profile("!test")` to ensure it is only loaded in non-test environments. This prevents unnecessary initialization during testing and aligns with environment-specific configuration standards.
Adds a mock implementation for `bestillingRepository.save` in `BestillingServiceTest`. This ensures proper testing and prevents dependency-related issues during unit test execution.
Copy link
Contributor

@stigus stigus left a comment

Choose a reason for hiding this comment

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

Supert 😄

Deploy #deploy-test-dolly-backend

Extracted JSON conversion logic into dedicated methods `fromJson` and `toJson` to improve readability and reduce duplication. Improved error handling to ensure non-null values for `bestKriterier`, enhancing robustness.
#deploy-test-dolly-backend

Separate logic for storing documents and templates into dedicated methods for improved readability and maintainability. Added logging and error handling to ensure better traceability and resilience during the migration process.
@krharum krharum merged commit bb3aa72 into master Jan 9, 2025
6 checks passed
@krharum krharum deleted the feature/refaktorere-dokumenter-fra-bestilling-og-maler branch January 9, 2025 14:15
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