-
Notifications
You must be signed in to change notification settings - Fork 0
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/br 59 #24
base: main
Are you sure you want to change the base?
Feature/br 59 #24
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Few very minor comments. Will need to add the secret ref to the values.yaml file as discussed too.
// Update CRNs where appropriate | ||
val breachNotices = breachNoticeService.getActiveBreachNoticesForCrn(message.sourceCrn) | ||
breachNotices.forEach { | ||
message.targetCrn?.let { it1 -> breachNoticeService.updateBreachNoticeCrn(it, it1) } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targetCrn should always be populated for a merge message, so it might be cleaner to make them non-nullable? Or at least throw if they are null? E.g.
// Update CRNs where appropriate | |
val breachNotices = breachNoticeService.getActiveBreachNoticesForCrn(message.sourceCrn) | |
breachNotices.forEach { | |
message.targetCrn?.let { it1 -> breachNoticeService.updateBreachNoticeCrn(it, it1) } | |
} | |
// Update CRNs where appropriate | |
val breachNotices = breachNoticeService.getActiveBreachNoticesForCrn(message.sourceCrn) | |
breachNotices.forEach { | |
breachNoticeService.updateBreachNoticeCrn(it, requireNotNull(message.targetCrn)) | |
} |
nDeliusIntegrationService.getCrnForBreachNoticeUuid(it.id.toString())?.crn?.let { it1 -> | ||
breachNoticeService.updateBreachNoticeCrn( | ||
it, | ||
it1, | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use a better name than it1
😄
nDeliusIntegrationService.getCrnForBreachNoticeUuid(it.id.toString())?.crn?.let { it1 -> | |
breachNoticeService.updateBreachNoticeCrn( | |
it, | |
it1, | |
) | |
} | |
nDeliusIntegrationService.getCrnForBreachNoticeUuid(it.id.toString())?.crn?.let { crn -> | |
breachNoticeService.updateBreachNoticeCrn(it, crn) | |
} |
fun getCrnForBreachNoticeUuid(breachNoticeId: String): NDeliusCrn? = webClient.get() | ||
.uri(ndeliusIntegrationApiUrl + "/case/{breachNoticeId}", breachNoticeId) | ||
.retrieve() | ||
.bodyToMono(NDeliusCrn::class.java) | ||
.block() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type here is nullable, but it looks like it will always either return or throw. Would you need to add an onErrorContinue
to handle a 404 and return null? Or should we just make the return type non-nullable?
val message: String = "{\n" + | ||
" \"eventType\":\"probation-case.unmerge.completed\",\n" + | ||
" \"version\":1,\n" + | ||
" \"occurredAt\":\"2025-03-03T12:20:13.6147Z\",\n" + | ||
" \"description\":\"An unmerge has been completed on the probation case\",\n" + | ||
" \"additionalInformation\":{\n" + | ||
" \"reactivatedCRN\":\"X000103\",\n" + | ||
" \"unmergedCRN\":\"X000121\"},\n" + | ||
" \"personReference\":{\n" + | ||
" \"identifiers\":[\n" + | ||
" {\n" + | ||
" \"type\":\"CRN\",\n" + | ||
" \"value\":\"X000121\"\n" + | ||
" }\n" + | ||
" ]\n" + | ||
" }\n" + | ||
"}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor thing - but you could use a multi-line string for these which would mean you don't need to escape everything. Also you can add a language comment so IntelliJ highlights and formats it as JSON.
val message: String = "{\n" + | |
" \"eventType\":\"probation-case.unmerge.completed\",\n" + | |
" \"version\":1,\n" + | |
" \"occurredAt\":\"2025-03-03T12:20:13.6147Z\",\n" + | |
" \"description\":\"An unmerge has been completed on the probation case\",\n" + | |
" \"additionalInformation\":{\n" + | |
" \"reactivatedCRN\":\"X000103\",\n" + | |
" \"unmergedCRN\":\"X000121\"},\n" + | |
" \"personReference\":{\n" + | |
" \"identifiers\":[\n" + | |
" {\n" + | |
" \"type\":\"CRN\",\n" + | |
" \"value\":\"X000121\"\n" + | |
" }\n" + | |
" ]\n" + | |
" }\n" + | |
"}" | |
// language=json | |
val message = """{ | |
"eventType":"probation-case.unmerge.completed", | |
"version":1, | |
"occurredAt":"2025-03-03T12:20:13.6147Z", | |
"description":"An unmerge has been completed on the probation case", | |
"additionalInformation":{ | |
"reactivatedCRN":"X000103", | |
"unmergedCRN":"X000121" | |
}, | |
"personReference":{ | |
"identifiers":[ | |
{ | |
"type":"CRN", | |
"value":"X000121" | |
} | |
] | |
} | |
}""".trimIndent() |
No description provided.