From 177d4b694cf6a478107cc0d2b81fad767218c925 Mon Sep 17 00:00:00 2001 From: benedwards Date: Thu, 2 Jan 2025 17:42:40 +0000 Subject: [PATCH 1/6] Updated courtroom_name max length --- src/main/resources/openapi/audio.yaml | 1 + src/main/resources/openapi/cases.yaml | 1 + src/main/resources/openapi/event.yaml | 1 + src/main/resources/openapi/hearings.yaml | 1 + 4 files changed, 4 insertions(+) diff --git a/src/main/resources/openapi/audio.yaml b/src/main/resources/openapi/audio.yaml index 570dfe9bf8..bd33c0689a 100644 --- a/src/main/resources/openapi/audio.yaml +++ b/src/main/resources/openapi/audio.yaml @@ -476,6 +476,7 @@ components: courtroom_name: type: string example: "1" + maxLength: 64 hearing_start_at: type: string format: date diff --git a/src/main/resources/openapi/cases.yaml b/src/main/resources/openapi/cases.yaml index f0732719a6..5d126fabed 100644 --- a/src/main/resources/openapi/cases.yaml +++ b/src/main/resources/openapi/cases.yaml @@ -739,6 +739,7 @@ components: courtroom_name: type: string example: "1" + maxLength: 64 hearing_start_at: type: string format: date diff --git a/src/main/resources/openapi/event.yaml b/src/main/resources/openapi/event.yaml index fc87ae7a83..7a5b5c4f4e 100644 --- a/src/main/resources/openapi/event.yaml +++ b/src/main/resources/openapi/event.yaml @@ -727,6 +727,7 @@ components: type: string courtroom_name: type: string + maxLength: 64 hearing_start_at: type: string format: date diff --git a/src/main/resources/openapi/hearings.yaml b/src/main/resources/openapi/hearings.yaml index 5c7b7e6a33..b9205faa21 100644 --- a/src/main/resources/openapi/hearings.yaml +++ b/src/main/resources/openapi/hearings.yaml @@ -295,6 +295,7 @@ components: courtroom_name: type: string example: some_courthouse + maxLength: 64 hearing_start_at: type: string format: date From e6f69cd623cd09a99624fbf9149e5aec123de508 Mon Sep 17 00:00:00 2001 From: benedwards Date: Thu, 2 Jan 2025 17:45:14 +0000 Subject: [PATCH 2/6] Updated courthouse_name max length --- src/main/resources/openapi/courthouse.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/openapi/courthouse.yaml b/src/main/resources/openapi/courthouse.yaml index ac49b252df..746e6a6dd3 100644 --- a/src/main/resources/openapi/courthouse.yaml +++ b/src/main/resources/openapi/courthouse.yaml @@ -155,6 +155,7 @@ components: properties: courthouse_name: type: string + maxLength: 255 display_name: type: string region_id: @@ -170,6 +171,7 @@ components: properties: courthouse_name: type: string + maxLength: 255 display_name: type: string region_id: From 32b069817ec6cf12d8d7f65aa0b9674412de33b5 Mon Sep 17 00:00:00 2001 From: benedwards Date: Thu, 2 Jan 2025 17:46:18 +0000 Subject: [PATCH 3/6] Updated validation on /admin/transformed-medias/search --- src/main/resources/openapi/audiorequests.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/resources/openapi/audiorequests.yaml b/src/main/resources/openapi/audiorequests.yaml index c875c96a56..2d4e80ba93 100644 --- a/src/main/resources/openapi/audiorequests.yaml +++ b/src/main/resources/openapi/audiorequests.yaml @@ -829,9 +829,12 @@ components: media_request_id: type: integer description: 'The media request id' + minLength: 1 + maxLength: 2147483647 case_number: type: string description: 'The case number' + maxLength: 32 courthouse_display_name: type: String description: 'The court house display name' @@ -841,9 +844,11 @@ components: owner: type: string description: 'The media owner' + maxLength: 2000 requested_by: type: string description: 'The person that requested the media' + maxLength: 2000 requested_at_from: type: date description: 'The start date range that the media was requested' From 00c9e401b134aa7ed1f8a896ee947cfd46f7ab75 Mon Sep 17 00:00:00 2001 From: benedwards Date: Thu, 2 Jan 2025 17:47:43 +0000 Subject: [PATCH 4/6] Updated validation on /admin/transcriptions/search --- src/main/resources/openapi/audiorequests.yaml | 4 ++-- src/main/resources/openapi/transcriptions.yaml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/resources/openapi/audiorequests.yaml b/src/main/resources/openapi/audiorequests.yaml index 2d4e80ba93..525ebad226 100644 --- a/src/main/resources/openapi/audiorequests.yaml +++ b/src/main/resources/openapi/audiorequests.yaml @@ -829,8 +829,8 @@ components: media_request_id: type: integer description: 'The media request id' - minLength: 1 - maxLength: 2147483647 + minimum: 1 + maximum: 2147483647 case_number: type: string description: 'The case number' diff --git a/src/main/resources/openapi/transcriptions.yaml b/src/main/resources/openapi/transcriptions.yaml index a079ce69b7..b4ecfdd6d5 100644 --- a/src/main/resources/openapi/transcriptions.yaml +++ b/src/main/resources/openapi/transcriptions.yaml @@ -1032,9 +1032,12 @@ components: transcription_id: type: integer example: 1234 + minimum: 1 + maximum: 2147483647 case_number: type: string example: C123 + maxLength: 32 courthouse_display_name: type: string example: some_courthouse @@ -1045,9 +1048,11 @@ components: owner: type: string example: 'some-user-name' + maxLength: 2000 requested_by: type: string example: 'some-user-name' + maxLength: 2000 requested_at_from: type: string format: date From 6a039fa7b49d9c2694cf0a5f7df5a4146a1da2f0 Mon Sep 17 00:00:00 2001 From: benedwards Date: Thu, 2 Jan 2025 17:48:16 +0000 Subject: [PATCH 5/6] Updated validation on /admin/transcription-documents/search --- src/main/resources/openapi/transcriptions.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/resources/openapi/transcriptions.yaml b/src/main/resources/openapi/transcriptions.yaml index b4ecfdd6d5..dbb02e970b 100644 --- a/src/main/resources/openapi/transcriptions.yaml +++ b/src/main/resources/openapi/transcriptions.yaml @@ -1567,6 +1567,7 @@ components: case_number: type: string description: 'The case number' + maxLength: 32 courthouse_display_name: type: String description: 'The court house display name' @@ -1576,9 +1577,11 @@ components: owner: type: string description: 'The media owner' + maxLength: 2000 requested_by: type: string description: 'The person that requested the media' + maxLength: 2000 requested_at_from: type: date description: 'The start date range that the media was requested' From 1bcdb7d21d5ae212ebf6ab856091e654b0620540 Mon Sep 17 00:00:00 2001 From: benedwards Date: Thu, 2 Jan 2025 18:30:39 +0000 Subject: [PATCH 6/6] Fixed tests --- .../darts/testutils/stubs/TranscriptionDocumentStub.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/integrationTest/java/uk/gov/hmcts/darts/testutils/stubs/TranscriptionDocumentStub.java b/src/integrationTest/java/uk/gov/hmcts/darts/testutils/stubs/TranscriptionDocumentStub.java index 19f7b73ac5..9b3755e828 100644 --- a/src/integrationTest/java/uk/gov/hmcts/darts/testutils/stubs/TranscriptionDocumentStub.java +++ b/src/integrationTest/java/uk/gov/hmcts/darts/testutils/stubs/TranscriptionDocumentStub.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.darts.testutils.stubs; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import uk.gov.hmcts.darts.common.entity.CourtCaseEntity; import uk.gov.hmcts.darts.common.entity.CourtroomEntity; @@ -96,8 +97,8 @@ public List generateTranscriptionEntities(int count .getQueryString(UUID.randomUUID() + Integer.toString(transriptionDocumentCount)), userAccountRepository.getReferenceById(0)); for (int i = 0; i < caseCount; i++) { - caseEntity = courtCaseStub.createAndSaveMinimalCourtCase(TranscriptionDocumentSubStringQueryEnum.COURT_HOUSE.getQueryString( - UUID.randomUUID() + "Case Number" + transriptionDocumentCount + i), courtroomEntity.getCourthouse().getId()); + caseEntity = courtCaseStub.createAndSaveMinimalCourtCase(StringUtils.right(TranscriptionDocumentSubStringQueryEnum.COURT_HOUSE.getQueryString( + UUID.randomUUID() + "Case Number" + transriptionDocumentCount + i), 32), courtroomEntity.getCourthouse().getId()); caseEntityList.add(caseEntity); }