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

IS-1867: Add eksternReferanseId to dokarkiv body #480

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

JMLindseth
Copy link
Contributor

This will be required by dokarkiv 20. december.
If api receives an eksternReferanseId that is already stored, it will return 409 Conflict with the existing JournalPost as body. We want to fail when we get 409 becuase we don't want to journalføre the same varsel more than once. Since 409 gives clientException, the existing client returns null, which is then handled by the cron jobs.

@JMLindseth JMLindseth requested a review from a team as a code owner December 12, 2023 11:01
@@ -107,6 +107,7 @@ fun Referat.toJournalforingRequestArbeidstaker(
dokumentName = this.toJournalpostTittel(moteTidspunkt),
brevkodeType = BrevkodeType.DIALOGMOTE_REFERAT_AT,
dokumentPdf = pdf,
varselUuid = UUID.randomUUID(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Burde vi egentlig bruke en referanse som er unik for dette spesifikke referatet til arbeidstaker (og tilvarende til behandler, arbeidsgiver) i stedet for å generere en random uuid? I teorien vil jo det samme referatet kunne journalføres flere ganger når man lager ny referanse hver gang.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Da må vi vel i så fall gjøre større endringer? Alt er jo samme referat, så det er samme uuid. Alternativt må vi generere en uuid som blir lik for hver gang men unik for hver mottaker/referat 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Ja, lurer på om det går an å generere en uuid basert på en string - feks. referat.uuid og et eller annet som er unikt for mottaker som du sier.

Copy link
Contributor Author

@JMLindseth JMLindseth Dec 12, 2023

Choose a reason for hiding this comment

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

Java sin UUID godtar bare string som er på riktig format da. Jeg finner ikke en metode som genererer uuid basert på en seed 🤷‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ny versjon nå, etter slack-samtale 👍

@JMLindseth JMLindseth force-pushed the eksternReferanseId_journalforing branch from f2a3af7 to e845876 Compare December 12, 2023 13:09
@@ -40,10 +41,16 @@ class DokarkivMock {
post(JOURNALPOST_PATH) {
val journalpostRequest = call.receive<JournalpostRequest>()
if (journalpostRequest.bruker?.id == ARBEIDSTAKER_NO_JOURNALFORING.value) {
println("No journalføring for bruker")
Copy link
Contributor

Choose a reason for hiding this comment

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

Skal alle printene med?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ja, det synes jeg 😬 🙈

@JMLindseth JMLindseth force-pushed the eksternReferanseId_journalforing branch 2 times, most recently from 1cfb287 to ae92b29 Compare December 13, 2023 14:40
This will be required by dokarkiv 20. december.
If api receives an eksternReferanseId that is already stored, it will
return 409 Conflict with the existing JournalPost as body.
We want to fail when we get 409 becuase we don't want to journalføre the
same varsel more than once. Since 409 gives clientException, the
existing client returns null, which is then handled by the cron jobs.
In referat create UUID for eksternReferanseId based on uuid and
recipient, to make sure it's unique for each journalfort version, and
also the same each time the same document is journalfort.
@JMLindseth JMLindseth force-pushed the eksternReferanseId_journalforing branch from ae92b29 to 907a4de Compare December 13, 2023 14:40
@JMLindseth JMLindseth merged commit 66a2d68 into master Dec 14, 2023
4 checks passed
@JMLindseth JMLindseth deleted the eksternReferanseId_journalforing branch December 14, 2023 08: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.

4 participants