Skip to content

Commit

Permalink
Bugfix/levende arbeidsforhold (#3594)
Browse files Browse the repository at this point in the history
* **Refactor parameter handling and add logging**
#deploy-dolly-frontend #deploy-levende-arbeidsforhold-scheduler #deploy-levende-arbeidsforhold-ansettelse

Replaced JobbService with ParameterService for parameter management and added LoggService to handle logging operations in the application. This refactoring enhances the structure and maintainability of the services while improving traceability through logging.

* **Improve error handling and add entity equality methods**
#deploy-test-frontend #deploy-levende-arbeidsforhold-ansettelse #deploy-levenede-arbeidsforhold-scheduler

Enhanced error handling in ParameterController by removing try-catch and ensuring HTTP OK status. Added equals and hashCode methods to AnsettelseLogg and JobbParameter for better entity management and comparison.

* Remove AnsettelseLoggDTO and update Flyway config
#deploy-levende-arbeidsforhold-ansettelse

Deleted the unused AnsettelseLoggDTO class as part of code cleanup. Additionally, enabled the Flyway `baseline-on-migrate` option in application.yml to ensure proper database migration handling.

* Refactor verdier type to List<String> in JobbParameter #deploy-levende-arbeidsforhold-ansettelse

Updated the 'verdier' field in JobbParameter from String to List<String> to better align with data requirements. This change ensures that multiple values can be stored and managed effectively.

* Change HTTP method from GET to POST in AnsettelsesCommand
#deploy-levendearbeidsforhold-scheduler

Updated the call method to use POST instead of GET for the "/api/v1/ansettelse" endpoint. This change is required to meet the API specifications and ensure proper data handling.

* deploy
#deploy-levende-arbeidsforhold-scheduler

* Refactor schedulers and update controller mappings
#deploy-levende-arbeidsforhold-scheduler #deploy-levende-arbeidsforhold-ansettelse

Rearranged variable declarations in JobbScheduler.java for better readability. Changed REST endpoint mappings in JobbController.java from GET to PUT for starting and stopping the scheduler. Updated config files to include new applications and corrected existing rule entries.

* Add version and logback config, update security URLs
#deploy-levende-arbeidsforhold-scheduler

Updated application version in application.yml to "1" and added logback-spring.xml for logging configuration. Also, modified SecurityConfig to refine request matchers and ensure proper authorization for "/api/**" endpoints.

* Create RequestDTO and update controller logic
#deploy-levende-arbeidsforhold-scheduler

Introduced a new RequestDTO class to encapsulate request parameters for the scheduler. Refactored JobbController to accept this DTO and streamlined scheduler handling logic, replacing ResponseEntity with a simpler string return and incorporating exceptions for invalid input. Finally, adjusted client-side code to align with updated endpoint mappings.

* Rename interval to intervall in RequestDTO
#deploy-levende-arbeidsforhold-scheduler

Updated the RequestDTO field from 'interval' to 'intervall' to ensure consistency with domain terminology. Removed unnecessary schema annotation from JobbController, adjusted method logic to reflect field renaming, and added logging for incoming requests.

* Refactor reschedule method to use @RequestParam
#deploy-levende-arbeidsforhold-scheduler

Refactored the `reschedule` method in `JobbController` to use `@RequestParam` instead of `@RequestBody` for the `intervall` parameter. This change simplifies the HTTP request required to trigger scheduler activation. Removed the `RequestDTO` dependency and cleaned up the associated code.

* Rename Appstyring to Levende arbeidsforhold
#deploy-test-frontend

Renamed folders and files under `Appstyring` to `Levendearbeidsforhold` to better reflect functionality changes. Adjusted import paths, updated the scheduler URL, and modified labels and navigation paths to ensure consistency with the new nomenclature.

* Add log search by identity and organization
#deploy-levende-arbeidsforhold-ansettelse

Introduced methods in the LoggService and corresponding repository to fetch logs based on identity and organization number. Updated LoggController to provide endpoints for these searches, and adjusted timeout duration in AnsettelseService.

* Rename navigation path
#deploy-test-frontend

Updated the admin navigation path from `/admin/appstyring` to `/admin/levendearbeidsforhold` for consistency. Adjusted the dropdown menu to reflect this change by modifying labels accordingly.

* Add new applications to test config
#deploy-test-frontend

Included `testnav-levende-arbeidsforhold-ansettelse` and `testnav-levende-arbeidsforhold-scheduler` under the applications section. This ensures these new services are part of the test configuration setup.

* **Change log levels and fix route path capitalization**

Updated logger level from TRACE to INFO for consistent logging across multiple modules. Corrected the capitalization in the "/admin/levendearbeidsforhold" route path to ensure proper URL handling in the Dolly frontend.

* **Remove AnsettelsesService and update JobbScheduler**
#deploy-levende-arbeidsforhold-scheduler #deploy-levende_arbeidsforhold-ansettelse

Removed AnsettelsesService and refactored JobbScheduler to use AnsettelseConsumer directly, simplifying the job scheduling process. This change includes enhancements for better async handling and transactional management in AnsettelseService. Additionally, security headers were updated, and new indexes were added for database optimization.

* Deploy #deploy-levende-arbeidsforhold-scheduler

* Update parameter value submission in EditParameter.tsx
#deploy-test-frontend

Previously, the parameter value was JSON stringified before being sent in the request body. This change removes the JSON.stringify, ensuring the value is sent as a plain string.

* Delete unused PDL domain classes and GraphQL commands

Removed multiple PDL domain classes and their related commands to clean up redundant code. This includes classes like `Bostedsadresse`, `Data`, `Feilmelding`, and several others that are no longer in use. Additionally, GraphQL commands and resources for fetching person data were also deleted.

* Update tenorClient arguments to prevent default pagination
#deploy-tenor-search-service

Replaced fixed pagination values in tenorClient.getOrganisasjonTestdata with nulls to avoid unexpected default pagination behavior. This change ensures the full dataset is retrieved without arbitrary limitations.

* Remove unused service classes and dependencies

Deleted multiple service classes, utilities, and dependencies that were no longer needed in the codebase. This refactor simplifies the code and removes redundant components, enhancing maintainability.

* Delete outdated domain classes

Removed unused domain classes such as `Adresse`, `Organisasjon`, `Hendelse`, and related enums and interfaces. This clean-up helps streamline the codebase and eliminates obsolete code, improving maintainability.

* Rettet feil etter merge

* Improve logging in SannsynlighetVelger.

Enhanced the log message to provide a more detailed breakdown of the stochastic distribution by age groups. Added a helper method to handle null values gracefully.
  • Loading branch information
krharum authored Aug 27, 2024
1 parent 863974d commit e5881a8
Show file tree
Hide file tree
Showing 113 changed files with 1,283 additions and 2,872 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const EditParameter = ({ name, label, initialValue, options, data, setDat
async function oppdaterParameterverdi(value: string) {
await fetch(`/testnav-levende-arbeidsforhold-ansettelse/api/v1/parameter/${name}`, {
method: 'PUT',
body: JSON.stringify(value),
body: value,
}).then((res) => (res.status === 200 ? onSubmit(value) : console.error('Feil feil feil')))
}

Expand Down
14 changes: 1 addition & 13 deletions apps/levende-arbeidsforhold-ansettelse/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
implementation 'no.nav.testnav.libs:servlet-core'
implementation 'no.nav.testnav.libs:servlet-insecure-security'
implementation 'no.nav.testnav.libs:data-transfer-objects'
implementation 'no.nav.testnav.libs:data-transfer-search-objects'
implementation 'no.nav.testnav.libs:database'

implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
Expand All @@ -52,18 +53,5 @@ dependencies {

implementation 'com.zaxxer:HikariCP'
implementation 'com.h2database:h2'

//Spesifiserer versjoner av dependencies' dependencies som er utdatert og har sikkerhets-risikoer, bruker derfor de nedenfor
implementation 'org.apache.commons:commons-compress:1.26.2'
implementation 'org.apache.tomcat.embed:tomcat-embed-core:10.1.25'
implementation 'org.apache.tomcat.embed:tomcat-embed-websocket:10.1.19'
implementation 'org.apache.tomcat.embed:tomcat-embed-core:10.1.25'
implementation 'org.springframework.security:spring-security-core:6.2.3'
implementation 'org.springframework:spring-core:6.1.3'
implementation 'org.springframework:spring-web:6.1.6'
implementation 'com.nimbusds:nimbus-jose-jwt:9.37.2'
implementation 'io.netty:netty-codec-http:4.1.108.Final'
implementation 'com.h2database:h2:2.3.230'
implementation 'org.bouncycastle:bcprov-jdk18on:1.78'
}

1 change: 1 addition & 0 deletions apps/levende-arbeidsforhold-ansettelse/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ includeBuild '../../libs/servlet-core'
includeBuild '../../libs/reactive-core'
includeBuild '../../libs/servlet-insecure-security'
includeBuild '../../libs/data-transfer-objects'
includeBuild '../../libs/data-transfer-search-objects'
includeBuild '../../libs/database'
includeBuild '../../.github/workflows'

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit e5881a8

Please sign in to comment.