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

Add MalBestilling functionality #3463

Merged
merged 21 commits into from
Apr 15, 2024
Merged

Conversation

krharum
Copy link
Contributor

@krharum krharum commented Apr 9, 2024

Three new files have been created to handle a functionality termed MalBestilling. The new service class MalBestillingService is responsible for creating a new instance of BestillingMal. Also, a new controller class MalBestillingController is provided to expose this service over HTTP. The file DollyRequest2MalBestillingMappingStrategy implements mapping strategies for data conversion.

krharum and others added 19 commits April 9, 2024 09:56
Three new files have been created to handle a functionality termed MalBestilling. The new service class `MalBestillingService` is responsible for creating a new instance of `BestillingMal`. Also, a new controller class `MalBestillingController` is provided to expose this service over HTTP. The file `DollyRequest2MalBestillingMappingStrategy` implements mapping strategies for data conversion.
The 'MalBestillingService' has been shaped up to execute and accumulate certain changes. Part of these adjustments includes replacing null as a returned object to a new class object 'RsBestillingMal'. Additionally, a new class 'RsBestillingMal' has been created to replace 'BestillingMal' with more parameters. These changes are introduced across several related files. These modifications lead to a more structured and rich response from 'MalBestillingService'.
The check for an existing name in MalBestillingService has been removed. This change simplifies code and prevents throwing a 'bad request' response, improving the response structure from 'MalBestillingService'. Now, 'BestillingMal' is saved directly without checking for duplicate names.
A significant refactor on BestillingMalService has been conducted by moving the logic within MalBestillingService to BestillingMalService. As a result, MalBestillingService is not needed anymore and it was removed. Alongside, the related classes and tests were updated according to the new structure.
Renamed BestillingMalService to MalBestillingService across the application. Changes were applied to all its related files, tests, and import statements. All relevant methods updated to call the newly renamed service.
Updated handling of Bestilling by streamlining the mapping process and handling potential exceptions for failing conversions. Removed usage of JsonBestillingMapper and utilized ObjectMapper instead. Renamed BestillingMal to MalBestilling to better reflect its function.
The code has been restructured to handle Bestilling objects more efficiently. The mapping process has been streamlined with the use of ObjectMapper, leading to more effective handling of potentially failing conversions. Additionally, the object BestillingMal has been renamed to MalBestilling to better represent its functionality. The unneeded method getMalbestillingByUserAndNavn has been removed.
…t-dolly-backend

The variable 'bestKriterier' was renamed to 'bestilling' in several Java and TypeScript files to improve code clarity. Additionally, the backend API path was updated in useMaler.tsx and Minside.cy.ts, as well as some logging added to MalPanel.tsx for testing. New fields were added to DollyRequest2MalBestillingMappingStrategy.java for greater functionality.
Deleted the unwanted console.log in MalPanel.tsx and refactored the mapping of 'maler' to use 'bestilling' instead of 'bestKriterier'. In DollyEndpoints.tsx, modified URLs to a different endpoint and added a new method 'opprettMalFraPerson'. Further, in PersonVisning.tsx, imported and implemented 'OpprettMalFraPerson' and made a minor refactor. Lastly, in DollyService.tsx, the method 'opprettMalFraPerson' was implemented.
#deploy-test-dolly-backend

Exception handling has been improved in BestillingStatusMappingStrategy.java, specifically for the 'bestilling' variable. Previously, an error would occur when attempting to read 'BestKriterier' if null or empty; this is now properly handled to default to an empty JSON, preventing an INTERNAL_SERVER_ERROR response.
#deploy-test-dolly-backend

This commit removes the use of the JsonInclude annotation in RsBestillingStatus.java. The absence of this annotation ensures all properties of the class, whether empty or not, will be included in the JSON serialization process.
#deploy-test-dolly-backend

Added getter methods for occupationTypes, workLoadTypes, and workScheduleTypes in ArbeidsplassenCVDTO. These methods ensure that the corresponding lists are initialized when they are null. Also, the BestillingMapper class has been moved from 'strategy' subdirectory to 'mapper' directory for better organization.
#deploy-test-dolly-backend

The RsDollyBestillingRequest type has been replaced with the new RsDollyUtvidetBestilling type in the MalBestillingService and DollyRequest2MalBestillingMappingStrategy classes. This updates how the Bestilling requests are constructed and mapped, allowing extended Bestilling data to be handled correctly.
#deploy-test-dolly-backend

Removed unnecessary imports and refactored the createFromIdent method in MalBestillingService to improve readability. Added helper functions for JSON operations. In DollyRequest2MalBestillingMappingStrategy, adjusted the class mapping to use RsDollyUtvidetBestilling instead of RsDollyBestillingRequest for better consistency.
#deploy-test-dolly-backend
#deploy-test-frontend

The commit adds a switch case to the MalModal.tsx file to determine a 'topic' based on the 'malType'. It changes modal title to include the selected topic when creating a new template. Also, buttons with the text "OPPRETT NY MAL" have been updated to just say "OPPRETT MAL" in the PersonVisning.tsx and BestillingDetaljer.tsx files.
@krharum krharum marked this pull request as ready for review April 15, 2024 07:16
@krharum krharum requested a review from a team as a code owner April 15, 2024 07:16
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.

Ser flott ut, blir kult å få dette på plass 🤩

@krharum krharum merged commit 8fc72b4 into master Apr 15, 2024
10 checks passed
@krharum krharum deleted the feature/opprett-mal-fra-person branch April 15, 2024 08:08
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