Skip to content

Commit ba5e010

Browse files
committed
merged in main
2 parents 3fe72c2 + 7417fe3 commit ba5e010

15 files changed

+33
-24
lines changed

.github/workflows/security_owasp.yml

-12
This file was deleted.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# hmpps-breach-notice-api
1+
# HMPPS Breach Notice API
22

33
[![repo standards badge](https://img.shields.io/badge/endpoint.svg?&style=flat&logo=github&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fhmpps-breach-notice-api)](https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-report/hmpps-breach-notice-api "Link to report")
44
[![Docker Repository on ghcr](https://img.shields.io/badge/ghcr.io-repository-2496ED.svg?logo=docker)](https://ghcr.io/ministryofjustice/hmpps-breach-notice-api)
5-
[![API docs](https://img.shields.io/badge/API_docs_-view-85EA2D.svg?logo=swagger)](https://hmpps-breach-notice-api-dev.hmpps.service.justice.gov.uk/webjars/swagger-ui/index.html?configUrl=/v3/api-docs)
5+
[![API docs](https://img.shields.io/badge/API_docs_-view-85EA2D.svg?logo=swagger)](https://breach-notice-api-dev.hmpps.service.justice.gov.uk/swagger-ui/index.html)
66

77
API back-end for the [HMPPS Breach Notice](https://github.com/ministryofjustice/hmpps-breach-notice-ui) service.
88

helm_deploy/hmpps-breach-notice-api/values.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,4 @@ gotenberg:
8383

8484
generic-prometheus-alerts:
8585
targetApplication: hmpps-breach-notice-api
86+
alertSeverity: breach-notice-notifications

src/main/kotlin/uk/gov/justice/digital/hmpps/breachnoticeapi/entity/BreachNoticeEntity.kt

+1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@ data class BreachNoticeEntity(
7070
var optionalNumber: String? = null,
7171
var reviewRequiredDate: LocalDateTime? = null,
7272
var reviewEvent: String? = null,
73+
val conditionBeingEnforced: String? = null,
7374
)

src/main/kotlin/uk/gov/justice/digital/hmpps/breachnoticeapi/entity/BreachNoticeRequirementEntity.kt

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.springframework.data.annotation.CreatedDate
1212
import org.springframework.data.annotation.LastModifiedBy
1313
import org.springframework.data.annotation.LastModifiedDate
1414
import org.springframework.data.jpa.domain.support.AuditingEntityListener
15+
import java.time.LocalDate
1516
import java.time.LocalDateTime
1617
import java.util.*
1718

@@ -29,6 +30,8 @@ data class BreachNoticeRequirementEntity(
2930
val requirementTypeMainCategoryDescription: String? = null,
3031
val requirementTypeSubCategoryDescription: String? = null,
3132
val rejectionReason: String? = null,
33+
val fromDate: LocalDate? = null,
34+
val toDate: LocalDate? = null,
3235
@CreatedBy
3336
var createdByUser: String? = null,
3437
@CreatedDate

src/main/kotlin/uk/gov/justice/digital/hmpps/breachnoticeapi/listener/DomainEventsListener.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class DomainEventsListener(
4747
message.targetCrn?.let { it1 -> breachNoticeService.updateBreachNoticeCrn(it, it1) }
4848
}
4949

50-
updateReviewEvent(ReviewEventType.UNMERGE, breachNotices, message.occurredAt)
50+
updateReviewEvent(ReviewEventType.MERGE, breachNotices, message.occurredAt)
5151
}
5252

5353
"probation-case.unmerge.completed" -> {

src/main/kotlin/uk/gov/justice/digital/hmpps/breachnoticeapi/model/BreachNotice.kt

+1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ data class BreachNotice(
4343
val optionalNumber: String? = null,
4444
var reviewRequiredDate: LocalDateTime? = null,
4545
var reviewEvent: String? = null,
46+
val conditionBeingEnforced: String? = null,
4647
)

src/main/kotlin/uk/gov/justice/digital/hmpps/breachnoticeapi/model/BreachNoticeDetails.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ data class BreachNoticeDetails(
1212
val titleAndFullName: String? = null,
1313
val dateOfLetter: LocalDate? = null,
1414
val referenceNumber: String? = null,
15-
val responseRequiredByDate: LocalDate? = null,
15+
val responseRequiredDate: LocalDate? = null,
1616
val breachNoticeTypeCode: String? = null,
1717
val breachNoticeTypeDescription: String? = null,
1818
val breachConditionTypeCode: String? = null,
@@ -43,4 +43,5 @@ data class BreachNoticeDetails(
4343
val optionalNumber: String? = null,
4444
var reviewRequiredDate: LocalDateTime? = null,
4545
var reviewEvent: String? = null,
46+
val conditionBeingEnforced: String? = null,
4647
)
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package uk.gov.justice.digital.hmpps.breachnoticeapi.model
22

3+
import java.time.LocalDate
34
import java.util.*
45

56
data class BreachNoticeRequirement(
@@ -8,6 +9,6 @@ data class BreachNoticeRequirement(
89
val requirementTypeMainCategoryDescription: String? = null,
910
val requirementTypeSubCategoryDescription: String? = null,
1011
val rejectionReason: String? = null,
11-
val fromDate: String? = null,
12-
val toDate: String? = null,
12+
val fromDate: LocalDate? = null,
13+
val toDate: LocalDate? = null,
1314
)

src/main/kotlin/uk/gov/justice/digital/hmpps/breachnoticeapi/service/BreachNoticeService.kt

+10-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class BreachNoticeService(
8181
useDefaultReplyAddress = useDefaultReplyAddress,
8282
reviewRequiredDate = reviewRequiredDate,
8383
reviewEvent = reviewEvent,
84+
conditionBeingEnforced = conditionBeingEnforced,
8485
breachNoticeContactList = breachNoticeContactList.map {
8586
it.toEntity(
8687
existingEntity.breachNoticeContactList.find { existingContactEnitiy ->
@@ -168,6 +169,7 @@ class BreachNoticeService(
168169
optionalNumber = optionalNumber,
169170
reviewRequiredDate = reviewRequiredDate,
170171
reviewEvent = reviewEvent,
172+
conditionBeingEnforced = conditionBeingEnforced,
171173
)
172174

173175
fun getBreachNoticeById(uuid: UUID) = breachNoticeRepository.findById(uuid).getOrNull()?.let {
@@ -177,7 +179,7 @@ class BreachNoticeService(
177179
titleAndFullName = it.titleAndFullName,
178180
dateOfLetter = it.dateOfLetter,
179181
referenceNumber = it.referenceNumber,
180-
responseRequiredByDate = it.responseRequiredDate,
182+
responseRequiredDate = it.responseRequiredDate,
181183
breachNoticeTypeCode = it.breachNoticeTypeCode,
182184
breachNoticeTypeDescription = it.breachNoticeTypeDescription,
183185
breachConditionTypeCode = it.breachConditionTypeCode,
@@ -206,6 +208,7 @@ class BreachNoticeService(
206208
optionalNumber = it.optionalNumber,
207209
reviewRequiredDate = it.reviewRequiredDate,
208210
reviewEvent = it.reviewEvent,
211+
conditionBeingEnforced = it.conditionBeingEnforced,
209212
)
210213
}
211214

@@ -268,18 +271,24 @@ class BreachNoticeService(
268271
requirementTypeMainCategoryDescription = requirementTypeMainCategoryDescription,
269272
requirementTypeSubCategoryDescription = requirementTypeSubCategoryDescription,
270273
rejectionReason = rejectionReason,
274+
fromDate = fromDate,
275+
toDate = toDate,
271276
)
272277

273278
private fun BreachNoticeRequirement.toEntity(existingEntity: BreachNoticeRequirementEntity? = null) = existingEntity?.copy(
274279
requirementId = requirementId,
275280
requirementTypeMainCategoryDescription = requirementTypeMainCategoryDescription,
276281
requirementTypeSubCategoryDescription = requirementTypeSubCategoryDescription,
277282
rejectionReason = rejectionReason,
283+
fromDate = fromDate,
284+
toDate = toDate,
278285
) ?: BreachNoticeRequirementEntity(
279286
requirementId = requirementId,
280287
requirementTypeMainCategoryDescription = requirementTypeMainCategoryDescription,
281288
requirementTypeSubCategoryDescription = requirementTypeSubCategoryDescription,
282289
rejectionReason = rejectionReason,
290+
fromDate = fromDate,
291+
toDate = toDate,
283292
)
284293

285294
fun getBreachNoticeAsPdf(id: UUID, breachNoticeDetails: BreachNoticeDetails?, draft: Boolean): ByteArray? {

src/main/resources/db/migration/V1_2__domain_event_fields.sql

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER TABLE public.breach_notice_requirement ADD from_date timestamp without time zone NULL;
2+
ALTER TABLE public.breach_notice_requirement ADD to_date timestamp without time zone NULL;
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE public.breach_notice ADD condition_being_enforced varchar(200) NULL;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER TABLE public.breach_notice ADD review_required_date timestamp without time zone NULL;
2+
ALTER TABLE public.breach_notice ADD review_event varchar(100) NULL;
3+
4+

src/main/resources/templates/NAT_Breach_Template.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
<p lang="en-US" class="western" align="justify" style="line-height: 100%; margin-bottom: 0cm">
231231
<font face="Arial, serif"><span lang="en-GB">You must contact me
232232
immediately to explain your reason (s) AND provide me with acceptable
233-
supporting evidence for your breach, by <span th:text="${#temporals.format(breachNotice.responseRequiredByDate, 'dd/MM/yyyy')}">{responseDate}</span>. If
233+
supporting evidence for your breach, by <span th:text="${#temporals.format(breachNotice.responseRequiredDate, 'dd/MM/yyyy')}">{responseDate}</span>. If
234234
you do not provide me with an acceptable reason and acceptable
235235
supporting evidence by this date, your failure to comply will remain
236236
as a breach of this Order.</span></font></p>

0 commit comments

Comments
 (0)