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/br 59 #24

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Feature/br 59 #24

wants to merge 25 commits into from

Conversation

karlfosterBCL
Copy link
Collaborator

No description provided.

@karlfosterBCL karlfosterBCL requested a review from peter-bcl March 6, 2025 22:33
Copy link
Contributor

@marcus-bcl marcus-bcl left a 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.

Comment on lines 34 to 38
// Update CRNs where appropriate
val breachNotices = breachNoticeService.getActiveBreachNoticesForCrn(message.sourceCrn)
breachNotices.forEach {
message.targetCrn?.let { it1 -> breachNoticeService.updateBreachNoticeCrn(it, it1) }
}
Copy link
Contributor

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.

Suggested change
// 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))
}

Comment on lines 47 to 52
nDeliusIntegrationService.getCrnForBreachNoticeUuid(it.id.toString())?.crn?.let { it1 ->
breachNoticeService.updateBreachNoticeCrn(
it,
it1,
)
}
Copy link
Contributor

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 😄

Suggested change
nDeliusIntegrationService.getCrnForBreachNoticeUuid(it.id.toString())?.crn?.let { it1 ->
breachNoticeService.updateBreachNoticeCrn(
it,
it1,
)
}
nDeliusIntegrationService.getCrnForBreachNoticeUuid(it.id.toString())?.crn?.let { crn ->
breachNoticeService.updateBreachNoticeCrn(it, crn)
}

Comment on lines 12 to 16
fun getCrnForBreachNoticeUuid(breachNoticeId: String): NDeliusCrn? = webClient.get()
.uri(ndeliusIntegrationApiUrl + "/case/{breachNoticeId}", breachNoticeId)
.retrieve()
.bodyToMono(NDeliusCrn::class.java)
.block()
Copy link
Contributor

@marcus-bcl marcus-bcl Mar 7, 2025

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?

Comment on lines +113 to +129
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" +
"}"
Copy link
Contributor

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.

Suggested change
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()

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