diff --git a/pre-api-stg.yaml b/pre-api-stg.yaml index ac5c9f40ed..154d4ee22a 100644 --- a/pre-api-stg.yaml +++ b/pre-api-stg.yaml @@ -5186,6 +5186,14 @@ paths: in: query name: name type: string + - description: The first name of the user to search by + in: query + name: firstName + type: string + - description: The last name of the user to search by + in: query + name: lastName + type: string - description: The email of the user to search by in: query name: email diff --git a/specs/pre-api.json b/specs/pre-api.json index bfa0f29db1..fc267eb22a 100644 --- a/specs/pre-api.json +++ b/specs/pre-api.json @@ -1 +1 @@ -{"openapi":"3.0.1","info":{"description":"PRE API - Used for managing courts, bookings, recordings and permissions.","license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"},"title":"Pre Recorded Evidence API","version":"v0.0.1"},"externalDocs":{"description":"README","url":"https://github.com/hmcts/pre-api"},"servers":[{"url":"http://localhost","description":"Generated server url"}],"security":[{"Ocp-Apim-Subscription-Key":[]}],"tags":[{"description":"Monitor and interact","externalDocs":{"description":"Spring Boot Actuator Web API Documentation","url":"https://docs.spring.io/spring-boot/docs/current/actuator-api/html/"},"name":"Actuator"}],"paths":{"/accept-terms-and-conditions/{termsId}":{"post":{"operationId":"acceptTermsAndConditions","parameters":[{"in":"path","name":"termsId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Accept terms and conditions for a user","tags":["terms-and-conditions-controller"]}},"/app-terms-and-conditions/latest":{"get":{"operationId":"getLatestTermsForApp","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/TermsAndConditionsDTO"}}},"description":"OK"}},"summary":"Get the latest terms and conditions for the app","tags":["terms-and-conditions-controller"]}},"/audit/{id}":{"put":{"operationId":"putAudit","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAuditDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create an Audit Entry","tags":["audit-controller"]}},"/b2c/email-verification":{"post":{"operationId":"postEmailVerification","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyEmailRequestDTO"}}},"required":true},"responses":{"204":{"description":"No Content"}},"summary":"Trigger an email verification email to be sent out via gov notify","tags":["b-2-c-controller"]}},"/bookings":{"get":{"operationId":"searchBookings","parameters":[{"description":"The Case Id to search for","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"caseId","schema":{"type":"string","format":"uuid"}},{"description":"The Case Reference to search for","example":1234567890123456,"in":"query","name":"caseReference","schema":{"type":"string"}},{"description":"The Date the Booking is scheduled for","example":"2024-04-27","in":"query","name":"scheduledFor","schema":{"type":"string","format":"date"}},{"description":"The Participant Id to search for","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"participantId","schema":{"type":"string","format":"uuid"}},{"description":"The Court Id to search for","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"If the booking has any recordings","in":"query","name":"hasRecordings","schema":{"type":"boolean"}},{"description":"Search bookings with at least one associated capture session with one of the statuses listed","in":"query","name":"captureSessionStatusIn","schema":{"type":"string"}},{"description":"Bookings where the associated capture sessions do not match status or bookings without sessions","in":"query","name":"captureSessionStatusNotIn","schema":{"type":"string"}},{"description":"Sort by","example":"createdAt,desc","in":"query","name":"sort","schema":{"type":"string"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelBookingDTO"}}},"description":"OK"}},"summary":"Search All Bookings using Case Id, Case Ref, or Scheduled For","tags":["booking-controller"]}},"/bookings/migrate-case/{bookingId}":{"put":{"operationId":"migrateToDifferentCaseReference","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBookingCaseDTO"}}},"required":true},"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/BookingDTO"}}},"description":"OK"}},"summary":"Migrate a Booking to a different case reference","tags":["booking-controller"]}},"/bookings/{bookingId}":{"delete":{"operationId":"deleteBooking","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Delete a Booking","tags":["booking-controller"]},"get":{"operationId":"getBookingById","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/BookingDTO"}}},"description":"OK"}},"summary":"Get a Booking by Id","tags":["booking-controller"]},"put":{"operationId":"putBooking","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBookingDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a Booking","tags":["booking-controller"]}},"/bookings/{bookingId}/share":{"get":{"operationId":"getSharedBookingLogs","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelShareBookingDTO"}}},"description":"OK"}},"tags":["booking-controller"]},"put":{"operationId":"shareBookingById","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateShareBookingDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Share a Booking","tags":["booking-controller"]}},"/bookings/{bookingId}/share/{shareId}":{"delete":{"operationId":"deleteShareBookingById","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"shareId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"tags":["booking-controller"]}},"/bookings/{bookingId}/undelete":{"post":{"operationId":"undeleteBooking","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Revert deletion of a booking","tags":["booking-controller"]}},"/capture-sessions":{"get":{"operationId":"searchCaptureSessions","parameters":[{"description":"The case reference to search for","example":1234567890123456,"in":"query","name":"caseReference","schema":{"type":"string"}},{"description":"The booking id to search for","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"bookingId","schema":{"type":"string","format":"uuid"}},{"description":"The origin of the capture session to search for","in":"query","name":"origin","schema":{"type":"string","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]}},{"description":"The recording status to search for","in":"query","name":"recordingStatus","schema":{"type":"string","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]}},{"description":"The Date the Booking was scheduled for","example":"2024-04-27","in":"query","name":"scheduledFor","schema":{"type":"string","format":"date"}},{"description":"The court id of the capture session to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelCaptureSessionDTO"}}},"description":"OK"}},"summary":"Search All Capture Sessions","tags":["capture-session-controller"]}},"/capture-sessions/trigger-registration/{captureSessionId}":{"put":{"operationId":"triggerRegistrationForCaptureSession","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Register a Capture Session that got stuck in PROCESSING state","tags":["capture-session-controller"]}},"/capture-sessions/{captureSessionId}":{"delete":{"operationId":"deleteCaptureSessionById","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Delete Capture Session by Id","tags":["capture-session-controller"]},"get":{"operationId":"getCaptureSessionById","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaptureSessionDTO"}}},"description":"OK"}},"summary":"Get a Capture Session by Id","tags":["capture-session-controller"]},"put":{"operationId":"upsertCaptureSession","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCaptureSessionDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a Capture Session","tags":["capture-session-controller"]}},"/capture-sessions/{captureSessionId}/undelete":{"post":{"operationId":"undeleteCaptureSession","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Revert deletion of a capture session","tags":["capture-session-controller"]}},"/cases":{"get":{"operationId":"getCases","parameters":[{"description":"The case reference to search by","example":1234567890123456,"in":"query","name":"reference","schema":{"type":"string"}},{"description":"The court id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"Include cases marked as deleted","in":"query","name":"includeDeleted","schema":{"type":"boolean"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelCaseDTO"}}},"description":"OK"}},"summary":"Get a case by reference or court id","tags":["case-controller"]}},"/cases/close-pending":{"post":{"operationId":"closePendingCases","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Close cases in PENDING_CLOSURE state > 29 days","tags":["case-controller"]}},"/cases/{id}":{"delete":{"operationId":"deleteCase","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Mark a Case as deleted","tags":["case-controller"]},"get":{"operationId":"getCaseById","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaseDTO"}}},"description":"OK"}},"summary":"Get a case by id","tags":["case-controller"]},"put":{"operationId":"putCase","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCaseDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a Case","tags":["case-controller"]}},"/cases/{id}/undelete":{"post":{"operationId":"undeleteCase","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Revert deletion of a case","tags":["case-controller"]}},"/courts":{"get":{"operationId":"searchCourts","parameters":[{"description":"The type of the court to search by","in":"query","name":"courtType","schema":{"type":"string","enum":["CROWN","MAGISTRATE","FAMILY"]}},{"description":"The name of the court to search by","example":"Example","in":"query","name":"name","schema":{"type":"string"}},{"description":"The location code of the court to search by","in":"query","name":"locationCode","schema":{"type":"string"}},{"description":"The region name of the court to search by","example":"London","in":"query","name":"regionName","schema":{"type":"string"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelCourtDTO"}}},"description":"OK"}},"summary":"Search for Courts by court type, name, location code or region name","tags":["court-controller"]}},"/courts/email":{"post":{"operationId":"updateCourtEmailAddresses","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"required":["file"],"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CourtEmailDTO"}}}},"description":"OK"}},"tags":["court-controller"]}},"/courts/{courtId}":{"get":{"operationId":"getCourtById","parameters":[{"in":"path","name":"courtId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CourtDTO"}}},"description":"OK"}},"summary":"Get a Court by Id","tags":["court-controller"]},"put":{"operationId":"putCourt","parameters":[{"in":"path","name":"courtId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCourtDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a Court","tags":["court-controller"]}},"/edits":{"get":{"operationId":"searchEdits","parameters":[{"description":"The source recording's id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"sourceRecordingId","schema":{"type":"string","format":"uuid"}},{"description":"The date of last modification to search after","example":"2024-04-27","in":"query","name":"lastModifiedAfter","schema":{"type":"string","format":"date"}},{"description":"The date of last modification to search before","example":"2024-04-27","in":"query","name":"lastModifiedBefore","schema":{"type":"string","format":"date"}},{"description":"Sort by","example":"createdAt,desc","in":"query","name":"sort","schema":{"type":"string"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelEditRequestDTO"}}},"description":"OK"}},"tags":["edit-controller"]}},"/edits/from-csv/{sourceRecordingId}":{"post":{"operationId":"createEditFromCsv","parameters":[{"in":"path","name":"sourceRecordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"required":["file"],"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/EditRequestDTO"}}},"description":"OK"}},"tags":["edit-controller"]}},"/edits/{id}":{"delete":{"operationId":"delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEditRequestDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"tags":["edit-controller"]},"get":{"operationId":"getEditRequestById","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/EditRequestDTO"}}},"description":"OK"}},"tags":["edit-controller"]},"put":{"operationId":"upsertEditRequest","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEditRequestDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"tags":["edit-controller"]}},"/health":{"get":{"operationId":"health","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}},"application/vnd.spring-boot.actuator.v2+json":{"schema":{"type":"object"}},"application/vnd.spring-boot.actuator.v3+json":{"schema":{"type":"object"}}},"description":"OK"}},"summary":"Actuator web endpoint 'health'","tags":["Actuator"]}},"/invites":{"get":{"operationId":"searchInvites","parameters":[{"description":"The first name of the user to search by","in":"query","name":"firstName","schema":{"type":"string"}},{"description":"The last name of the user to search by","in":"query","name":"lastName","schema":{"type":"string"}},{"description":"The email of the user to search by","example":"example@example.com","in":"query","name":"email","schema":{"type":"string"}},{"description":"The organisation of the user to search by","in":"query","name":"organisation","schema":{"type":"string"}},{"description":"The access status of the user to search by","in":"query","name":"status","schema":{"type":"string","enum":["INVITATION_SENT","REGISTERED","ACTIVE","INACTIVE"]}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelInviteDTO"}}},"description":"OK"}},"summary":"Search for Invites by first name, last name, email or organisation","tags":["invite-controller"]}},"/invites/redeem":{"post":{"operationId":"redeemInvite","parameters":[{"description":"The email of the user to redeem the invite for","example":"example@example.com","in":"query","name":"email","required":true,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Redeem an invite","tags":["invite-controller"]}},"/invites/{userId}":{"delete":{"operationId":"deleteInvite","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Delete the user with invitation sent status","tags":["invite-controller"]},"get":{"operationId":"getInviteById","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/InviteDTO"}}},"description":"OK"}},"summary":"Get an invite by user id","tags":["invite-controller"]},"put":{"operationId":"putInvite","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInviteDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create a portal access user and invite them","tags":["invite-controller"]}},"/media-service/assets":{"get":{"operationId":"getAssets","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AssetDTO"}}}},"description":"OK"}},"summary":"Get all media service assets","tags":["media-service-controller"]}},"/media-service/assets/{assetName}":{"get":{"operationId":"getAssetsByName","parameters":[{"in":"path","name":"assetName","required":true,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/AssetDTO"}}},"description":"OK"}},"summary":"Get a media service asset by name","tags":["media-service-controller"]}},"/media-service/blob/{containerName}":{"get":{"operationId":"checkBlobExists","parameters":[{"in":"path","name":"containerName","required":true,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"boolean"}}},"description":"OK"}},"summary":"Checks if a container contains the .ism file. 204 on success, 404 on failure.","tags":["media-service-controller"]}},"/media-service/generate-asset":{"post":{"operationId":"generateAsset","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateAssetDTO"}}},"required":true},"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/GenerateAssetResponseDTO"}}},"description":"OK"}},"summary":"LEGACY - Given a source & destination, this endpoint will generate a streaming asset for a given mp4","tags":["media-service-controller"]}},"/media-service/health":{"get":{"operationId":"mediaServiceHealth","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"string"}}},"description":"OK"}},"summary":"Check the status of the media service connection","tags":["media-service-controller"]}},"/media-service/live-event/check/{captureSessionId}":{"post":{"operationId":"checkStream","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaptureSessionDTO"}}},"description":"OK"}},"summary":"Check stream has started","tags":["media-service-controller"]}},"/media-service/live-event/end/{captureSessionId}":{"put":{"operationId":"stopLiveEvent","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaptureSessionDTO"}}},"description":"OK"}},"summary":"Stop a live event","tags":["media-service-controller"]}},"/media-service/live-event/start/{captureSessionId}":{"put":{"operationId":"startLiveEvent","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaptureSessionDTO"}}},"description":"OK"}},"summary":"Start a live event","tags":["media-service-controller"]}},"/media-service/live-events":{"get":{"operationId":"getLiveEvents","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LiveEventDTO"}}}},"description":"OK"}},"summary":"Get a list of media service live events","tags":["media-service-controller"]}},"/media-service/live-events/{liveEventName}":{"get":{"operationId":"getLiveEventsByName","parameters":[{"in":"path","name":"liveEventName","required":true,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/LiveEventDTO"}}},"description":"OK"}},"summary":"Get a media service live event by name","tags":["media-service-controller"]}},"/media-service/streaming-locator/live-event/{captureSessionId}":{"put":{"operationId":"playLiveEvent","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaptureSessionDTO"}}},"description":"OK"}},"summary":"Play a live event","tags":["media-service-controller"]}},"/media-service/vod":{"get":{"operationId":"getVod","parameters":[{"in":"query","name":"recordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"mediaService","required":false,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PlaybackDTO"}}},"description":"OK"}},"tags":["media-service-controller"]}},"/portal-terms-and-conditions/latest":{"get":{"operationId":"getLatestTermsForPortal","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/TermsAndConditionsDTO"}}},"description":"OK"}},"summary":"Get the latest terms and conditions for the portal","tags":["terms-and-conditions-controller"]}},"/recordings":{"get":{"operationId":"getRecordings","parameters":[{"description":"Partial string of the recording id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"id","schema":{"type":"string"}},{"description":"The capture session to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"captureSessionId","schema":{"type":"string","format":"uuid"}},{"description":"The parent recording to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"parentRecordingId","schema":{"type":"string","format":"uuid"}},{"description":"The participant to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"participantId","schema":{"type":"string","format":"uuid"}},{"description":"The name of a witness to search by","in":"query","name":"witnessName","schema":{"type":"string"}},{"description":"The name of a defendant to search by","in":"query","name":"defendantName","schema":{"type":"string"}},{"description":"The case reference to search by","example":"CASE12345","in":"query","name":"caseReference","schema":{"type":"string"}},{"description":"The Date the recording's capture session was started at","example":"2024-04-27","in":"query","name":"startedAt","schema":{"type":"string","format":"date"}},{"description":"The court to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"Include recordings marked as deleted","in":"query","name":"includeDeleted","schema":{"type":"boolean"}},{"description":"The version number to search by","in":"query","name":"version","schema":{"type":"integer","format":"int32"}},{"description":"The case status to search by","in":"query","name":"caseOpen","schema":{"type":"boolean"}},{"description":"Sort by","example":"createdAt,desc","in":"query","name":"sort","schema":{"type":"string"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelRecordingDTO"}}},"description":"OK"}},"summary":"Search all Recordings","tags":["recording-controller"]}},"/recordings/{recordingId}":{"delete":{"operationId":"deleteRecording","parameters":[{"in":"path","name":"recordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Delete a Recording","tags":["recording-controller"]},"get":{"operationId":"getRecordingById","parameters":[{"in":"path","name":"recordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/RecordingDTO"}}},"description":"OK"}},"summary":"Get a Recording by Id","tags":["recording-controller"]},"put":{"operationId":"putRecordings","parameters":[{"in":"path","name":"recordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecordingDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a Recording","tags":["recording-controller"]}},"/recordings/{recordingId}/undelete":{"post":{"operationId":"undeleteRecording","parameters":[{"in":"path","name":"recordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Revert deletion of a recording","tags":["recording-controller"]}},"/reports-v2/capture-sessions-concurrent":{"get":{"operationId":"reportConcurrentCaptureSessionsv2","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ConcurrentCaptureSessionReportDTOV2"}}}},"description":"OK"}},"tags":["report-controller"]}},"/reports-v2/completed-capture-sessions":{"get":{"operationId":"reportCompletedCaptureSessions_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CompletedCaptureSessionReportDTOV2"}}}},"description":"OK"}},"summary":"Get a report on capture sessions with available recordings v2","tags":["report-controller"]}},"/reports-v2/edits":{"get":{"operationId":"reportEdits_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EditReportDTOV2"}}}},"description":"OK"}},"summary":"Get a report on recordings edits v2","tags":["report-controller"]}},"/reports-v2/playback":{"get":{"operationId":"reportPlayback_1","parameters":[{"description":"The source of the playback. Only accepts PORTAL, APPLICATION or null","in":"query","name":"source","required":false,"schema":{"type":"string","enum":["APPLICATION","PORTAL","ADMIN","AUTO"]}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlaybackReportDTOV2"}}}},"description":"OK"}},"summary":"Get report on playback by playback source (PORTAL, APPLICATION) v2","tags":["report-controller"]}},"/reports-v2/recording-participants":{"get":{"operationId":"reportRecordingParticipants_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecordingParticipantsReportDTO"}}}},"description":"OK"}},"summary":"Get report on participants and the recordings they are part of v2","tags":["report-controller"]}},"/reports-v2/recordings-per-case":{"get":{"operationId":"reportRecordingsPerCase_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecordingsPerCaseReportDTOV2"}}}},"description":"OK"}},"summary":"Get the number of completed capture sessions for each case v2","tags":["report-controller"]}},"/reports-v2/schedules":{"get":{"operationId":"reportSchedules_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ScheduleReportDTOV2"}}}},"description":"OK"}},"summary":"Get a list of completed capture sessions with booking details v2","tags":["report-controller"]}},"/reports-v2/share-bookings-removed":{"get":{"operationId":"reportShareBookingRemoved_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccessRemovedReportDTOV2"}}}},"description":"OK"}},"summary":"Get report on booking share removal v2","tags":["report-controller"]}},"/reports-v2/shared-bookings":{"get":{"operationId":"reportBookingsShared_1","parameters":[{"description":"The court id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"The booking id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"bookingId","schema":{"type":"string","format":"uuid"}},{"description":"The id of the user the booking is shared with to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"sharedWithId","schema":{"type":"string","format":"uuid"}},{"description":"The email of the user the booking is shared with to search by","example":"example@example.com","in":"query","name":"sharedWithEmail","schema":{"type":"string"}},{"description":"The shares must be active (not deleted) then true, otherwise false","example":true,"in":"query","name":"onlyActive","schema":{"type":"boolean"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SharedReportDTOV2"}}}},"description":"OK"}},"summary":"Get a report on the bookings that have been shared v2","tags":["report-controller"]}},"/reports-v2/user-full-access-report":{"get":{"operationId":"reportUserFullAccess","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserAccessReportDTO"}}}},"description":"OK"}},"summary":"Get full report on app users","tags":["report-controller"]}},"/reports-v2/user-full-access-report-csv":{"get":{"operationId":"reportUserFullAccessCsv","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"text/csv":{"schema":{"type":"string","format":"byte"}}},"description":"OK"}},"summary":"Get full report on app users in CSV format","tags":["report-controller"]}},"/reports-v2/user-primary-courts":{"get":{"operationId":"reportUserPrimaryCourts_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserPrimaryCourtReportDTO"}}}},"description":"OK"}},"summary":"Get report on app users and their primary courts v2","tags":["report-controller"]}},"/reports-v2/user-recording-playback":{"get":{"operationId":"userRecordingPlaybackReport","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserRecordingPlaybackReportDTOV2"}}}},"description":"OK"}},"summary":"Get report on playback by playback for all sources v2","tags":["report-controller"]}},"/reports/capture-sessions-concurrent":{"get":{"operationId":"reportConcurrentCaptureSessions","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ConcurrentCaptureSessionReportDTO"}}}},"description":"OK"}},"tags":["legacy-report-controller"]}},"/reports/completed-capture-sessions":{"get":{"operationId":"reportCompletedCaptureSessions","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CompletedCaptureSessionReportDTO"}}}},"description":"OK"}},"summary":"Get a report on capture sessions with available recordings","tags":["legacy-report-controller"]}},"/reports/edits":{"get":{"operationId":"reportEdits","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EditReportDTO"}}}},"description":"OK"}},"summary":"Get a report on recordings edits","tags":["legacy-report-controller"]}},"/reports/playback":{"get":{"operationId":"reportPlayback","parameters":[{"description":"The source of the playback. Only accepts PORTAL, APPLICATION or null","in":"query","name":"source","required":false,"schema":{"type":"string","enum":["APPLICATION","PORTAL","ADMIN","AUTO"]}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlaybackReportDTO"}}}},"description":"OK"}},"summary":"Get report on playback by playback source (PORTAL, APPLICATION)","tags":["legacy-report-controller"]}},"/reports/recording-participants":{"get":{"operationId":"reportRecordingParticipants","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecordingParticipantsReportDTO"}}}},"description":"OK"}},"summary":"Get report on participants and the recordings they are part of","tags":["legacy-report-controller"]}},"/reports/recordings-per-case":{"get":{"operationId":"reportRecordingsPerCase","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecordingsPerCaseReportDTO"}}}},"description":"OK"}},"summary":"Get the number of completed capture sessions for each case","tags":["legacy-report-controller"]}},"/reports/schedules":{"get":{"operationId":"reportSchedules","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ScheduleReportDTO"}}}},"description":"OK"}},"summary":"Get a list of completed capture sessions with booking details","tags":["legacy-report-controller"]}},"/reports/share-bookings-removed":{"get":{"operationId":"reportShareBookingRemoved","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccessRemovedReportDTO"}}}},"description":"OK"}},"summary":"Get report on booking share removal","tags":["legacy-report-controller"]}},"/reports/shared-bookings":{"get":{"operationId":"reportBookingsShared","parameters":[{"description":"The court id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"The booking id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"bookingId","schema":{"type":"string","format":"uuid"}},{"description":"The id of the user the booking is shared with to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"sharedWithId","schema":{"type":"string","format":"uuid"}},{"description":"The email of the user the booking is shared with to search by","example":"example@example.com","in":"query","name":"sharedWithEmail","schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SharedReportDTO"}}}},"description":"OK"}},"summary":"Get a report on the bookings that have been shared","tags":["legacy-report-controller"]}},"/reports/user-primary-courts":{"get":{"operationId":"reportUserPrimaryCourts","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserPrimaryCourtReportDTO"}}}},"description":"OK"}},"summary":"Get report on app users: their first and last name, their role, their active status, their primary court and their last access time (if available)","tags":["legacy-report-controller"]}},"/roles":{"get":{"operationId":"getRoles","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RoleDTO"}}}},"description":"OK"}},"summary":"Get a list of all roles","tags":["role-controller"]}},"/users":{"get":{"operationId":"getUsers","parameters":[{"description":"The name of the user to search by","in":"query","name":"name","schema":{"type":"string"}},{"description":"The email of the user to search by","example":"example@example.com","in":"query","name":"email","schema":{"type":"string"}},{"description":"The organisation of the user to search by","in":"query","name":"organisation","schema":{"type":"string"}},{"description":"The court id of the user to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"The role id of the user to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"roleId","schema":{"type":"string","format":"uuid"}},{"description":"Get Users by their access type","in":"query","name":"accessType","schema":{"type":"string","enum":["PORTAL","APP"]}},{"description":"Include users marked as deleted","in":"query","name":"includeDeleted","schema":{"type":"boolean"}},{"description":"Filter by users with active app access","in":"query","name":"appActive","schema":{"type":"boolean"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelUserDTO"}}},"description":"OK"}},"summary":"Search for Users by first name, last name, email, organisation, court or role","tags":["user-controller"]}},"/users/by-email/{email}":{"get":{"operationId":"getUserAccessByEmail","parameters":[{"in":"path","name":"email","required":true,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDTO"}}},"description":"OK"}},"summary":"Get a User's App Access by Email","tags":["user-controller"]}},"/users/{userId}":{"delete":{"operationId":"deleteUser","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Delete a User","tags":["user-controller"]},"get":{"operationId":"getUserById","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/UserDTO"}}},"description":"OK"}},"summary":"Get a User by Id","tags":["user-controller"]},"put":{"operationId":"putUser","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUserDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a User","tags":["user-controller"]}},"/users/{userId}/undelete":{"post":{"operationId":"undeleteUser","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Revert deletion of user","tags":["user-controller"]}},"/vf-migration-records":{"get":{"operationId":"getVfMigrationRecords","parameters":[{"description":"The case reference to search for","in":"query","name":"caseReference","schema":{"type":"string"}},{"description":"The witness name to search for","in":"query","name":"witnessName","schema":{"type":"string"}},{"description":"The defendant name to search for","in":"query","name":"defendantName","schema":{"type":"string"}},{"description":"The court id to search for","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"The court reference to search for","in":"query","name":"courtReference","schema":{"type":"string"}},{"description":"The status to search for","in":"query","name":"status","schema":{"type":"string","enum":["PENDING","SUCCESS","FAILED","READY","SUBMITTED","IGNORED"]}},{"description":"The date the record was created to search from","example":"2024-04-27","in":"query","name":"createDateFrom","schema":{"type":"string","format":"date"}},{"description":"The date the record was created to search to","example":"2024-04-27","in":"query","name":"createDateTo","schema":{"type":"string","format":"date"}},{"description":"Search by a list of reasons","in":"query","name":"reasonIn","schema":{"type":"string"}},{"description":"Search by a list of reasons that should not be included","in":"query","name":"reasonNotIn","schema":{"type":"string"}},{"description":"Sort by","example":"archiveName,desc","in":"query","name":"sort","schema":{"type":"string"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelVfMigrationRecordDTO"}}},"description":"OK"}},"summary":"Search all migration records","tags":["vf-migration-controller"]}},"/vf-migration-records/import-assets":{"post":{"operationId":"importVodafoneAssets","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Imports Vodafone for resolbed migration records","tags":["vf-migration-controller"]}},"/vf-migration-records/submit":{"post":{"operationId":"submitMigrationRecords","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Submits resolved migration records and runs import","tags":["vf-migration-controller"]}},"/vf-migration-records/{id}":{"put":{"operationId":"putVfMigrationRecord","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateVfMigrationRecordDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Update vf migration record","tags":["vf-migration-controller"]}}},"components":{"schemas":{"AccessDTO":{"type":"object","properties":{"app_access":{"uniqueItems":true,"type":"array","description":"AccessAppAccess","items":{"$ref":"#/components/schemas/BaseAppAccessDTO"}},"portal_access":{"uniqueItems":true,"type":"array","description":"AccessPortalAccess","items":{"$ref":"#/components/schemas/PortalAccessDTO"}},"terms_accepted":{"type":"object","additionalProperties":{"type":"boolean","description":"UserTermsAccepted"},"description":"UserTermsAccepted"},"user":{"$ref":"#/components/schemas/BaseUserDTO"}},"description":"AccessDTO"},"AccessRemovedReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"AccessRemovedReportCaseReference"},"court":{"type":"string","description":"AccessRemovedReportCourtName"},"regions":{"uniqueItems":true,"type":"array","description":"AccessRemovedReportRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"removal_reason":{"type":"string","description":"AccessRemovedReportRemovalReason"},"removed_at":{"type":"string","description":"AccessRemovedReportRemovedAt","format":"date-time"},"user_email":{"type":"string","description":"AccessRemovedReportUserEmail"},"user_full_name":{"type":"string","description":"AccessRemovedReportUserFullName"}},"description":"AccessRemovedReportDTO"},"AccessRemovedReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"full_name":{"type":"string","description":"AccessRemovedReportUserFullName"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"},"removed_date":{"type":"string","description":"AccessRemovedReportRemovedDate"},"removed_time":{"type":"string","description":"AccessRemovedReportRemovedTime"},"removed_timezone":{"type":"string","description":"AccessRemovedReportRemovedTimezone"},"user_email":{"type":"string","description":"AccessRemovedReportUserEmail"}},"description":"AccessRemovedReportDTOV2"},"AssetDTO":{"type":"object","properties":{"container":{"type":"string","description":"AssetContainer"},"description":{"type":"string","description":"AssetDescription"},"name":{"type":"string","description":"AssetName"},"storage_account_name":{"type":"string","description":"AssetStorageAccountName"}},"description":"AssetDTO"},"BaseAppAccessDTO":{"type":"object","properties":{"active":{"type":"boolean","description":"AppAccessActive"},"court":{"$ref":"#/components/schemas/CourtDTO"},"created_at":{"type":"string","description":"AppAccessCreatedAt","format":"date-time"},"default_court":{"type":"boolean","description":"AppAccessIsDefaultCourt"},"id":{"type":"string","description":"AppAccessId","format":"uuid"},"last_access":{"type":"string","description":"AppAccessLastAccess","format":"date-time"},"role":{"$ref":"#/components/schemas/RoleDTO"}},"description":"BaseAppAccessDTO"},"BaseUserDTO":{"required":["email","first_name","id","last_name"],"type":"object","properties":{"alternative_email":{"type":"string","format":"email","description":"AlternativeEmail","maxLength":100,"minLength":0},"email":{"type":"string","format":"email","description":"UserEmail","minLength":1},"first_name":{"minLength":1,"type":"string","description":"UserFirstName"},"id":{"type":"string","description":"UserId","format":"uuid"},"last_name":{"minLength":1,"type":"string","description":"UserLastName"},"organisation":{"type":"string","description":"UserOrganisation"},"phone_number":{"type":"string","description":"UserPhoneNumber"}},"description":"BaseUserDTO"},"BookingDTO":{"type":"object","properties":{"capture_sessions":{"type":"array","description":"CaptureSessions","items":{"$ref":"#/components/schemas/CaptureSessionDTO"}},"case_dto":{"$ref":"#/components/schemas/CaseDTO"},"created_at":{"type":"string","description":"BookingCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"BookingDeletedAt","format":"date-time"},"id":{"type":"string","description":"BookingId","format":"uuid"},"modified_at":{"type":"string","description":"BookingModifiedAt","format":"date-time"},"participants":{"type":"array","description":"BookingParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"scheduled_for":{"type":"string","description":"BookingScheduledFor","format":"date-time"},"shares":{"type":"array","description":"BookingShares","items":{"$ref":"#/components/schemas/ShareBookingDTO"}}},"description":"BookingDTO"},"CaptureSessionDTO":{"required":["booking_id","id","origin","status"],"type":"object","properties":{"booking_id":{"type":"string","description":"CreateCaptureSessionBookingId","format":"uuid"},"case_closed_at":{"type":"string","description":"CaptureSessionCaseClosedAt","format":"date-time"},"case_state":{"type":"string","description":"CaptureSessionCaseState","enum":["OPEN","PENDING_CLOSURE","CLOSED"]},"court_name":{"type":"string","description":"RecordingParticipants"},"deleted_at":{"type":"string","description":"CaptureSessionDeletedAt","format":"date-time"},"finished_at":{"type":"string","description":"CreateCaptureSessionFinishedAt","format":"date-time"},"finished_by_user_id":{"type":"string","description":"CreateCaptureSessionFinishedByUserId","format":"uuid"},"id":{"type":"string","description":"CreateCaptureSessionId","format":"uuid"},"ingest_address":{"type":"string","description":"CreateCaptureSessionIngestAddress"},"live_output_url":{"type":"string","description":"CreateCaptureSessionLiveOutputURL"},"origin":{"type":"string","description":"CreateCaptureSessionOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"started_at":{"type":"string","description":"CreateCaptureSessionStartedAt","format":"date-time"},"started_by_user_id":{"type":"string","description":"CreateCaptureSessionStartedByUserId","format":"uuid"},"status":{"type":"string","description":"CreateCaptureSessionStatus","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]}},"description":"CaptureSessionDTO"},"CaseDTO":{"type":"object","properties":{"closed_at":{"type":"string","description":"CaseClosedAt","format":"date-time"},"court":{"$ref":"#/components/schemas/CourtDTO"},"created_at":{"type":"string","description":"CaseCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"CaseDeletedAt","format":"date-time"},"id":{"type":"string","description":"CaseId","format":"uuid"},"modified_at":{"type":"string","description":"CaseModifiedAt","format":"date-time"},"origin":{"type":"string","description":"CaseOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"participants":{"type":"array","description":"CaseParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"reference":{"type":"string","description":"CaseReference"},"state":{"type":"string","description":"CaseState","enum":["OPEN","PENDING_CLOSURE","CLOSED"]},"test":{"type":"boolean","description":"CaseIsTest"}},"description":"CaseDTO"},"CompletedCaptureSessionReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"CompletedCaptureSessionReportCaseReference"},"count_defendants":{"type":"integer","description":"CompletedCaptureSessionReportDefendantCount","format":"int32"},"count_witnesses":{"type":"integer","description":"CompletedCaptureSessionReportWitnessCount","format":"int32"},"court":{"type":"string","description":"CompletedCaptureSessionReportCourtName"},"duration":{"type":"string","description":"CompletedCaptureSessionReportDuration"},"finished_at":{"type":"string","description":"CompletedCaptureSessionReportFinishedAt","format":"date-time"},"recording_status":{"type":"string","description":"CompletedCaptureSessionReportRecordingStatus","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]},"regions":{"uniqueItems":true,"type":"array","description":"CompletedCaptureSessionReportRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"scheduled_for":{"type":"string","description":"CompletedCaptureSessionReportBookingScheduledFor","format":"date-time"},"started_at":{"type":"string","description":"CompletedCaptureSessionReportStartedAt","format":"date-time"}},"description":"CompletedCaptureSessionReportDTO"},"CompletedCaptureSessionReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"defendant":{"type":"integer","description":"CompletedCaptureSessionReportDefendantCount","format":"int32"},"defendant_names":{"type":"string","description":"CompletedCaptureSessionReportDefendantNames"},"finish_time":{"type":"string","description":"CompletedCaptureSessionReportFinishTime"},"postcode":{"type":"string","description":"ReportPostcode"},"recording_date":{"type":"string","description":"CompletedCaptureSessionReportRecordingDate"},"recording_time":{"type":"string","description":"CompletedCaptureSessionReportRecordingTime"},"region":{"type":"string","description":"ReportRegion"},"scheduled_date":{"type":"string","description":"CompletedCaptureSessionReportScheduledDate"},"status":{"type":"string","description":"CompletedCaptureSessionReportStatus","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]},"timezone":{"type":"string","description":"CompletedCaptureSessionReportTimezone"},"witness":{"type":"integer","description":"CompletedCaptureSessionReportWitnessCount","format":"int32"},"witness_names":{"type":"string","description":"CompletedCaptureSessionReportWitnessNames"}},"description":"CompletedCaptureSessionReportDTOV2"},"ConcurrentCaptureSessionReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"CaptureSessionCaseReference"},"court":{"type":"string","description":"CaptureSessionCourtName"},"duration":{"type":"string","description":"CaptureSessionDuration"},"end_time":{"type":"string","description":"CaptureSessionEndTime","format":"date-time"},"id":{"type":"string","description":"CaptureSessionId","format":"uuid"},"region":{"uniqueItems":true,"type":"array","description":"CaptureSessionRegionName","items":{"$ref":"#/components/schemas/RegionDTO"}},"start_time":{"type":"string","description":"CaptureSessionStartTime","format":"date-time"}},"description":"ConcurrentCaptureSessionReportDTO"},"ConcurrentCaptureSessionReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"date":{"type":"string","description":"CaptureSessionStartDate"},"duration":{"type":"string","description":"CaptureSessionDuration"},"end_time":{"type":"string","description":"CaptureSessionEndTime"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"},"start_time":{"type":"string","description":"CaptureSessionStartTime"},"timezone":{"type":"string","description":"CaptureSessionStartTimezone"}},"description":"ConcurrentCaptureSessionReportDTOV2"},"CourtDTO":{"type":"object","properties":{"county":{"type":"string","description":"CourtCounty"},"court_type":{"type":"string","description":"CourtType","enum":["CROWN","MAGISTRATE","FAMILY"]},"group_email":{"type":"string","description":"CourtGroupEmail"},"id":{"type":"string","description":"CourtId","format":"uuid"},"location_code":{"type":"string","description":"CourtLocationCode"},"name":{"type":"string","description":"CourtName"},"postcode":{"type":"string","description":"CourtPostcode"},"regions":{"type":"array","description":"CourtRegions","items":{"$ref":"#/components/schemas/RegionDTO"}}},"description":"CourtDTO"},"CourtEmailDTO":{"type":"object","properties":{"group_email":{"type":"string","description":"CourtGroupEmail"},"name":{"type":"string","description":"CourtName"}},"description":"CourtEmailDTO"},"CreateAppAccessDTO":{"required":["court_id","id","role_id","user_id"],"type":"object","properties":{"active":{"type":"boolean","description":"AppAccessActive"},"court_id":{"type":"string","description":"AppAccessCourtId","format":"uuid"},"default_court":{"type":"boolean","description":"AppAccessIsDefaultCourt"},"id":{"type":"string","description":"AppAccessId","format":"uuid"},"last_active":{"type":"string","description":"AppAccessLastActive","format":"date-time"},"role_id":{"type":"string","description":"AppAccessRoleId","format":"uuid"},"user_id":{"type":"string","description":"AppAccessUserId","format":"uuid"}},"description":"CreateAppAccessDTO"},"CreateAuditDTO":{"required":["id","source"],"type":"object","properties":{"activity":{"type":"string","description":"AuditActivity"},"audit_details":{"$ref":"#/components/schemas/JsonNode"},"category":{"type":"string","description":"AuditCategory"},"functional_area":{"type":"string","description":"AuditFunctionalArea"},"id":{"type":"string","description":"AuditId","format":"uuid"},"source":{"type":"string","description":"AuditLogSource","enum":["APPLICATION","PORTAL","ADMIN","AUTO"]},"table_name":{"type":"string","description":"AuditTableName"},"table_record_id":{"type":"string","description":"AuditTableNameRecordId","format":"uuid"}},"description":"AuditDTO"},"CreateBookingDTO":{"required":["case_id","id","scheduled_for"],"type":"object","properties":{"case_id":{"type":"string","description":"CreateBookingCaseId","format":"uuid"},"id":{"type":"string","description":"CreateBookingId","format":"uuid"},"participants":{"uniqueItems":true,"type":"array","description":"CreateBookingParticipants","items":{"$ref":"#/components/schemas/CreateParticipantDTO"}},"scheduled_for":{"type":"string","description":"CreateBookingScheduledFor","format":"date-time"}},"description":"CreateBookingDTO"},"CreateCaptureSessionDTO":{"required":["booking_id","id","origin","status"],"type":"object","properties":{"booking_id":{"type":"string","description":"CreateCaptureSessionBookingId","format":"uuid"},"finished_at":{"type":"string","description":"CreateCaptureSessionFinishedAt","format":"date-time"},"finished_by_user_id":{"type":"string","description":"CreateCaptureSessionFinishedByUserId","format":"uuid"},"id":{"type":"string","description":"CreateCaptureSessionId","format":"uuid"},"ingest_address":{"type":"string","description":"CreateCaptureSessionIngestAddress"},"live_output_url":{"type":"string","description":"CreateCaptureSessionLiveOutputURL"},"origin":{"type":"string","description":"CreateCaptureSessionOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"started_at":{"type":"string","description":"CreateCaptureSessionStartedAt","format":"date-time"},"started_by_user_id":{"type":"string","description":"CreateCaptureSessionStartedByUserId","format":"uuid"},"status":{"type":"string","description":"CreateCaptureSessionStatus","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]}},"description":"CreateCaptureSessionDTO"},"CreateCaseDTO":{"required":["reference"],"type":"object","properties":{"closed_at":{"type":"string","description":"CreateCaseClosedAt","format":"date-time"},"court_id":{"type":"string","description":"CreateCaseCourtId","format":"uuid"},"id":{"type":"string","description":"CreateCaseId","format":"uuid"},"origin":{"type":"string","description":"CreateCaseOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"participants":{"uniqueItems":true,"type":"array","description":"CaseParticipants","items":{"$ref":"#/components/schemas/CreateParticipantDTO"}},"reference":{"maxLength":13,"minLength":9,"type":"string","description":"CreateCaseReference"},"state":{"type":"string","description":"CreateCaseState","enum":["OPEN","PENDING_CLOSURE","CLOSED"]},"test":{"type":"boolean","description":"CreateCaseIsTest"}},"description":"CreateCaseDTO"},"CreateCourtDTO":{"required":["court_type","id","location_code","name","regions"],"type":"object","properties":{"county":{"type":"string","description":"CreateCourtCounty"},"court_type":{"type":"string","description":"CreateCourtType","enum":["CROWN","MAGISTRATE","FAMILY"]},"group_email":{"type":"string","description":"CreateCourtGroupEmail"},"id":{"type":"string","description":"CreateCourtId","format":"uuid"},"location_code":{"type":"string","description":"CreateCourtLocationCode"},"name":{"type":"string","description":"CreateCourtName"},"postcode":{"pattern":"^[A-Z]{1,2}[0-9][0-9A-Z]? [0-9][A-Z]{2}$","type":"string","description":"CreateCourtPostcode"},"regions":{"maxItems":2147483647,"minItems":1,"type":"array","description":"CreateCourtRegionIds","items":{"type":"string","description":"CreateCourtRegionIds","format":"uuid"}}},"description":"CreateCourtDTO"},"CreateEditRequestDTO":{"required":["id","source_recording_id","status"],"type":"object","properties":{"approved_at":{"type":"string","description":"CreateEditRequestApprovedAt","format":"date-time"},"approved_by":{"maxLength":100,"minLength":0,"type":"string","description":"CreateEditRequestApprovedBy"},"edit_instructions":{"type":"array","description":"CreateEditRequestInstructions","items":{"$ref":"#/components/schemas/EditCutInstructionDTO"}},"force_reencode":{"type":"boolean","description":"Force full-file reencode instead of cut-based editing","default":false},"id":{"type":"string","description":"CreateEditRequestId","format":"uuid"},"jointly_agreed":{"type":"boolean","description":"CreateEditRequestJointlyAgreed"},"rejection_reason":{"maxLength":512,"minLength":0,"type":"string","description":"CreateEditRequestRejectionReason"},"send_notifications":{"type":"boolean","description":"Send notifications when the edited recording becomes available","default":true},"source_recording_id":{"type":"string","description":"CreateEditRequestSourceRecordingId","format":"uuid"},"status":{"type":"string","description":"CreateEditRequestStatus","enum":["DRAFT","SUBMITTED","APPROVED","REJECTED","PENDING","PROCESSING","COMPLETE","ERROR"]}},"description":"CreateEditRequestDTO"},"CreateInviteDTO":{"required":["email","first_name","last_name","user_id"],"type":"object","properties":{"email":{"type":"string","format":"email","description":"InviteEmail","minLength":1},"first_name":{"minLength":1,"type":"string","description":"InviteFirstName"},"last_name":{"minLength":1,"type":"string","description":"InviteLastName"},"organisation":{"type":"string","description":"InviteOrganisation"},"phone":{"type":"string","description":"InvitePhone"},"user_id":{"type":"string","description":"InviteUserId","format":"uuid"}},"description":"CreateInviteDTO"},"CreateParticipantDTO":{"type":"object","properties":{"first_name":{"type":"string","description":"CreateParticipantFirstName"},"id":{"type":"string","description":"CreateParticipantId","format":"uuid"},"last_name":{"type":"string","description":"CreateParticipantLastName"},"participant_type":{"type":"string","description":"CreateParticipantType","enum":["WITNESS","DEFENDANT"]}},"description":"CreateParticipantDTO"},"CreatePortalAccessDTO":{"required":["id","status"],"type":"object","properties":{"id":{"type":"string","description":"PortalAccessId","format":"uuid"},"invited_at":{"type":"string","description":"PortalAccessInvitedAt","format":"date-time"},"last_access":{"type":"string","description":"PortalAccessLastAccess","format":"date-time"},"registered_at":{"type":"string","description":"PortalAccessRegisteredAt","format":"date-time"},"status":{"type":"string","description":"PortalAccessStatus","enum":["INVITATION_SENT","REGISTERED","ACTIVE","INACTIVE"]}},"description":"CreatePortalAccessDTO"},"CreateRecordingDTO":{"required":["capture_session_id","filename","id","version"],"type":"object","properties":{"capture_session_id":{"type":"string","description":"RecordingCaptureSessionId","format":"uuid"},"duration":{"type":"string","description":"RecordingDuration","example":"PT3M"},"edit_instructions":{"type":"string","description":"RecordingEditInstructions"},"filename":{"type":"string","description":"RecordingFilename"},"id":{"type":"string","description":"RecordingId","format":"uuid"},"parent_recording_id":{"type":"string","description":"RecordingParentRecordingId","format":"uuid"},"url":{"type":"string","description":"RecordingURL"},"version":{"minimum":1,"type":"integer","description":"RecordingVersion","format":"int32"}},"description":"CreateRecordingDTO"},"CreateShareBookingDTO":{"type":"object","properties":{"booking_id":{"type":"string","format":"uuid"},"id":{"type":"string","format":"uuid"},"shared_by_user":{"type":"string","format":"uuid"},"shared_with_user":{"type":"string","format":"uuid"}}},"CreateUserDTO":{"required":["app_access","email","first_name","id","last_name","portal_access"],"type":"object","properties":{"alternative_email":{"type":"string","format":"email","description":"AlternativeEmail","maxLength":100,"minLength":0},"app_access":{"uniqueItems":true,"type":"array","description":"UserAppAccess","items":{"$ref":"#/components/schemas/CreateAppAccessDTO"}},"email":{"type":"string","format":"email","description":"UserEmail","minLength":1},"first_name":{"minLength":1,"type":"string","description":"UserFirstName"},"id":{"type":"string","description":"UserId","format":"uuid"},"last_name":{"minLength":1,"type":"string","description":"UserLastName"},"organisation":{"type":"string","description":"UserOrganisation"},"phone_number":{"type":"string","description":"UserPhoneNumber"},"portal_access":{"uniqueItems":true,"type":"array","description":"UserPortalAccess","items":{"$ref":"#/components/schemas/CreatePortalAccessDTO"}}},"description":"CreateUserDTO"},"CreateVfMigrationRecordDTO":{"required":["id","status"],"type":"object","properties":{"court_id":{"type":"string","description":"CreateMigrationRecordCourtId","format":"uuid"},"defendant_name":{"type":"string","description":"CreateMigrationRecordDefendantName"},"exhibit_reference":{"type":"string","description":"CreateMigrationRecordExhibitReference"},"id":{"type":"string","description":"CreateMigrationRecordId","format":"uuid"},"recording_date":{"type":"string","description":"CreateMigrationRecordRecordingDate","format":"date-time"},"recording_version":{"type":"string","description":"CreateMigrationRecordRecordingVersion","enum":["ORIG","COPY"]},"recording_version_number":{"minimum":1,"type":"number","description":"CreateMigrationRecordRecordingVersion","format":"double"},"resolved_at":{"type":"string","description":"CreateMigrationRecordResolvedAt","format":"date-time"},"status":{"type":"string","description":"CreateMigrationRecordStatus","enum":["PENDING","SUCCESS","FAILED","READY","SUBMITTED","IGNORED"]},"urn":{"type":"string","description":"CreateMigrationRecordUrn"},"witness_name":{"type":"string","description":"CreateMigrationRecordWitnessName"}},"description":"CreateVfMigrationRecordDTO"},"EditCutInstructionDTO":{"required":["end_of_cut","start_of_cut"],"type":"object","properties":{"end_of_cut":{"pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$","type":"string","description":"EditInstructionEnd"},"reason":{"type":"string"},"start_of_cut":{"pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$","type":"string","description":"EditInstructionStart"}},"description":"EditCutInstructionDTO"},"EditInstructions":{"type":"object","properties":{"ffmpegInstructions":{"type":"array","items":{"$ref":"#/components/schemas/FfmpegEditInstructionDTO"}},"forceReencode":{"type":"boolean"},"requestedInstructions":{"type":"array","items":{"$ref":"#/components/schemas/EditCutInstructionDTO"}},"sendNotifications":{"type":"boolean"}},"description":"EditRequestEditInstruction"},"EditReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"EditReportCaseReference"},"court":{"type":"string","description":"EditReportCourtName"},"created_at":{"type":"string","description":"EditReportEditCreatedAt","format":"date-time"},"recording_id":{"type":"string","description":"EditReportRecordingId","format":"uuid"},"regions":{"uniqueItems":true,"type":"array","description":"EditReportRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"version":{"type":"integer","description":"EditReportRecordingVersion","format":"int32"}},"description":"EditReportDTO"},"EditReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"edit_date":{"type":"string","description":"EditReportEditDate"},"edit_time":{"type":"string","description":"EditReportEditTime"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"},"timezone":{"type":"string","description":"EditReportEditTimezone"},"version":{"type":"integer","description":"EditReportRecordingVersion","format":"int32"}},"description":"EditReportDTOV2"},"EditRequestDTO":{"type":"object","properties":{"approved_at":{"type":"string","description":"EditRequestApprovedAt","format":"date-time"},"approved_by":{"type":"string","description":"EditRequestApprovedBy"},"created_at":{"type":"string","description":"EditRequestCreatedAt","format":"date-time"},"created_by":{"type":"string","description":"EditRequestCreatedByName"},"created_by_id":{"type":"string","description":"EditRequestCreatedById","format":"uuid"},"edit_instruction":{"$ref":"#/components/schemas/EditInstructions"},"finished_at":{"type":"string","description":"EditRequestFinishedAt","format":"date-time"},"id":{"type":"string","description":"EditRequestId","format":"uuid"},"jointly_agreed":{"type":"boolean","description":"EditRequestJointlyAgreed"},"modified_at":{"type":"string","description":"EditRequestModifiedAt","format":"date-time"},"rejection_reason":{"type":"string","description":"EditRequestRejectionReason"},"source_recording":{"$ref":"#/components/schemas/RecordingDTO"},"started_at":{"type":"string","description":"EditRequestStartedAt","format":"date-time"},"status":{"type":"string","description":"EditRequestStatus","enum":["DRAFT","SUBMITTED","APPROVED","REJECTED","PENDING","PROCESSING","COMPLETE","ERROR"]}}},"EntityModelBookingDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"capture_sessions":{"type":"array","description":"CaptureSessions","items":{"$ref":"#/components/schemas/CaptureSessionDTO"}},"case_dto":{"$ref":"#/components/schemas/CaseDTO"},"created_at":{"type":"string","description":"BookingCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"BookingDeletedAt","format":"date-time"},"id":{"type":"string","description":"BookingId","format":"uuid"},"modified_at":{"type":"string","description":"BookingModifiedAt","format":"date-time"},"participants":{"type":"array","description":"BookingParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"scheduled_for":{"type":"string","description":"BookingScheduledFor","format":"date-time"},"shares":{"type":"array","description":"BookingShares","items":{"$ref":"#/components/schemas/ShareBookingDTO"}}}},"EntityModelCaptureSessionDTO":{"required":["booking_id","id","origin","status"],"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"booking_id":{"type":"string","description":"CreateCaptureSessionBookingId","format":"uuid"},"case_closed_at":{"type":"string","description":"CaptureSessionCaseClosedAt","format":"date-time"},"case_state":{"type":"string","description":"CaptureSessionCaseState","enum":["OPEN","PENDING_CLOSURE","CLOSED"]},"court_name":{"type":"string","description":"RecordingParticipants"},"deleted_at":{"type":"string","description":"CaptureSessionDeletedAt","format":"date-time"},"finished_at":{"type":"string","description":"CreateCaptureSessionFinishedAt","format":"date-time"},"finished_by_user_id":{"type":"string","description":"CreateCaptureSessionFinishedByUserId","format":"uuid"},"id":{"type":"string","description":"CreateCaptureSessionId","format":"uuid"},"ingest_address":{"type":"string","description":"CreateCaptureSessionIngestAddress"},"live_output_url":{"type":"string","description":"CreateCaptureSessionLiveOutputURL"},"origin":{"type":"string","description":"CreateCaptureSessionOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"started_at":{"type":"string","description":"CreateCaptureSessionStartedAt","format":"date-time"},"started_by_user_id":{"type":"string","description":"CreateCaptureSessionStartedByUserId","format":"uuid"},"status":{"type":"string","description":"CreateCaptureSessionStatus","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]}}},"EntityModelCaseDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"closed_at":{"type":"string","description":"CaseClosedAt","format":"date-time"},"court":{"$ref":"#/components/schemas/CourtDTO"},"created_at":{"type":"string","description":"CaseCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"CaseDeletedAt","format":"date-time"},"id":{"type":"string","description":"CaseId","format":"uuid"},"modified_at":{"type":"string","description":"CaseModifiedAt","format":"date-time"},"origin":{"type":"string","description":"CaseOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"participants":{"type":"array","description":"CaseParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"reference":{"type":"string","description":"CaseReference"},"state":{"type":"string","description":"CaseState","enum":["OPEN","PENDING_CLOSURE","CLOSED"]},"test":{"type":"boolean","description":"CaseIsTest"}}},"EntityModelCourtDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"county":{"type":"string","description":"CourtCounty"},"court_type":{"type":"string","description":"CourtType","enum":["CROWN","MAGISTRATE","FAMILY"]},"group_email":{"type":"string","description":"CourtGroupEmail"},"id":{"type":"string","description":"CourtId","format":"uuid"},"location_code":{"type":"string","description":"CourtLocationCode"},"name":{"type":"string","description":"CourtName"},"postcode":{"type":"string","description":"CourtPostcode"},"regions":{"type":"array","description":"CourtRegions","items":{"$ref":"#/components/schemas/RegionDTO"}}}},"EntityModelEditRequestDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"approved_at":{"type":"string","description":"EditRequestApprovedAt","format":"date-time"},"approved_by":{"type":"string","description":"EditRequestApprovedBy"},"created_at":{"type":"string","description":"EditRequestCreatedAt","format":"date-time"},"created_by":{"type":"string","description":"EditRequestCreatedByName"},"created_by_id":{"type":"string","description":"EditRequestCreatedById","format":"uuid"},"edit_instruction":{"$ref":"#/components/schemas/EditInstructions"},"finished_at":{"type":"string","description":"EditRequestFinishedAt","format":"date-time"},"id":{"type":"string","description":"EditRequestId","format":"uuid"},"jointly_agreed":{"type":"boolean","description":"EditRequestJointlyAgreed"},"modified_at":{"type":"string","description":"EditRequestModifiedAt","format":"date-time"},"rejection_reason":{"type":"string","description":"EditRequestRejectionReason"},"source_recording":{"$ref":"#/components/schemas/RecordingDTO"},"started_at":{"type":"string","description":"EditRequestStartedAt","format":"date-time"},"status":{"type":"string","description":"EditRequestStatus","enum":["DRAFT","SUBMITTED","APPROVED","REJECTED","PENDING","PROCESSING","COMPLETE","ERROR"]}}},"EntityModelInviteDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"code":{"type":"string","description":"InviteCode"},"email":{"type":"string","description":"InviteUserEmail"},"first_name":{"type":"string","description":"InviteUserFirstName"},"invited_at":{"type":"string","description":"InvitedAt","format":"date-time"},"last_name":{"type":"string","description":"InviteUserLastName"},"user_id":{"type":"string","description":"InviteUserId","format":"uuid"}}},"EntityModelRecordingDTO":{"required":["filename","id","version"],"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"capture_session":{"$ref":"#/components/schemas/CaptureSessionDTO"},"case_id":{"type":"string","description":"RecordingCaseId","format":"uuid"},"case_reference":{"type":"string","description":"RecordingCaseReference"},"created_at":{"type":"string","description":"RecordingCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"RecordingDeletedAt","format":"date-time"},"duration":{"type":"string","description":"RecordingDuration","example":"PT3M"},"edit_instructions":{"type":"string","description":"RecordingEditInstructions"},"edit_requests":{"type":"array","description":"RecordingEditRequests","items":{"$ref":"#/components/schemas/EditRequestDTO"}},"edit_status":{"type":"string","description":"RecordingEditStatus","enum":["DRAFT","SUBMITTED","APPROVED","REJECTED","PENDING","PROCESSING","COMPLETE","ERROR"]},"filename":{"type":"string","description":"RecordingFilename"},"id":{"type":"string","description":"RecordingId","format":"uuid"},"is_test_case":{"type":"boolean","description":"RecordingIsTestCase"},"parent_recording_id":{"type":"string","description":"RecordingParentRecordingId","format":"uuid"},"participants":{"type":"array","description":"RecordingParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"total_version_count":{"type":"integer","description":"RecordingTotalVersionCount","format":"int32"},"url":{"type":"string","description":"RecordingURL"},"version":{"minimum":1,"type":"integer","description":"RecordingVersion","format":"int32"}}},"EntityModelShareBookingDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"booking_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"deleted_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"shared_by_user":{"$ref":"#/components/schemas/BaseUserDTO"},"shared_with_user":{"$ref":"#/components/schemas/BaseUserDTO"}}},"EntityModelUserDTO":{"required":["email","first_name","id","last_name"],"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"alternative_email":{"type":"string","format":"email","description":"AlternativeEmail","maxLength":100,"minLength":0},"app_access":{"type":"array","description":"UserAppAccess","items":{"$ref":"#/components/schemas/BaseAppAccessDTO"}},"created_at":{"type":"string","description":"UserCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"UserDeletedAt","format":"date-time"},"email":{"type":"string","format":"email","description":"UserEmail","minLength":1},"first_name":{"minLength":1,"type":"string","description":"UserFirstName"},"id":{"type":"string","description":"UserId","format":"uuid"},"last_name":{"minLength":1,"type":"string","description":"UserLastName"},"modified_at":{"type":"string","description":"UserModifiedAt","format":"date-time"},"organisation":{"type":"string","description":"UserOrganisation"},"phone_number":{"type":"string","description":"UserPhoneNumber"},"portal_access":{"type":"array","description":"UserPortalAccess","items":{"$ref":"#/components/schemas/PortalAccessDTO"}},"terms_accepted":{"type":"object","additionalProperties":{"type":"boolean","description":"UserTermsAccepted"},"description":"UserTermsAccepted"}}},"EntityModelVfMigrationRecordDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"archive_id":{"type":"string","description":"MigrationRecordArchiveId"},"archive_name":{"type":"string","description":"MigrationRecordArchiveName"},"booking_id":{"type":"string","description":"MigrationRecordBookingId","format":"uuid"},"capture_session_id":{"type":"string","description":"MigrationRecordCaptureSessionId","format":"uuid"},"court_id":{"type":"string","description":"MigrationRecordCourtId","format":"uuid"},"court_reference":{"type":"string","description":"MigrationRecordCourtReference"},"create_time":{"type":"string","description":"MigrationRecordCreateTime","format":"date-time"},"created_at":{"type":"string","description":"MigrationRecordCreatedAt","format":"date-time"},"defendant_name":{"type":"string","description":"MigrationRecordDefendantName"},"duration":{"type":"integer","description":"MigrationRecordDuration","format":"int32"},"error_message":{"type":"string","description":"MigrationRecordErrorMessage"},"exhibit_reference":{"type":"string","description":"MigrationRecordExhibitReference"},"file_size":{"type":"string","description":"MigrationRecordFileSize"},"filename":{"type":"string","description":"MigrationRecordFilename"},"id":{"type":"string","description":"MigrationRecordId","format":"uuid"},"is_most_recent":{"type":"boolean","description":"MigrationRecordIsMostRecent"},"parent_temp_id":{"type":"string","description":"MigrationRecordParentTempId","format":"uuid"},"reason":{"type":"string","description":"MigrationRecordReason"},"recording_group_key":{"type":"string","description":"MigrationRecordRecordingGroupKey"},"recording_id":{"type":"string","description":"MigrationRecordRecordingId","format":"uuid"},"recording_version":{"type":"string","description":"MigrationRecordRecordingVersion"},"recording_version_number":{"type":"string","description":"MigrationRecordRecordingVersionNumber"},"resolved_at":{"type":"string","description":"MigrationRecordResolvedAt","format":"date-time"},"status":{"type":"string","description":"MigrationRecordStatus","enum":["PENDING","SUCCESS","FAILED","READY","SUBMITTED","IGNORED"]},"urn":{"type":"string","description":"MigrationRecordUrn"},"witness_name":{"type":"string","description":"MigrationRecordWitnessName"}}},"FfmpegEditInstructionDTO":{"type":"object","properties":{"end":{"type":"integer","format":"int64"},"start":{"type":"integer","format":"int64"}}},"GenerateAssetDTO":{"type":"object","properties":{"description":{"type":"string","description":"GenerateAssetDescription"},"destination_container":{"type":"string","description":"GenerateAssetDestinationContainer","format":"uuid"},"final_asset":{"type":"string","description":"GenerateAssetFinalAsset"},"parent_recording_id":{"type":"string","description":"ParentRecordingId","format":"uuid"},"source_container":{"pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}-input$","type":"string","description":"GenerateAssetSourceContainer"},"temp_asset":{"type":"string","description":"GenerateAssetTempAsset"}},"description":"GenerateAssetDTO"},"GenerateAssetResponseDTO":{"type":"object","properties":{"asset":{"type":"string","description":"GenerateAssetResponseAsset"},"container":{"type":"string","description":"GenerateAssetResponseContainer"},"description":{"type":"string","description":"GenerateAssetResponseDescription"},"jobStatus":{"type":"string","description":"GenerateAssetResponseJobStatus"}},"description":"GenerateAssetResponseDTO"},"InviteDTO":{"type":"object","properties":{"code":{"type":"string","description":"InviteCode"},"email":{"type":"string","description":"InviteUserEmail"},"first_name":{"type":"string","description":"InviteUserFirstName"},"invited_at":{"type":"string","description":"InvitedAt","format":"date-time"},"last_name":{"type":"string","description":"InviteUserLastName"},"user_id":{"type":"string","description":"InviteUserId","format":"uuid"}},"description":"InviteDTO"},"JsonNode":{"type":"object","description":"AuditDetailsJSONString"},"Link":{"type":"object","properties":{"deprecation":{"type":"string"},"href":{"type":"string"},"hreflang":{"type":"string"},"name":{"type":"string"},"profile":{"type":"string"},"templated":{"type":"boolean"},"title":{"type":"string"},"type":{"type":"string"}}},"Links":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Link"}},"LiveEventDTO":{"type":"object","properties":{"description":{"type":"string","description":"LiveEventDescription"},"id":{"type":"string","description":"LiveEventId"},"input_rtmp":{"type":"string","description":"LiveEventInputRtmp"},"name":{"type":"string","description":"LiveEventName"},"resource_state":{"type":"string","description":"LiveEventResourceState"}},"description":"LiveEventDTO"},"PageMetadata":{"type":"object","properties":{"number":{"type":"integer","format":"int64"},"size":{"type":"integer","format":"int64"},"totalElements":{"type":"integer","format":"int64"},"totalPages":{"type":"integer","format":"int64"}}},"PagedModelEntityModelBookingDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"bookingDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelBookingDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelCaptureSessionDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"captureSessionDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelCaptureSessionDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelCaseDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"caseDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelCaseDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelCourtDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"courtDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelCourtDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelEditRequestDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"editRequestDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelEditRequestDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelInviteDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"inviteDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelInviteDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelRecordingDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"recordingDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelRecordingDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelShareBookingDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"shareBookingDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelShareBookingDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelUserDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"userDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelUserDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelVfMigrationRecordDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"vfMigrationRecordDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelVfMigrationRecordDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"ParticipantDTO":{"type":"object","properties":{"created_at":{"type":"string","description":"ParticipantCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"ParticipantDeletedAt","format":"date-time"},"first_name":{"type":"string","description":"ParticipantFirstName"},"id":{"type":"string","description":"ParticipantId","format":"uuid"},"last_name":{"type":"string","description":"ParticipantLastName"},"modified_at":{"type":"string","description":"ParticipantModifiedAt","format":"date-time"},"participant_type":{"type":"string","description":"ParticipantType","enum":["WITNESS","DEFENDANT"]}},"description":"ParticipantDTO"},"PlaybackDTO":{"type":"object","properties":{"dash_url":{"type":"string","description":"PlaybackDashUrl"},"hls_url":{"type":"string","description":"PlaybackHlsUrl"},"license_url":{"type":"string","description":"PlaybackLicenseUrl"},"token":{"type":"string","description":"PlaybackToken"}},"description":"PlaybackDTO"},"PlaybackReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"PlaybackReportCaseReference"},"court":{"type":"string","description":"PlaybackReportCourt"},"playback_at":{"type":"string","description":"PlaybackReportPlaybackAt","format":"date-time"},"recording_id":{"type":"string","description":"PlaybackReportRecordingId","format":"uuid"},"regions":{"uniqueItems":true,"type":"array","description":"PlaybackReportRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"user_email":{"type":"string","description":"PlaybackReportUserEmail"},"user_full_name":{"type":"string","description":"PlaybackReportUserFullName"}},"description":"PlaybackReportDTO"},"PlaybackReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"defendants":{"type":"string","description":"PlaybackReportDefendants"},"playback_date":{"type":"string","description":"PlaybackReportPlaybackDate"},"playback_time":{"type":"string","description":"PlaybackReportPlaybackTime"},"playback_time_zone":{"type":"string","description":"PlaybackReportTimeZone"},"postcode":{"type":"string","description":"ReportPostcode"},"recording_version":{"type":"integer","description":"PlaybackReportRecordingVersion","format":"int32"},"region":{"type":"string","description":"ReportRegion"},"user_email":{"type":"string","description":"PlaybackReportUserEmail"},"user_full_name":{"type":"string","description":"PlaybackReportUserFullName"},"user_organisation":{"type":"string","description":"PlaybackReportUserOrganisation"},"witness":{"type":"string","description":"PlaybackReportWitness"}},"description":"PlaybackReportDTOV2"},"PortalAccessDTO":{"type":"object","properties":{"deleted_at":{"type":"string","description":"PortalAccessDeletedAt","format":"date-time"},"id":{"type":"string","description":"PortalAccessId","format":"uuid"},"invited_at":{"type":"string","description":"PortalAccessInvitedAt","format":"date-time"},"last_access":{"type":"string","description":"PortalAccessLastAccess","format":"date-time"},"registered_at":{"type":"string","description":"PortalAccessRegisteredAt","format":"date-time"},"status":{"type":"string","description":"PortalAccessStatus","enum":["INVITATION_SENT","REGISTERED","ACTIVE","INACTIVE"]}},"description":"PortalAccessDTO"},"RecordingDTO":{"required":["filename","id","version"],"type":"object","properties":{"capture_session":{"$ref":"#/components/schemas/CaptureSessionDTO"},"case_id":{"type":"string","description":"RecordingCaseId","format":"uuid"},"case_reference":{"type":"string","description":"RecordingCaseReference"},"created_at":{"type":"string","description":"RecordingCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"RecordingDeletedAt","format":"date-time"},"duration":{"type":"string","description":"RecordingDuration","example":"PT3M"},"edit_instructions":{"type":"string","description":"RecordingEditInstructions"},"edit_requests":{"type":"array","description":"RecordingEditRequests","items":{"$ref":"#/components/schemas/EditRequestDTO"}},"edit_status":{"type":"string","description":"RecordingEditStatus","enum":["DRAFT","SUBMITTED","APPROVED","REJECTED","PENDING","PROCESSING","COMPLETE","ERROR"]},"filename":{"type":"string","description":"RecordingFilename"},"id":{"type":"string","description":"RecordingId","format":"uuid"},"is_test_case":{"type":"boolean","description":"RecordingIsTestCase"},"parent_recording_id":{"type":"string","description":"RecordingParentRecordingId","format":"uuid"},"participants":{"type":"array","description":"RecordingParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"total_version_count":{"type":"integer","description":"RecordingTotalVersionCount","format":"int32"},"url":{"type":"string","description":"RecordingURL"},"version":{"minimum":1,"type":"integer","description":"RecordingVersion","format":"int32"}},"description":"RecordingDTO"},"RecordingParticipantsReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"RecordingParticipantCaseReference"},"court_name":{"type":"string","description":"RecordingParticipantCourtName"},"participant_name":{"type":"string","description":"RecordingParticipantName"},"participant_type":{"type":"string","description":"RecordingParticipantType","enum":["WITNESS","DEFENDANT"]},"recorded_at":{"type":"string","description":"RecordingParticipantRecordedAt","format":"date-time"},"recording_id":{"type":"string","description":"RecordingParticipantRecordingId","format":"uuid"}},"description":"RecordingParticipantsReportDTOV2"},"RecordingsPerCaseReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"RecordingsPerCaseCaseReference"},"count":{"type":"integer","description":"RecordingsPerCaseCount","format":"int32"},"court":{"type":"string","description":"RecordingsPerCaseCourt"},"regions":{"uniqueItems":true,"type":"array","description":"RecordingsPerCaseRegions","items":{"$ref":"#/components/schemas/RegionDTO"}}},"description":"RecordingsPerCaseReportDTO"},"RecordingsPerCaseReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"number_of_recordings":{"type":"integer","description":"RecordingsPerCaseNumberOfRecordings","format":"int32"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"}},"description":"RecordingsPerCaseReportDTOV2"},"RegionDTO":{"type":"object","properties":{"name":{"type":"string","description":"RegionName"}},"description":"RegionDTO"},"RoleDTO":{"type":"object","properties":{"description":{"type":"string","description":"RoleDescription"},"id":{"type":"string","description":"RoleId","format":"uuid"},"name":{"type":"string","description":"RoleName"}},"description":"RoleDTO"},"ScheduleReportDTO":{"type":"object","properties":{"booking_created_at":{"type":"string","description":"ScheduleReportBookingCreatedAt","format":"date-time"},"capture_session_user":{"type":"string","description":"ScheduleReportUserEmail"},"case_reference":{"type":"string","description":"ScheduleReportCaseReference"},"court":{"type":"string","description":"ScheduleReportCourtName"},"regions":{"uniqueItems":true,"type":"array","description":"ScheduleReportCourtRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"scheduled_for":{"type":"string","description":"ScheduleReportStartedAt","format":"date-time"}},"description":"ScheduleReportDTO"},"ScheduleReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"date_of_booking":{"type":"string","description":"ScheduleReportBookingCreatedAt"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"},"scheduled_date":{"type":"string","description":"ScheduleReportStartedDate"},"user":{"type":"string","description":"ScheduleReportUserEmail"}},"description":"ScheduleReportDTOV2"},"ShareBookingDTO":{"type":"object","properties":{"booking_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"deleted_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"shared_by_user":{"$ref":"#/components/schemas/BaseUserDTO"},"shared_with_user":{"$ref":"#/components/schemas/BaseUserDTO"}},"description":"BookingShares"},"SharedReportDTO":{"type":"object","properties":{"allocated_by":{"type":"string","description":"SharedReportAllocatedBy"},"allocated_by_full_name":{"type":"string","description":"SharedReportAllocatedToFullName"},"allocated_to":{"type":"string","description":"SharedReportAllocatedTo"},"allocated_to_full_name":{"type":"string","description":"SharedReportAllocatedToFullName"},"booking_id":{"type":"string","description":"SharedReportBookingId","format":"uuid"},"case_reference":{"type":"string","description":"SharedReportCaseReference"},"court":{"type":"string","description":"SharedReportCourtName"},"regions":{"uniqueItems":true,"type":"array","description":"SharedReportRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"shared_at":{"type":"string","description":"SharedReportSharedAt","format":"date-time"}},"description":"SharedReportDTO"},"SharedReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"granted_by":{"type":"string","description":"SharedReportGrantedBy"},"granted_by_full_name":{"type":"string","description":"SharedReportGrantedByFullName"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"},"share_date":{"type":"string","description":"SharedReportShareDate"},"share_time":{"type":"string","description":"SharedReportShareTime"},"shared_with":{"type":"string","description":"SharedReportSharedWith"},"shared_with_full_name":{"type":"string","description":"SharedReportSharedWithFullName"},"timezone":{"type":"string","description":"SharedReportShareTimezone"}},"description":"SharedReportDTOV2"},"TermsAndConditionsDTO":{"type":"object","properties":{"created_at":{"type":"string","format":"date-time"},"html":{"type":"string"},"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["APP","PORTAL"]}}},"UpdateBookingCaseDTO":{"required":["booking_id","case_id"],"type":"object","properties":{"booking_id":{"type":"string","description":"UpdateBookingId","format":"uuid"},"case_id":{"type":"string","description":"CaseReferenceId","format":"uuid"}},"description":"UpdateBookingCaseDTO"},"UserAccessReportDTO":{"type":"object","properties":{"access_type":{"type":"string","description":"AccessType"},"active":{"type":"string","description":"UserReportActive"},"alternative_email":{"type":"string","description":"UserAlternativeEmail"},"court_name":{"type":"string","description":"CourtName"},"first_name":{"type":"string","description":"UserReportFirstName"},"last_name":{"type":"string","description":"UserReportLastName"},"primary_email":{"type":"string","description":"UserPrimaryEmail"},"role_name":{"type":"string","description":"UserReportRoleName"}},"description":"UserAccessReport"},"UserDTO":{"required":["email","first_name","id","last_name"],"type":"object","properties":{"alternative_email":{"type":"string","format":"email","description":"AlternativeEmail","maxLength":100,"minLength":0},"app_access":{"type":"array","description":"UserAppAccess","items":{"$ref":"#/components/schemas/BaseAppAccessDTO"}},"created_at":{"type":"string","description":"UserCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"UserDeletedAt","format":"date-time"},"email":{"type":"string","format":"email","description":"UserEmail","minLength":1},"first_name":{"minLength":1,"type":"string","description":"UserFirstName"},"id":{"type":"string","description":"UserId","format":"uuid"},"last_name":{"minLength":1,"type":"string","description":"UserLastName"},"modified_at":{"type":"string","description":"UserModifiedAt","format":"date-time"},"organisation":{"type":"string","description":"UserOrganisation"},"phone_number":{"type":"string","description":"UserPhoneNumber"},"portal_access":{"type":"array","description":"UserPortalAccess","items":{"$ref":"#/components/schemas/PortalAccessDTO"}},"terms_accepted":{"type":"object","additionalProperties":{"type":"boolean","description":"UserTermsAccepted"},"description":"UserTermsAccepted"}},"description":"UserDTO"},"UserPrimaryCourtReportDTO":{"type":"object","properties":{"active":{"type":"string","description":"UserPrimaryCourtReportActive"},"first_name":{"type":"string","description":"UserPrimaryCourtReportFirstName"},"last_access":{"type":"string","description":"UserPrimaryCourtReportLastAccess","format":"date-time"},"last_name":{"type":"string","description":"UserPrimaryCourtReportLastName"},"primary_court_name":{"type":"string","description":"UserPrimaryCourtReportPrimaryCourtName"},"role_name":{"type":"string","description":"UserPrimaryCourtReportRoleName"}},"description":"UserPrimaryCourtReportDTOV2"},"UserRecordingPlaybackReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"defendants":{"type":"string","description":"PlaybackReportDefendants"},"playback_date":{"type":"string","description":"PlaybackReportPlaybackDate"},"playback_time":{"type":"string","description":"PlaybackReportPlaybackTime"},"postcode":{"type":"string","description":"ReportPostcode"},"recording_version":{"type":"integer","description":"PlaybackReportRecordingVersion","format":"int32"},"region":{"type":"string","description":"ReportRegion"},"user_email":{"type":"string","description":"PlaybackReportUserEmail"},"user_full_name":{"type":"string","description":"PlaybackReportUserFullName"},"user_organisation":{"type":"string","description":"PlaybackReportUserOrganisation"},"witness":{"type":"string","description":"PlaybackReportWitness"}},"description":"UserRecordingPlaybackReportDTOV2"},"VerifyEmailRequestDTO":{"required":["email","verification_code"],"type":"object","properties":{"email":{"type":"string","format":"email","description":"Email","minLength":1},"verification_code":{"minLength":1,"pattern":"^[0-9]{6}$","type":"string","description":"VerificationCode"}},"description":"VerifyEmailRequestDTO"}},"securitySchemes":{"Ocp-Apim-Subscription-Key":{"in":"header","name":"Ocp-Apim-Subscription-Key","type":"apiKey"}}}} \ No newline at end of file +{"openapi":"3.0.1","info":{"description":"PRE API - Used for managing courts, bookings, recordings and permissions.","license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"},"title":"Pre Recorded Evidence API","version":"v0.0.1"},"externalDocs":{"description":"README","url":"https://github.com/hmcts/pre-api"},"servers":[{"url":"http://localhost","description":"Generated server url"}],"security":[{"Ocp-Apim-Subscription-Key":[]}],"tags":[{"description":"Monitor and interact","externalDocs":{"description":"Spring Boot Actuator Web API Documentation","url":"https://docs.spring.io/spring-boot/docs/current/actuator-api/html/"},"name":"Actuator"}],"paths":{"/accept-terms-and-conditions/{termsId}":{"post":{"operationId":"acceptTermsAndConditions","parameters":[{"in":"path","name":"termsId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Accept terms and conditions for a user","tags":["terms-and-conditions-controller"]}},"/app-terms-and-conditions/latest":{"get":{"operationId":"getLatestTermsForApp","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/TermsAndConditionsDTO"}}},"description":"OK"}},"summary":"Get the latest terms and conditions for the app","tags":["terms-and-conditions-controller"]}},"/audit/{id}":{"put":{"operationId":"putAudit","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAuditDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create an Audit Entry","tags":["audit-controller"]}},"/b2c/email-verification":{"post":{"operationId":"postEmailVerification","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyEmailRequestDTO"}}},"required":true},"responses":{"204":{"description":"No Content"}},"summary":"Trigger an email verification email to be sent out via gov notify","tags":["b-2-c-controller"]}},"/bookings":{"get":{"operationId":"searchBookings","parameters":[{"description":"The Case Id to search for","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"caseId","schema":{"type":"string","format":"uuid"}},{"description":"The Case Reference to search for","example":1234567890123456,"in":"query","name":"caseReference","schema":{"type":"string"}},{"description":"The Date the Booking is scheduled for","example":"2024-04-27","in":"query","name":"scheduledFor","schema":{"type":"string","format":"date"}},{"description":"The Participant Id to search for","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"participantId","schema":{"type":"string","format":"uuid"}},{"description":"The Court Id to search for","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"If the booking has any recordings","in":"query","name":"hasRecordings","schema":{"type":"boolean"}},{"description":"Search bookings with at least one associated capture session with one of the statuses listed","in":"query","name":"captureSessionStatusIn","schema":{"type":"string"}},{"description":"Bookings where the associated capture sessions do not match status or bookings without sessions","in":"query","name":"captureSessionStatusNotIn","schema":{"type":"string"}},{"description":"Sort by","example":"createdAt,desc","in":"query","name":"sort","schema":{"type":"string"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelBookingDTO"}}},"description":"OK"}},"summary":"Search All Bookings using Case Id, Case Ref, or Scheduled For","tags":["booking-controller"]}},"/bookings/migrate-case/{bookingId}":{"put":{"operationId":"migrateToDifferentCaseReference","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBookingCaseDTO"}}},"required":true},"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/BookingDTO"}}},"description":"OK"}},"summary":"Migrate a Booking to a different case reference","tags":["booking-controller"]}},"/bookings/{bookingId}":{"delete":{"operationId":"deleteBooking","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Delete a Booking","tags":["booking-controller"]},"get":{"operationId":"getBookingById","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/BookingDTO"}}},"description":"OK"}},"summary":"Get a Booking by Id","tags":["booking-controller"]},"put":{"operationId":"putBooking","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBookingDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a Booking","tags":["booking-controller"]}},"/bookings/{bookingId}/share":{"get":{"operationId":"getSharedBookingLogs","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelShareBookingDTO"}}},"description":"OK"}},"tags":["booking-controller"]},"put":{"operationId":"shareBookingById","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateShareBookingDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Share a Booking","tags":["booking-controller"]}},"/bookings/{bookingId}/share/{shareId}":{"delete":{"operationId":"deleteShareBookingById","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"shareId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"tags":["booking-controller"]}},"/bookings/{bookingId}/undelete":{"post":{"operationId":"undeleteBooking","parameters":[{"in":"path","name":"bookingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Revert deletion of a booking","tags":["booking-controller"]}},"/capture-sessions":{"get":{"operationId":"searchCaptureSessions","parameters":[{"description":"The case reference to search for","example":1234567890123456,"in":"query","name":"caseReference","schema":{"type":"string"}},{"description":"The booking id to search for","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"bookingId","schema":{"type":"string","format":"uuid"}},{"description":"The origin of the capture session to search for","in":"query","name":"origin","schema":{"type":"string","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]}},{"description":"The recording status to search for","in":"query","name":"recordingStatus","schema":{"type":"string","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]}},{"description":"The Date the Booking was scheduled for","example":"2024-04-27","in":"query","name":"scheduledFor","schema":{"type":"string","format":"date"}},{"description":"The court id of the capture session to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelCaptureSessionDTO"}}},"description":"OK"}},"summary":"Search All Capture Sessions","tags":["capture-session-controller"]}},"/capture-sessions/trigger-registration/{captureSessionId}":{"put":{"operationId":"triggerRegistrationForCaptureSession","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Register a Capture Session that got stuck in PROCESSING state","tags":["capture-session-controller"]}},"/capture-sessions/{captureSessionId}":{"delete":{"operationId":"deleteCaptureSessionById","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Delete Capture Session by Id","tags":["capture-session-controller"]},"get":{"operationId":"getCaptureSessionById","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaptureSessionDTO"}}},"description":"OK"}},"summary":"Get a Capture Session by Id","tags":["capture-session-controller"]},"put":{"operationId":"upsertCaptureSession","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCaptureSessionDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a Capture Session","tags":["capture-session-controller"]}},"/capture-sessions/{captureSessionId}/undelete":{"post":{"operationId":"undeleteCaptureSession","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Revert deletion of a capture session","tags":["capture-session-controller"]}},"/cases":{"get":{"operationId":"getCases","parameters":[{"description":"The case reference to search by","example":1234567890123456,"in":"query","name":"reference","schema":{"type":"string"}},{"description":"The court id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"Include cases marked as deleted","in":"query","name":"includeDeleted","schema":{"type":"boolean"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelCaseDTO"}}},"description":"OK"}},"summary":"Get a case by reference or court id","tags":["case-controller"]}},"/cases/close-pending":{"post":{"operationId":"closePendingCases","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Close cases in PENDING_CLOSURE state > 29 days","tags":["case-controller"]}},"/cases/{id}":{"delete":{"operationId":"deleteCase","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Mark a Case as deleted","tags":["case-controller"]},"get":{"operationId":"getCaseById","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaseDTO"}}},"description":"OK"}},"summary":"Get a case by id","tags":["case-controller"]},"put":{"operationId":"putCase","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCaseDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a Case","tags":["case-controller"]}},"/cases/{id}/undelete":{"post":{"operationId":"undeleteCase","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Revert deletion of a case","tags":["case-controller"]}},"/courts":{"get":{"operationId":"searchCourts","parameters":[{"description":"The type of the court to search by","in":"query","name":"courtType","schema":{"type":"string","enum":["CROWN","MAGISTRATE","FAMILY"]}},{"description":"The name of the court to search by","example":"Example","in":"query","name":"name","schema":{"type":"string"}},{"description":"The location code of the court to search by","in":"query","name":"locationCode","schema":{"type":"string"}},{"description":"The region name of the court to search by","example":"London","in":"query","name":"regionName","schema":{"type":"string"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelCourtDTO"}}},"description":"OK"}},"summary":"Search for Courts by court type, name, location code or region name","tags":["court-controller"]}},"/courts/email":{"post":{"operationId":"updateCourtEmailAddresses","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"required":["file"],"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CourtEmailDTO"}}}},"description":"OK"}},"tags":["court-controller"]}},"/courts/{courtId}":{"get":{"operationId":"getCourtById","parameters":[{"in":"path","name":"courtId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CourtDTO"}}},"description":"OK"}},"summary":"Get a Court by Id","tags":["court-controller"]},"put":{"operationId":"putCourt","parameters":[{"in":"path","name":"courtId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCourtDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a Court","tags":["court-controller"]}},"/edits":{"get":{"operationId":"searchEdits","parameters":[{"description":"The source recording's id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"sourceRecordingId","schema":{"type":"string","format":"uuid"}},{"description":"The date of last modification to search after","example":"2024-04-27","in":"query","name":"lastModifiedAfter","schema":{"type":"string","format":"date"}},{"description":"The date of last modification to search before","example":"2024-04-27","in":"query","name":"lastModifiedBefore","schema":{"type":"string","format":"date"}},{"description":"Sort by","example":"createdAt,desc","in":"query","name":"sort","schema":{"type":"string"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelEditRequestDTO"}}},"description":"OK"}},"tags":["edit-controller"]}},"/edits/from-csv/{sourceRecordingId}":{"post":{"operationId":"createEditFromCsv","parameters":[{"in":"path","name":"sourceRecordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"required":["file"],"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/EditRequestDTO"}}},"description":"OK"}},"tags":["edit-controller"]}},"/edits/{id}":{"delete":{"operationId":"delete","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEditRequestDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"tags":["edit-controller"]},"get":{"operationId":"getEditRequestById","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/EditRequestDTO"}}},"description":"OK"}},"tags":["edit-controller"]},"put":{"operationId":"upsertEditRequest","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEditRequestDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"tags":["edit-controller"]}},"/health":{"get":{"operationId":"health","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}},"application/vnd.spring-boot.actuator.v2+json":{"schema":{"type":"object"}},"application/vnd.spring-boot.actuator.v3+json":{"schema":{"type":"object"}}},"description":"OK"}},"summary":"Actuator web endpoint 'health'","tags":["Actuator"]}},"/invites":{"get":{"operationId":"searchInvites","parameters":[{"description":"The first name of the user to search by","in":"query","name":"firstName","schema":{"type":"string"}},{"description":"The last name of the user to search by","in":"query","name":"lastName","schema":{"type":"string"}},{"description":"The email of the user to search by","example":"example@example.com","in":"query","name":"email","schema":{"type":"string"}},{"description":"The organisation of the user to search by","in":"query","name":"organisation","schema":{"type":"string"}},{"description":"The access status of the user to search by","in":"query","name":"status","schema":{"type":"string","enum":["INVITATION_SENT","REGISTERED","ACTIVE","INACTIVE"]}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelInviteDTO"}}},"description":"OK"}},"summary":"Search for Invites by first name, last name, email or organisation","tags":["invite-controller"]}},"/invites/redeem":{"post":{"operationId":"redeemInvite","parameters":[{"description":"The email of the user to redeem the invite for","example":"example@example.com","in":"query","name":"email","required":true,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Redeem an invite","tags":["invite-controller"]}},"/invites/{userId}":{"delete":{"operationId":"deleteInvite","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Delete the user with invitation sent status","tags":["invite-controller"]},"get":{"operationId":"getInviteById","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/InviteDTO"}}},"description":"OK"}},"summary":"Get an invite by user id","tags":["invite-controller"]},"put":{"operationId":"putInvite","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInviteDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create a portal access user and invite them","tags":["invite-controller"]}},"/media-service/assets":{"get":{"operationId":"getAssets","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AssetDTO"}}}},"description":"OK"}},"summary":"Get all media service assets","tags":["media-service-controller"]}},"/media-service/assets/{assetName}":{"get":{"operationId":"getAssetsByName","parameters":[{"in":"path","name":"assetName","required":true,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/AssetDTO"}}},"description":"OK"}},"summary":"Get a media service asset by name","tags":["media-service-controller"]}},"/media-service/blob/{containerName}":{"get":{"operationId":"checkBlobExists","parameters":[{"in":"path","name":"containerName","required":true,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"boolean"}}},"description":"OK"}},"summary":"Checks if a container contains the .ism file. 204 on success, 404 on failure.","tags":["media-service-controller"]}},"/media-service/generate-asset":{"post":{"operationId":"generateAsset","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateAssetDTO"}}},"required":true},"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/GenerateAssetResponseDTO"}}},"description":"OK"}},"summary":"LEGACY - Given a source & destination, this endpoint will generate a streaming asset for a given mp4","tags":["media-service-controller"]}},"/media-service/health":{"get":{"operationId":"mediaServiceHealth","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"string"}}},"description":"OK"}},"summary":"Check the status of the media service connection","tags":["media-service-controller"]}},"/media-service/live-event/check/{captureSessionId}":{"post":{"operationId":"checkStream","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaptureSessionDTO"}}},"description":"OK"}},"summary":"Check stream has started","tags":["media-service-controller"]}},"/media-service/live-event/end/{captureSessionId}":{"put":{"operationId":"stopLiveEvent","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaptureSessionDTO"}}},"description":"OK"}},"summary":"Stop a live event","tags":["media-service-controller"]}},"/media-service/live-event/start/{captureSessionId}":{"put":{"operationId":"startLiveEvent","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaptureSessionDTO"}}},"description":"OK"}},"summary":"Start a live event","tags":["media-service-controller"]}},"/media-service/live-events":{"get":{"operationId":"getLiveEvents","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LiveEventDTO"}}}},"description":"OK"}},"summary":"Get a list of media service live events","tags":["media-service-controller"]}},"/media-service/live-events/{liveEventName}":{"get":{"operationId":"getLiveEventsByName","parameters":[{"in":"path","name":"liveEventName","required":true,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/LiveEventDTO"}}},"description":"OK"}},"summary":"Get a media service live event by name","tags":["media-service-controller"]}},"/media-service/streaming-locator/live-event/{captureSessionId}":{"put":{"operationId":"playLiveEvent","parameters":[{"in":"path","name":"captureSessionId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/CaptureSessionDTO"}}},"description":"OK"}},"summary":"Play a live event","tags":["media-service-controller"]}},"/media-service/vod":{"get":{"operationId":"getVod","parameters":[{"in":"query","name":"recordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"mediaService","required":false,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PlaybackDTO"}}},"description":"OK"}},"tags":["media-service-controller"]}},"/portal-terms-and-conditions/latest":{"get":{"operationId":"getLatestTermsForPortal","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/TermsAndConditionsDTO"}}},"description":"OK"}},"summary":"Get the latest terms and conditions for the portal","tags":["terms-and-conditions-controller"]}},"/recordings":{"get":{"operationId":"getRecordings","parameters":[{"description":"Partial string of the recording id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"id","schema":{"type":"string"}},{"description":"The capture session to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"captureSessionId","schema":{"type":"string","format":"uuid"}},{"description":"The parent recording to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"parentRecordingId","schema":{"type":"string","format":"uuid"}},{"description":"The participant to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"participantId","schema":{"type":"string","format":"uuid"}},{"description":"The name of a witness to search by","in":"query","name":"witnessName","schema":{"type":"string"}},{"description":"The name of a defendant to search by","in":"query","name":"defendantName","schema":{"type":"string"}},{"description":"The case reference to search by","example":"CASE12345","in":"query","name":"caseReference","schema":{"type":"string"}},{"description":"The Date the recording's capture session was started at","example":"2024-04-27","in":"query","name":"startedAt","schema":{"type":"string","format":"date"}},{"description":"The court to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"Include recordings marked as deleted","in":"query","name":"includeDeleted","schema":{"type":"boolean"}},{"description":"The version number to search by","in":"query","name":"version","schema":{"type":"integer","format":"int32"}},{"description":"The case status to search by","in":"query","name":"caseOpen","schema":{"type":"boolean"}},{"description":"Sort by","example":"createdAt,desc","in":"query","name":"sort","schema":{"type":"string"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelRecordingDTO"}}},"description":"OK"}},"summary":"Search all Recordings","tags":["recording-controller"]}},"/recordings/{recordingId}":{"delete":{"operationId":"deleteRecording","parameters":[{"in":"path","name":"recordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Delete a Recording","tags":["recording-controller"]},"get":{"operationId":"getRecordingById","parameters":[{"in":"path","name":"recordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/RecordingDTO"}}},"description":"OK"}},"summary":"Get a Recording by Id","tags":["recording-controller"]},"put":{"operationId":"putRecordings","parameters":[{"in":"path","name":"recordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecordingDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a Recording","tags":["recording-controller"]}},"/recordings/{recordingId}/undelete":{"post":{"operationId":"undeleteRecording","parameters":[{"in":"path","name":"recordingId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Revert deletion of a recording","tags":["recording-controller"]}},"/reports-v2/capture-sessions-concurrent":{"get":{"operationId":"reportConcurrentCaptureSessionsv2","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ConcurrentCaptureSessionReportDTOV2"}}}},"description":"OK"}},"tags":["report-controller"]}},"/reports-v2/completed-capture-sessions":{"get":{"operationId":"reportCompletedCaptureSessions_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CompletedCaptureSessionReportDTOV2"}}}},"description":"OK"}},"summary":"Get a report on capture sessions with available recordings v2","tags":["report-controller"]}},"/reports-v2/edits":{"get":{"operationId":"reportEdits_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EditReportDTOV2"}}}},"description":"OK"}},"summary":"Get a report on recordings edits v2","tags":["report-controller"]}},"/reports-v2/playback":{"get":{"operationId":"reportPlayback_1","parameters":[{"description":"The source of the playback. Only accepts PORTAL, APPLICATION or null","in":"query","name":"source","required":false,"schema":{"type":"string","enum":["APPLICATION","PORTAL","ADMIN","AUTO"]}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlaybackReportDTOV2"}}}},"description":"OK"}},"summary":"Get report on playback by playback source (PORTAL, APPLICATION) v2","tags":["report-controller"]}},"/reports-v2/recording-participants":{"get":{"operationId":"reportRecordingParticipants_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecordingParticipantsReportDTO"}}}},"description":"OK"}},"summary":"Get report on participants and the recordings they are part of v2","tags":["report-controller"]}},"/reports-v2/recordings-per-case":{"get":{"operationId":"reportRecordingsPerCase_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecordingsPerCaseReportDTOV2"}}}},"description":"OK"}},"summary":"Get the number of completed capture sessions for each case v2","tags":["report-controller"]}},"/reports-v2/schedules":{"get":{"operationId":"reportSchedules_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ScheduleReportDTOV2"}}}},"description":"OK"}},"summary":"Get a list of completed capture sessions with booking details v2","tags":["report-controller"]}},"/reports-v2/share-bookings-removed":{"get":{"operationId":"reportShareBookingRemoved_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccessRemovedReportDTOV2"}}}},"description":"OK"}},"summary":"Get report on booking share removal v2","tags":["report-controller"]}},"/reports-v2/shared-bookings":{"get":{"operationId":"reportBookingsShared_1","parameters":[{"description":"The court id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"The booking id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"bookingId","schema":{"type":"string","format":"uuid"}},{"description":"The id of the user the booking is shared with to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"sharedWithId","schema":{"type":"string","format":"uuid"}},{"description":"The email of the user the booking is shared with to search by","example":"example@example.com","in":"query","name":"sharedWithEmail","schema":{"type":"string"}},{"description":"The shares must be active (not deleted) then true, otherwise false","example":true,"in":"query","name":"onlyActive","schema":{"type":"boolean"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SharedReportDTOV2"}}}},"description":"OK"}},"summary":"Get a report on the bookings that have been shared v2","tags":["report-controller"]}},"/reports-v2/user-full-access-report":{"get":{"operationId":"reportUserFullAccess","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserAccessReportDTO"}}}},"description":"OK"}},"summary":"Get full report on app users","tags":["report-controller"]}},"/reports-v2/user-full-access-report-csv":{"get":{"operationId":"reportUserFullAccessCsv","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"text/csv":{"schema":{"type":"string","format":"byte"}}},"description":"OK"}},"summary":"Get full report on app users in CSV format","tags":["report-controller"]}},"/reports-v2/user-primary-courts":{"get":{"operationId":"reportUserPrimaryCourts_1","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserPrimaryCourtReportDTO"}}}},"description":"OK"}},"summary":"Get report on app users and their primary courts v2","tags":["report-controller"]}},"/reports-v2/user-recording-playback":{"get":{"operationId":"userRecordingPlaybackReport","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserRecordingPlaybackReportDTOV2"}}}},"description":"OK"}},"summary":"Get report on playback by playback for all sources v2","tags":["report-controller"]}},"/reports/capture-sessions-concurrent":{"get":{"operationId":"reportConcurrentCaptureSessions","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ConcurrentCaptureSessionReportDTO"}}}},"description":"OK"}},"tags":["legacy-report-controller"]}},"/reports/completed-capture-sessions":{"get":{"operationId":"reportCompletedCaptureSessions","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CompletedCaptureSessionReportDTO"}}}},"description":"OK"}},"summary":"Get a report on capture sessions with available recordings","tags":["legacy-report-controller"]}},"/reports/edits":{"get":{"operationId":"reportEdits","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EditReportDTO"}}}},"description":"OK"}},"summary":"Get a report on recordings edits","tags":["legacy-report-controller"]}},"/reports/playback":{"get":{"operationId":"reportPlayback","parameters":[{"description":"The source of the playback. Only accepts PORTAL, APPLICATION or null","in":"query","name":"source","required":false,"schema":{"type":"string","enum":["APPLICATION","PORTAL","ADMIN","AUTO"]}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlaybackReportDTO"}}}},"description":"OK"}},"summary":"Get report on playback by playback source (PORTAL, APPLICATION)","tags":["legacy-report-controller"]}},"/reports/recording-participants":{"get":{"operationId":"reportRecordingParticipants","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecordingParticipantsReportDTO"}}}},"description":"OK"}},"summary":"Get report on participants and the recordings they are part of","tags":["legacy-report-controller"]}},"/reports/recordings-per-case":{"get":{"operationId":"reportRecordingsPerCase","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecordingsPerCaseReportDTO"}}}},"description":"OK"}},"summary":"Get the number of completed capture sessions for each case","tags":["legacy-report-controller"]}},"/reports/schedules":{"get":{"operationId":"reportSchedules","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ScheduleReportDTO"}}}},"description":"OK"}},"summary":"Get a list of completed capture sessions with booking details","tags":["legacy-report-controller"]}},"/reports/share-bookings-removed":{"get":{"operationId":"reportShareBookingRemoved","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccessRemovedReportDTO"}}}},"description":"OK"}},"summary":"Get report on booking share removal","tags":["legacy-report-controller"]}},"/reports/shared-bookings":{"get":{"operationId":"reportBookingsShared","parameters":[{"description":"The court id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"The booking id to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"bookingId","schema":{"type":"string","format":"uuid"}},{"description":"The id of the user the booking is shared with to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"sharedWithId","schema":{"type":"string","format":"uuid"}},{"description":"The email of the user the booking is shared with to search by","example":"example@example.com","in":"query","name":"sharedWithEmail","schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SharedReportDTO"}}}},"description":"OK"}},"summary":"Get a report on the bookings that have been shared","tags":["legacy-report-controller"]}},"/reports/user-primary-courts":{"get":{"operationId":"reportUserPrimaryCourts","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserPrimaryCourtReportDTO"}}}},"description":"OK"}},"summary":"Get report on app users: their first and last name, their role, their active status, their primary court and their last access time (if available)","tags":["legacy-report-controller"]}},"/roles":{"get":{"operationId":"getRoles","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RoleDTO"}}}},"description":"OK"}},"summary":"Get a list of all roles","tags":["role-controller"]}},"/users":{"get":{"operationId":"getUsers","parameters":[{"description":"The name of the user to search by","in":"query","name":"name","schema":{"type":"string"}},{"description":"The first name of the user to search by","in":"query","name":"firstName","schema":{"type":"string"}},{"description":"The last name of the user to search by","in":"query","name":"lastName","schema":{"type":"string"}},{"description":"The email of the user to search by","example":"example@example.com","in":"query","name":"email","schema":{"type":"string"}},{"description":"The organisation of the user to search by","in":"query","name":"organisation","schema":{"type":"string"}},{"description":"The court id of the user to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"The role id of the user to search by","example":"123e4567-e89b-12d3-a456-426614174000","in":"query","name":"roleId","schema":{"type":"string","format":"uuid"}},{"description":"Get Users by their access type","in":"query","name":"accessType","schema":{"type":"string","enum":["PORTAL","APP"]}},{"description":"Include users marked as deleted","in":"query","name":"includeDeleted","schema":{"type":"boolean"}},{"description":"Filter by users with active app access","in":"query","name":"appActive","schema":{"type":"boolean"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelUserDTO"}}},"description":"OK"}},"summary":"Search for Users by first name, last name, email, organisation, court or role","tags":["user-controller"]}},"/users/by-email/{email}":{"get":{"operationId":"getUserAccessByEmail","parameters":[{"in":"path","name":"email","required":true,"schema":{"type":"string"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/AccessDTO"}}},"description":"OK"}},"summary":"Get a User's App Access by Email","tags":["user-controller"]}},"/users/{userId}":{"delete":{"operationId":"deleteUser","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Delete a User","tags":["user-controller"]},"get":{"operationId":"getUserById","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/UserDTO"}}},"description":"OK"}},"summary":"Get a User by Id","tags":["user-controller"]},"put":{"operationId":"putUser","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUserDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Create or Update a User","tags":["user-controller"]}},"/users/{userId}/undelete":{"post":{"operationId":"undeleteUser","parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Revert deletion of user","tags":["user-controller"]}},"/vf-migration-records":{"get":{"operationId":"getVfMigrationRecords","parameters":[{"description":"The case reference to search for","in":"query","name":"caseReference","schema":{"type":"string"}},{"description":"The witness name to search for","in":"query","name":"witnessName","schema":{"type":"string"}},{"description":"The defendant name to search for","in":"query","name":"defendantName","schema":{"type":"string"}},{"description":"The court id to search for","in":"query","name":"courtId","schema":{"type":"string","format":"uuid"}},{"description":"The court reference to search for","in":"query","name":"courtReference","schema":{"type":"string"}},{"description":"The status to search for","in":"query","name":"status","schema":{"type":"string","enum":["PENDING","SUCCESS","FAILED","READY","SUBMITTED","IGNORED"]}},{"description":"The date the record was created to search from","example":"2024-04-27","in":"query","name":"createDateFrom","schema":{"type":"string","format":"date"}},{"description":"The date the record was created to search to","example":"2024-04-27","in":"query","name":"createDateTo","schema":{"type":"string","format":"date"}},{"description":"Search by a list of reasons","in":"query","name":"reasonIn","schema":{"type":"string"}},{"description":"Search by a list of reasons that should not be included","in":"query","name":"reasonNotIn","schema":{"type":"string"}},{"description":"Sort by","example":"archiveName,desc","in":"query","name":"sort","schema":{"type":"string"}},{"description":"The page number of search result to return","example":0,"in":"query","name":"page","schema":{"type":"integer","format":"int32"}},{"description":"The number of search results to return per page","example":10,"in":"query","name":"size","schema":{"type":"integer","format":"int32"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedModelEntityModelVfMigrationRecordDTO"}}},"description":"OK"}},"summary":"Search all migration records","tags":["vf-migration-controller"]}},"/vf-migration-records/import-assets":{"post":{"operationId":"importVodafoneAssets","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Imports Vodafone for resolbed migration records","tags":["vf-migration-controller"]}},"/vf-migration-records/submit":{"post":{"operationId":"submitMigrationRecords","parameters":[{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"}},"summary":"Submits resolved migration records and runs import","tags":["vf-migration-controller"]}},"/vf-migration-records/{id}":{"put":{"operationId":"putVfMigrationRecord","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"description":"The User Id of the User making the request","example":"123e4567-e89b-12d3-a456-426614174000","in":"header","name":"X-User-Id","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateVfMigrationRecordDTO"}}},"required":true},"responses":{"200":{"description":"OK"}},"summary":"Update vf migration record","tags":["vf-migration-controller"]}}},"components":{"schemas":{"AccessDTO":{"type":"object","properties":{"app_access":{"uniqueItems":true,"type":"array","description":"AccessAppAccess","items":{"$ref":"#/components/schemas/BaseAppAccessDTO"}},"portal_access":{"uniqueItems":true,"type":"array","description":"AccessPortalAccess","items":{"$ref":"#/components/schemas/PortalAccessDTO"}},"terms_accepted":{"type":"object","additionalProperties":{"type":"boolean","description":"UserTermsAccepted"},"description":"UserTermsAccepted"},"user":{"$ref":"#/components/schemas/BaseUserDTO"}},"description":"AccessDTO"},"AccessRemovedReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"AccessRemovedReportCaseReference"},"court":{"type":"string","description":"AccessRemovedReportCourtName"},"regions":{"uniqueItems":true,"type":"array","description":"AccessRemovedReportRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"removal_reason":{"type":"string","description":"AccessRemovedReportRemovalReason"},"removed_at":{"type":"string","description":"AccessRemovedReportRemovedAt","format":"date-time"},"user_email":{"type":"string","description":"AccessRemovedReportUserEmail"},"user_full_name":{"type":"string","description":"AccessRemovedReportUserFullName"}},"description":"AccessRemovedReportDTO"},"AccessRemovedReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"full_name":{"type":"string","description":"AccessRemovedReportUserFullName"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"},"removed_date":{"type":"string","description":"AccessRemovedReportRemovedDate"},"removed_time":{"type":"string","description":"AccessRemovedReportRemovedTime"},"removed_timezone":{"type":"string","description":"AccessRemovedReportRemovedTimezone"},"user_email":{"type":"string","description":"AccessRemovedReportUserEmail"}},"description":"AccessRemovedReportDTOV2"},"AssetDTO":{"type":"object","properties":{"container":{"type":"string","description":"AssetContainer"},"description":{"type":"string","description":"AssetDescription"},"name":{"type":"string","description":"AssetName"},"storage_account_name":{"type":"string","description":"AssetStorageAccountName"}},"description":"AssetDTO"},"BaseAppAccessDTO":{"type":"object","properties":{"active":{"type":"boolean","description":"AppAccessActive"},"court":{"$ref":"#/components/schemas/CourtDTO"},"created_at":{"type":"string","description":"AppAccessCreatedAt","format":"date-time"},"default_court":{"type":"boolean","description":"AppAccessIsDefaultCourt"},"id":{"type":"string","description":"AppAccessId","format":"uuid"},"last_access":{"type":"string","description":"AppAccessLastAccess","format":"date-time"},"role":{"$ref":"#/components/schemas/RoleDTO"}},"description":"BaseAppAccessDTO"},"BaseUserDTO":{"required":["email","first_name","id","last_name"],"type":"object","properties":{"alternative_email":{"type":"string","format":"email","description":"AlternativeEmail","maxLength":100,"minLength":0},"email":{"type":"string","format":"email","description":"UserEmail","minLength":1},"first_name":{"minLength":1,"type":"string","description":"UserFirstName"},"id":{"type":"string","description":"UserId","format":"uuid"},"last_name":{"minLength":1,"type":"string","description":"UserLastName"},"organisation":{"type":"string","description":"UserOrganisation"},"phone_number":{"type":"string","description":"UserPhoneNumber"}},"description":"BaseUserDTO"},"BookingDTO":{"type":"object","properties":{"capture_sessions":{"type":"array","description":"CaptureSessions","items":{"$ref":"#/components/schemas/CaptureSessionDTO"}},"case_dto":{"$ref":"#/components/schemas/CaseDTO"},"created_at":{"type":"string","description":"BookingCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"BookingDeletedAt","format":"date-time"},"id":{"type":"string","description":"BookingId","format":"uuid"},"modified_at":{"type":"string","description":"BookingModifiedAt","format":"date-time"},"participants":{"type":"array","description":"BookingParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"scheduled_for":{"type":"string","description":"BookingScheduledFor","format":"date-time"},"shares":{"type":"array","description":"BookingShares","items":{"$ref":"#/components/schemas/ShareBookingDTO"}}},"description":"BookingDTO"},"CaptureSessionDTO":{"required":["booking_id","id","origin","status"],"type":"object","properties":{"booking_id":{"type":"string","description":"CreateCaptureSessionBookingId","format":"uuid"},"case_closed_at":{"type":"string","description":"CaptureSessionCaseClosedAt","format":"date-time"},"case_state":{"type":"string","description":"CaptureSessionCaseState","enum":["OPEN","PENDING_CLOSURE","CLOSED"]},"court_name":{"type":"string","description":"RecordingParticipants"},"deleted_at":{"type":"string","description":"CaptureSessionDeletedAt","format":"date-time"},"finished_at":{"type":"string","description":"CreateCaptureSessionFinishedAt","format":"date-time"},"finished_by_user_id":{"type":"string","description":"CreateCaptureSessionFinishedByUserId","format":"uuid"},"id":{"type":"string","description":"CreateCaptureSessionId","format":"uuid"},"ingest_address":{"type":"string","description":"CreateCaptureSessionIngestAddress"},"live_output_url":{"type":"string","description":"CreateCaptureSessionLiveOutputURL"},"origin":{"type":"string","description":"CreateCaptureSessionOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"started_at":{"type":"string","description":"CreateCaptureSessionStartedAt","format":"date-time"},"started_by_user_id":{"type":"string","description":"CreateCaptureSessionStartedByUserId","format":"uuid"},"status":{"type":"string","description":"CreateCaptureSessionStatus","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]}},"description":"CaptureSessionDTO"},"CaseDTO":{"type":"object","properties":{"closed_at":{"type":"string","description":"CaseClosedAt","format":"date-time"},"court":{"$ref":"#/components/schemas/CourtDTO"},"created_at":{"type":"string","description":"CaseCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"CaseDeletedAt","format":"date-time"},"id":{"type":"string","description":"CaseId","format":"uuid"},"modified_at":{"type":"string","description":"CaseModifiedAt","format":"date-time"},"origin":{"type":"string","description":"CaseOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"participants":{"type":"array","description":"CaseParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"reference":{"type":"string","description":"CaseReference"},"state":{"type":"string","description":"CaseState","enum":["OPEN","PENDING_CLOSURE","CLOSED"]},"test":{"type":"boolean","description":"CaseIsTest"}},"description":"CaseDTO"},"CompletedCaptureSessionReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"CompletedCaptureSessionReportCaseReference"},"count_defendants":{"type":"integer","description":"CompletedCaptureSessionReportDefendantCount","format":"int32"},"count_witnesses":{"type":"integer","description":"CompletedCaptureSessionReportWitnessCount","format":"int32"},"court":{"type":"string","description":"CompletedCaptureSessionReportCourtName"},"duration":{"type":"string","description":"CompletedCaptureSessionReportDuration"},"finished_at":{"type":"string","description":"CompletedCaptureSessionReportFinishedAt","format":"date-time"},"recording_status":{"type":"string","description":"CompletedCaptureSessionReportRecordingStatus","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]},"regions":{"uniqueItems":true,"type":"array","description":"CompletedCaptureSessionReportRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"scheduled_for":{"type":"string","description":"CompletedCaptureSessionReportBookingScheduledFor","format":"date-time"},"started_at":{"type":"string","description":"CompletedCaptureSessionReportStartedAt","format":"date-time"}},"description":"CompletedCaptureSessionReportDTO"},"CompletedCaptureSessionReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"defendant":{"type":"integer","description":"CompletedCaptureSessionReportDefendantCount","format":"int32"},"defendant_names":{"type":"string","description":"CompletedCaptureSessionReportDefendantNames"},"finish_time":{"type":"string","description":"CompletedCaptureSessionReportFinishTime"},"postcode":{"type":"string","description":"ReportPostcode"},"recording_date":{"type":"string","description":"CompletedCaptureSessionReportRecordingDate"},"recording_time":{"type":"string","description":"CompletedCaptureSessionReportRecordingTime"},"region":{"type":"string","description":"ReportRegion"},"scheduled_date":{"type":"string","description":"CompletedCaptureSessionReportScheduledDate"},"status":{"type":"string","description":"CompletedCaptureSessionReportStatus","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]},"timezone":{"type":"string","description":"CompletedCaptureSessionReportTimezone"},"witness":{"type":"integer","description":"CompletedCaptureSessionReportWitnessCount","format":"int32"},"witness_names":{"type":"string","description":"CompletedCaptureSessionReportWitnessNames"}},"description":"CompletedCaptureSessionReportDTOV2"},"ConcurrentCaptureSessionReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"CaptureSessionCaseReference"},"court":{"type":"string","description":"CaptureSessionCourtName"},"duration":{"type":"string","description":"CaptureSessionDuration"},"end_time":{"type":"string","description":"CaptureSessionEndTime","format":"date-time"},"id":{"type":"string","description":"CaptureSessionId","format":"uuid"},"region":{"uniqueItems":true,"type":"array","description":"CaptureSessionRegionName","items":{"$ref":"#/components/schemas/RegionDTO"}},"start_time":{"type":"string","description":"CaptureSessionStartTime","format":"date-time"}},"description":"ConcurrentCaptureSessionReportDTO"},"ConcurrentCaptureSessionReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"date":{"type":"string","description":"CaptureSessionStartDate"},"duration":{"type":"string","description":"CaptureSessionDuration"},"end_time":{"type":"string","description":"CaptureSessionEndTime"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"},"start_time":{"type":"string","description":"CaptureSessionStartTime"},"timezone":{"type":"string","description":"CaptureSessionStartTimezone"}},"description":"ConcurrentCaptureSessionReportDTOV2"},"CourtDTO":{"type":"object","properties":{"county":{"type":"string","description":"CourtCounty"},"court_type":{"type":"string","description":"CourtType","enum":["CROWN","MAGISTRATE","FAMILY"]},"group_email":{"type":"string","description":"CourtGroupEmail"},"id":{"type":"string","description":"CourtId","format":"uuid"},"location_code":{"type":"string","description":"CourtLocationCode"},"name":{"type":"string","description":"CourtName"},"postcode":{"type":"string","description":"CourtPostcode"},"regions":{"type":"array","description":"CourtRegions","items":{"$ref":"#/components/schemas/RegionDTO"}}},"description":"CourtDTO"},"CourtEmailDTO":{"type":"object","properties":{"group_email":{"type":"string","description":"CourtGroupEmail"},"name":{"type":"string","description":"CourtName"}},"description":"CourtEmailDTO"},"CreateAppAccessDTO":{"required":["court_id","id","role_id","user_id"],"type":"object","properties":{"active":{"type":"boolean","description":"AppAccessActive"},"court_id":{"type":"string","description":"AppAccessCourtId","format":"uuid"},"default_court":{"type":"boolean","description":"AppAccessIsDefaultCourt"},"id":{"type":"string","description":"AppAccessId","format":"uuid"},"last_active":{"type":"string","description":"AppAccessLastActive","format":"date-time"},"role_id":{"type":"string","description":"AppAccessRoleId","format":"uuid"},"user_id":{"type":"string","description":"AppAccessUserId","format":"uuid"}},"description":"CreateAppAccessDTO"},"CreateAuditDTO":{"required":["id","source"],"type":"object","properties":{"activity":{"type":"string","description":"AuditActivity"},"audit_details":{"$ref":"#/components/schemas/JsonNode"},"category":{"type":"string","description":"AuditCategory"},"functional_area":{"type":"string","description":"AuditFunctionalArea"},"id":{"type":"string","description":"AuditId","format":"uuid"},"source":{"type":"string","description":"AuditLogSource","enum":["APPLICATION","PORTAL","ADMIN","AUTO"]},"table_name":{"type":"string","description":"AuditTableName"},"table_record_id":{"type":"string","description":"AuditTableNameRecordId","format":"uuid"}},"description":"AuditDTO"},"CreateBookingDTO":{"required":["case_id","id","scheduled_for"],"type":"object","properties":{"case_id":{"type":"string","description":"CreateBookingCaseId","format":"uuid"},"id":{"type":"string","description":"CreateBookingId","format":"uuid"},"participants":{"uniqueItems":true,"type":"array","description":"CreateBookingParticipants","items":{"$ref":"#/components/schemas/CreateParticipantDTO"}},"scheduled_for":{"type":"string","description":"CreateBookingScheduledFor","format":"date-time"}},"description":"CreateBookingDTO"},"CreateCaptureSessionDTO":{"required":["booking_id","id","origin","status"],"type":"object","properties":{"booking_id":{"type":"string","description":"CreateCaptureSessionBookingId","format":"uuid"},"finished_at":{"type":"string","description":"CreateCaptureSessionFinishedAt","format":"date-time"},"finished_by_user_id":{"type":"string","description":"CreateCaptureSessionFinishedByUserId","format":"uuid"},"id":{"type":"string","description":"CreateCaptureSessionId","format":"uuid"},"ingest_address":{"type":"string","description":"CreateCaptureSessionIngestAddress"},"live_output_url":{"type":"string","description":"CreateCaptureSessionLiveOutputURL"},"origin":{"type":"string","description":"CreateCaptureSessionOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"started_at":{"type":"string","description":"CreateCaptureSessionStartedAt","format":"date-time"},"started_by_user_id":{"type":"string","description":"CreateCaptureSessionStartedByUserId","format":"uuid"},"status":{"type":"string","description":"CreateCaptureSessionStatus","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]}},"description":"CreateCaptureSessionDTO"},"CreateCaseDTO":{"required":["reference"],"type":"object","properties":{"closed_at":{"type":"string","description":"CreateCaseClosedAt","format":"date-time"},"court_id":{"type":"string","description":"CreateCaseCourtId","format":"uuid"},"id":{"type":"string","description":"CreateCaseId","format":"uuid"},"origin":{"type":"string","description":"CreateCaseOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"participants":{"uniqueItems":true,"type":"array","description":"CaseParticipants","items":{"$ref":"#/components/schemas/CreateParticipantDTO"}},"reference":{"maxLength":13,"minLength":9,"type":"string","description":"CreateCaseReference"},"state":{"type":"string","description":"CreateCaseState","enum":["OPEN","PENDING_CLOSURE","CLOSED"]},"test":{"type":"boolean","description":"CreateCaseIsTest"}},"description":"CreateCaseDTO"},"CreateCourtDTO":{"required":["court_type","id","location_code","name","regions"],"type":"object","properties":{"county":{"type":"string","description":"CreateCourtCounty"},"court_type":{"type":"string","description":"CreateCourtType","enum":["CROWN","MAGISTRATE","FAMILY"]},"group_email":{"type":"string","description":"CreateCourtGroupEmail"},"id":{"type":"string","description":"CreateCourtId","format":"uuid"},"location_code":{"type":"string","description":"CreateCourtLocationCode"},"name":{"type":"string","description":"CreateCourtName"},"postcode":{"pattern":"^[A-Z]{1,2}[0-9][0-9A-Z]? [0-9][A-Z]{2}$","type":"string","description":"CreateCourtPostcode"},"regions":{"maxItems":2147483647,"minItems":1,"type":"array","description":"CreateCourtRegionIds","items":{"type":"string","description":"CreateCourtRegionIds","format":"uuid"}}},"description":"CreateCourtDTO"},"CreateEditRequestDTO":{"required":["id","source_recording_id","status"],"type":"object","properties":{"approved_at":{"type":"string","description":"CreateEditRequestApprovedAt","format":"date-time"},"approved_by":{"maxLength":100,"minLength":0,"type":"string","description":"CreateEditRequestApprovedBy"},"edit_instructions":{"type":"array","description":"CreateEditRequestInstructions","items":{"$ref":"#/components/schemas/EditCutInstructionDTO"}},"force_reencode":{"type":"boolean","description":"Force full-file reencode instead of cut-based editing","default":false},"id":{"type":"string","description":"CreateEditRequestId","format":"uuid"},"jointly_agreed":{"type":"boolean","description":"CreateEditRequestJointlyAgreed"},"rejection_reason":{"maxLength":512,"minLength":0,"type":"string","description":"CreateEditRequestRejectionReason"},"send_notifications":{"type":"boolean","description":"Send notifications when the edited recording becomes available","default":true},"source_recording_id":{"type":"string","description":"CreateEditRequestSourceRecordingId","format":"uuid"},"status":{"type":"string","description":"CreateEditRequestStatus","enum":["DRAFT","SUBMITTED","APPROVED","REJECTED","PENDING","PROCESSING","COMPLETE","ERROR"]}},"description":"CreateEditRequestDTO"},"CreateInviteDTO":{"required":["email","first_name","last_name","user_id"],"type":"object","properties":{"email":{"type":"string","format":"email","description":"InviteEmail","minLength":1},"first_name":{"minLength":1,"type":"string","description":"InviteFirstName"},"last_name":{"minLength":1,"type":"string","description":"InviteLastName"},"organisation":{"type":"string","description":"InviteOrganisation"},"phone":{"type":"string","description":"InvitePhone"},"user_id":{"type":"string","description":"InviteUserId","format":"uuid"}},"description":"CreateInviteDTO"},"CreateParticipantDTO":{"type":"object","properties":{"first_name":{"type":"string","description":"CreateParticipantFirstName"},"id":{"type":"string","description":"CreateParticipantId","format":"uuid"},"last_name":{"type":"string","description":"CreateParticipantLastName"},"participant_type":{"type":"string","description":"CreateParticipantType","enum":["WITNESS","DEFENDANT"]}},"description":"CreateParticipantDTO"},"CreatePortalAccessDTO":{"required":["id","status"],"type":"object","properties":{"id":{"type":"string","description":"PortalAccessId","format":"uuid"},"invited_at":{"type":"string","description":"PortalAccessInvitedAt","format":"date-time"},"last_access":{"type":"string","description":"PortalAccessLastAccess","format":"date-time"},"registered_at":{"type":"string","description":"PortalAccessRegisteredAt","format":"date-time"},"status":{"type":"string","description":"PortalAccessStatus","enum":["INVITATION_SENT","REGISTERED","ACTIVE","INACTIVE"]}},"description":"CreatePortalAccessDTO"},"CreateRecordingDTO":{"required":["capture_session_id","filename","id","version"],"type":"object","properties":{"capture_session_id":{"type":"string","description":"RecordingCaptureSessionId","format":"uuid"},"duration":{"type":"string","description":"RecordingDuration","example":"PT3M"},"edit_instructions":{"type":"string","description":"RecordingEditInstructions"},"filename":{"type":"string","description":"RecordingFilename"},"id":{"type":"string","description":"RecordingId","format":"uuid"},"parent_recording_id":{"type":"string","description":"RecordingParentRecordingId","format":"uuid"},"url":{"type":"string","description":"RecordingURL"},"version":{"minimum":1,"type":"integer","description":"RecordingVersion","format":"int32"}},"description":"CreateRecordingDTO"},"CreateShareBookingDTO":{"type":"object","properties":{"booking_id":{"type":"string","format":"uuid"},"id":{"type":"string","format":"uuid"},"shared_by_user":{"type":"string","format":"uuid"},"shared_with_user":{"type":"string","format":"uuid"}}},"CreateUserDTO":{"required":["app_access","email","first_name","id","last_name","portal_access"],"type":"object","properties":{"alternative_email":{"type":"string","format":"email","description":"AlternativeEmail","maxLength":100,"minLength":0},"app_access":{"uniqueItems":true,"type":"array","description":"UserAppAccess","items":{"$ref":"#/components/schemas/CreateAppAccessDTO"}},"email":{"type":"string","format":"email","description":"UserEmail","minLength":1},"first_name":{"minLength":1,"type":"string","description":"UserFirstName"},"id":{"type":"string","description":"UserId","format":"uuid"},"last_name":{"minLength":1,"type":"string","description":"UserLastName"},"organisation":{"type":"string","description":"UserOrganisation"},"phone_number":{"type":"string","description":"UserPhoneNumber"},"portal_access":{"uniqueItems":true,"type":"array","description":"UserPortalAccess","items":{"$ref":"#/components/schemas/CreatePortalAccessDTO"}}},"description":"CreateUserDTO"},"CreateVfMigrationRecordDTO":{"required":["id","status"],"type":"object","properties":{"court_id":{"type":"string","description":"CreateMigrationRecordCourtId","format":"uuid"},"defendant_name":{"type":"string","description":"CreateMigrationRecordDefendantName"},"exhibit_reference":{"type":"string","description":"CreateMigrationRecordExhibitReference"},"id":{"type":"string","description":"CreateMigrationRecordId","format":"uuid"},"recording_date":{"type":"string","description":"CreateMigrationRecordRecordingDate","format":"date-time"},"recording_version":{"type":"string","description":"CreateMigrationRecordRecordingVersion","enum":["ORIG","COPY"]},"recording_version_number":{"minimum":1,"type":"number","description":"CreateMigrationRecordRecordingVersion","format":"double"},"resolved_at":{"type":"string","description":"CreateMigrationRecordResolvedAt","format":"date-time"},"status":{"type":"string","description":"CreateMigrationRecordStatus","enum":["PENDING","SUCCESS","FAILED","READY","SUBMITTED","IGNORED"]},"urn":{"type":"string","description":"CreateMigrationRecordUrn"},"witness_name":{"type":"string","description":"CreateMigrationRecordWitnessName"}},"description":"CreateVfMigrationRecordDTO"},"EditCutInstructionDTO":{"required":["end_of_cut","start_of_cut"],"type":"object","properties":{"end_of_cut":{"pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$","type":"string","description":"EditInstructionEnd"},"reason":{"type":"string"},"start_of_cut":{"pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$","type":"string","description":"EditInstructionStart"}},"description":"EditCutInstructionDTO"},"EditInstructions":{"type":"object","properties":{"ffmpegInstructions":{"type":"array","items":{"$ref":"#/components/schemas/FfmpegEditInstructionDTO"}},"forceReencode":{"type":"boolean"},"requestedInstructions":{"type":"array","items":{"$ref":"#/components/schemas/EditCutInstructionDTO"}},"sendNotifications":{"type":"boolean"}},"description":"EditRequestEditInstruction"},"EditReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"EditReportCaseReference"},"court":{"type":"string","description":"EditReportCourtName"},"created_at":{"type":"string","description":"EditReportEditCreatedAt","format":"date-time"},"recording_id":{"type":"string","description":"EditReportRecordingId","format":"uuid"},"regions":{"uniqueItems":true,"type":"array","description":"EditReportRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"version":{"type":"integer","description":"EditReportRecordingVersion","format":"int32"}},"description":"EditReportDTO"},"EditReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"edit_date":{"type":"string","description":"EditReportEditDate"},"edit_time":{"type":"string","description":"EditReportEditTime"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"},"timezone":{"type":"string","description":"EditReportEditTimezone"},"version":{"type":"integer","description":"EditReportRecordingVersion","format":"int32"}},"description":"EditReportDTOV2"},"EditRequestDTO":{"type":"object","properties":{"approved_at":{"type":"string","description":"EditRequestApprovedAt","format":"date-time"},"approved_by":{"type":"string","description":"EditRequestApprovedBy"},"created_at":{"type":"string","description":"EditRequestCreatedAt","format":"date-time"},"created_by":{"type":"string","description":"EditRequestCreatedByName"},"created_by_id":{"type":"string","description":"EditRequestCreatedById","format":"uuid"},"edit_instruction":{"$ref":"#/components/schemas/EditInstructions"},"finished_at":{"type":"string","description":"EditRequestFinishedAt","format":"date-time"},"id":{"type":"string","description":"EditRequestId","format":"uuid"},"jointly_agreed":{"type":"boolean","description":"EditRequestJointlyAgreed"},"modified_at":{"type":"string","description":"EditRequestModifiedAt","format":"date-time"},"rejection_reason":{"type":"string","description":"EditRequestRejectionReason"},"source_recording":{"$ref":"#/components/schemas/RecordingDTO"},"started_at":{"type":"string","description":"EditRequestStartedAt","format":"date-time"},"status":{"type":"string","description":"EditRequestStatus","enum":["DRAFT","SUBMITTED","APPROVED","REJECTED","PENDING","PROCESSING","COMPLETE","ERROR"]}}},"EntityModelBookingDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"capture_sessions":{"type":"array","description":"CaptureSessions","items":{"$ref":"#/components/schemas/CaptureSessionDTO"}},"case_dto":{"$ref":"#/components/schemas/CaseDTO"},"created_at":{"type":"string","description":"BookingCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"BookingDeletedAt","format":"date-time"},"id":{"type":"string","description":"BookingId","format":"uuid"},"modified_at":{"type":"string","description":"BookingModifiedAt","format":"date-time"},"participants":{"type":"array","description":"BookingParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"scheduled_for":{"type":"string","description":"BookingScheduledFor","format":"date-time"},"shares":{"type":"array","description":"BookingShares","items":{"$ref":"#/components/schemas/ShareBookingDTO"}}}},"EntityModelCaptureSessionDTO":{"required":["booking_id","id","origin","status"],"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"booking_id":{"type":"string","description":"CreateCaptureSessionBookingId","format":"uuid"},"case_closed_at":{"type":"string","description":"CaptureSessionCaseClosedAt","format":"date-time"},"case_state":{"type":"string","description":"CaptureSessionCaseState","enum":["OPEN","PENDING_CLOSURE","CLOSED"]},"court_name":{"type":"string","description":"RecordingParticipants"},"deleted_at":{"type":"string","description":"CaptureSessionDeletedAt","format":"date-time"},"finished_at":{"type":"string","description":"CreateCaptureSessionFinishedAt","format":"date-time"},"finished_by_user_id":{"type":"string","description":"CreateCaptureSessionFinishedByUserId","format":"uuid"},"id":{"type":"string","description":"CreateCaptureSessionId","format":"uuid"},"ingest_address":{"type":"string","description":"CreateCaptureSessionIngestAddress"},"live_output_url":{"type":"string","description":"CreateCaptureSessionLiveOutputURL"},"origin":{"type":"string","description":"CreateCaptureSessionOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"started_at":{"type":"string","description":"CreateCaptureSessionStartedAt","format":"date-time"},"started_by_user_id":{"type":"string","description":"CreateCaptureSessionStartedByUserId","format":"uuid"},"status":{"type":"string","description":"CreateCaptureSessionStatus","enum":["STANDBY","INITIALISING","RECORDING","PROCESSING","RECORDING_AVAILABLE","FAILURE","NO_RECORDING"]}}},"EntityModelCaseDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"closed_at":{"type":"string","description":"CaseClosedAt","format":"date-time"},"court":{"$ref":"#/components/schemas/CourtDTO"},"created_at":{"type":"string","description":"CaseCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"CaseDeletedAt","format":"date-time"},"id":{"type":"string","description":"CaseId","format":"uuid"},"modified_at":{"type":"string","description":"CaseModifiedAt","format":"date-time"},"origin":{"type":"string","description":"CaseOrigin","enum":["PRE","VODAFONE","VODAFONE_VISIBLE"]},"participants":{"type":"array","description":"CaseParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"reference":{"type":"string","description":"CaseReference"},"state":{"type":"string","description":"CaseState","enum":["OPEN","PENDING_CLOSURE","CLOSED"]},"test":{"type":"boolean","description":"CaseIsTest"}}},"EntityModelCourtDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"county":{"type":"string","description":"CourtCounty"},"court_type":{"type":"string","description":"CourtType","enum":["CROWN","MAGISTRATE","FAMILY"]},"group_email":{"type":"string","description":"CourtGroupEmail"},"id":{"type":"string","description":"CourtId","format":"uuid"},"location_code":{"type":"string","description":"CourtLocationCode"},"name":{"type":"string","description":"CourtName"},"postcode":{"type":"string","description":"CourtPostcode"},"regions":{"type":"array","description":"CourtRegions","items":{"$ref":"#/components/schemas/RegionDTO"}}}},"EntityModelEditRequestDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"approved_at":{"type":"string","description":"EditRequestApprovedAt","format":"date-time"},"approved_by":{"type":"string","description":"EditRequestApprovedBy"},"created_at":{"type":"string","description":"EditRequestCreatedAt","format":"date-time"},"created_by":{"type":"string","description":"EditRequestCreatedByName"},"created_by_id":{"type":"string","description":"EditRequestCreatedById","format":"uuid"},"edit_instruction":{"$ref":"#/components/schemas/EditInstructions"},"finished_at":{"type":"string","description":"EditRequestFinishedAt","format":"date-time"},"id":{"type":"string","description":"EditRequestId","format":"uuid"},"jointly_agreed":{"type":"boolean","description":"EditRequestJointlyAgreed"},"modified_at":{"type":"string","description":"EditRequestModifiedAt","format":"date-time"},"rejection_reason":{"type":"string","description":"EditRequestRejectionReason"},"source_recording":{"$ref":"#/components/schemas/RecordingDTO"},"started_at":{"type":"string","description":"EditRequestStartedAt","format":"date-time"},"status":{"type":"string","description":"EditRequestStatus","enum":["DRAFT","SUBMITTED","APPROVED","REJECTED","PENDING","PROCESSING","COMPLETE","ERROR"]}}},"EntityModelInviteDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"code":{"type":"string","description":"InviteCode"},"email":{"type":"string","description":"InviteUserEmail"},"first_name":{"type":"string","description":"InviteUserFirstName"},"invited_at":{"type":"string","description":"InvitedAt","format":"date-time"},"last_name":{"type":"string","description":"InviteUserLastName"},"user_id":{"type":"string","description":"InviteUserId","format":"uuid"}}},"EntityModelRecordingDTO":{"required":["filename","id","version"],"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"capture_session":{"$ref":"#/components/schemas/CaptureSessionDTO"},"case_id":{"type":"string","description":"RecordingCaseId","format":"uuid"},"case_reference":{"type":"string","description":"RecordingCaseReference"},"created_at":{"type":"string","description":"RecordingCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"RecordingDeletedAt","format":"date-time"},"duration":{"type":"string","description":"RecordingDuration","example":"PT3M"},"edit_instructions":{"type":"string","description":"RecordingEditInstructions"},"edit_requests":{"type":"array","description":"RecordingEditRequests","items":{"$ref":"#/components/schemas/EditRequestDTO"}},"edit_status":{"type":"string","description":"RecordingEditStatus","enum":["DRAFT","SUBMITTED","APPROVED","REJECTED","PENDING","PROCESSING","COMPLETE","ERROR"]},"filename":{"type":"string","description":"RecordingFilename"},"id":{"type":"string","description":"RecordingId","format":"uuid"},"is_test_case":{"type":"boolean","description":"RecordingIsTestCase"},"parent_recording_id":{"type":"string","description":"RecordingParentRecordingId","format":"uuid"},"participants":{"type":"array","description":"RecordingParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"total_version_count":{"type":"integer","description":"RecordingTotalVersionCount","format":"int32"},"url":{"type":"string","description":"RecordingURL"},"version":{"minimum":1,"type":"integer","description":"RecordingVersion","format":"int32"}}},"EntityModelShareBookingDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"booking_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"deleted_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"shared_by_user":{"$ref":"#/components/schemas/BaseUserDTO"},"shared_with_user":{"$ref":"#/components/schemas/BaseUserDTO"}}},"EntityModelUserDTO":{"required":["email","first_name","id","last_name"],"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"alternative_email":{"type":"string","format":"email","description":"AlternativeEmail","maxLength":100,"minLength":0},"app_access":{"type":"array","description":"UserAppAccess","items":{"$ref":"#/components/schemas/BaseAppAccessDTO"}},"created_at":{"type":"string","description":"UserCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"UserDeletedAt","format":"date-time"},"email":{"type":"string","format":"email","description":"UserEmail","minLength":1},"first_name":{"minLength":1,"type":"string","description":"UserFirstName"},"id":{"type":"string","description":"UserId","format":"uuid"},"last_name":{"minLength":1,"type":"string","description":"UserLastName"},"modified_at":{"type":"string","description":"UserModifiedAt","format":"date-time"},"organisation":{"type":"string","description":"UserOrganisation"},"phone_number":{"type":"string","description":"UserPhoneNumber"},"portal_access":{"type":"array","description":"UserPortalAccess","items":{"$ref":"#/components/schemas/PortalAccessDTO"}},"terms_accepted":{"type":"object","additionalProperties":{"type":"boolean","description":"UserTermsAccepted"},"description":"UserTermsAccepted"}}},"EntityModelVfMigrationRecordDTO":{"type":"object","properties":{"_links":{"$ref":"#/components/schemas/Links"},"archive_id":{"type":"string","description":"MigrationRecordArchiveId"},"archive_name":{"type":"string","description":"MigrationRecordArchiveName"},"booking_id":{"type":"string","description":"MigrationRecordBookingId","format":"uuid"},"capture_session_id":{"type":"string","description":"MigrationRecordCaptureSessionId","format":"uuid"},"court_id":{"type":"string","description":"MigrationRecordCourtId","format":"uuid"},"court_reference":{"type":"string","description":"MigrationRecordCourtReference"},"create_time":{"type":"string","description":"MigrationRecordCreateTime","format":"date-time"},"created_at":{"type":"string","description":"MigrationRecordCreatedAt","format":"date-time"},"defendant_name":{"type":"string","description":"MigrationRecordDefendantName"},"duration":{"type":"integer","description":"MigrationRecordDuration","format":"int32"},"error_message":{"type":"string","description":"MigrationRecordErrorMessage"},"exhibit_reference":{"type":"string","description":"MigrationRecordExhibitReference"},"file_size":{"type":"string","description":"MigrationRecordFileSize"},"filename":{"type":"string","description":"MigrationRecordFilename"},"id":{"type":"string","description":"MigrationRecordId","format":"uuid"},"is_most_recent":{"type":"boolean","description":"MigrationRecordIsMostRecent"},"parent_temp_id":{"type":"string","description":"MigrationRecordParentTempId","format":"uuid"},"reason":{"type":"string","description":"MigrationRecordReason"},"recording_group_key":{"type":"string","description":"MigrationRecordRecordingGroupKey"},"recording_id":{"type":"string","description":"MigrationRecordRecordingId","format":"uuid"},"recording_version":{"type":"string","description":"MigrationRecordRecordingVersion"},"recording_version_number":{"type":"string","description":"MigrationRecordRecordingVersionNumber"},"resolved_at":{"type":"string","description":"MigrationRecordResolvedAt","format":"date-time"},"status":{"type":"string","description":"MigrationRecordStatus","enum":["PENDING","SUCCESS","FAILED","READY","SUBMITTED","IGNORED"]},"urn":{"type":"string","description":"MigrationRecordUrn"},"witness_name":{"type":"string","description":"MigrationRecordWitnessName"}}},"FfmpegEditInstructionDTO":{"type":"object","properties":{"end":{"type":"integer","format":"int64"},"start":{"type":"integer","format":"int64"}}},"GenerateAssetDTO":{"type":"object","properties":{"description":{"type":"string","description":"GenerateAssetDescription"},"destination_container":{"type":"string","description":"GenerateAssetDestinationContainer","format":"uuid"},"final_asset":{"type":"string","description":"GenerateAssetFinalAsset"},"parent_recording_id":{"type":"string","description":"ParentRecordingId","format":"uuid"},"source_container":{"pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}-input$","type":"string","description":"GenerateAssetSourceContainer"},"temp_asset":{"type":"string","description":"GenerateAssetTempAsset"}},"description":"GenerateAssetDTO"},"GenerateAssetResponseDTO":{"type":"object","properties":{"asset":{"type":"string","description":"GenerateAssetResponseAsset"},"container":{"type":"string","description":"GenerateAssetResponseContainer"},"description":{"type":"string","description":"GenerateAssetResponseDescription"},"jobStatus":{"type":"string","description":"GenerateAssetResponseJobStatus"}},"description":"GenerateAssetResponseDTO"},"InviteDTO":{"type":"object","properties":{"code":{"type":"string","description":"InviteCode"},"email":{"type":"string","description":"InviteUserEmail"},"first_name":{"type":"string","description":"InviteUserFirstName"},"invited_at":{"type":"string","description":"InvitedAt","format":"date-time"},"last_name":{"type":"string","description":"InviteUserLastName"},"user_id":{"type":"string","description":"InviteUserId","format":"uuid"}},"description":"InviteDTO"},"JsonNode":{"type":"object","description":"AuditDetailsJSONString"},"Link":{"type":"object","properties":{"deprecation":{"type":"string"},"href":{"type":"string"},"hreflang":{"type":"string"},"name":{"type":"string"},"profile":{"type":"string"},"templated":{"type":"boolean"},"title":{"type":"string"},"type":{"type":"string"}}},"Links":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Link"}},"LiveEventDTO":{"type":"object","properties":{"description":{"type":"string","description":"LiveEventDescription"},"id":{"type":"string","description":"LiveEventId"},"input_rtmp":{"type":"string","description":"LiveEventInputRtmp"},"name":{"type":"string","description":"LiveEventName"},"resource_state":{"type":"string","description":"LiveEventResourceState"}},"description":"LiveEventDTO"},"PageMetadata":{"type":"object","properties":{"number":{"type":"integer","format":"int64"},"size":{"type":"integer","format":"int64"},"totalElements":{"type":"integer","format":"int64"},"totalPages":{"type":"integer","format":"int64"}}},"PagedModelEntityModelBookingDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"bookingDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelBookingDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelCaptureSessionDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"captureSessionDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelCaptureSessionDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelCaseDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"caseDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelCaseDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelCourtDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"courtDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelCourtDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelEditRequestDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"editRequestDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelEditRequestDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelInviteDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"inviteDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelInviteDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelRecordingDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"recordingDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelRecordingDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelShareBookingDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"shareBookingDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelShareBookingDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelUserDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"userDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelUserDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"PagedModelEntityModelVfMigrationRecordDTO":{"type":"object","properties":{"_embedded":{"type":"object","properties":{"vfMigrationRecordDTOList":{"type":"array","items":{"$ref":"#/components/schemas/EntityModelVfMigrationRecordDTO"}}}},"_links":{"$ref":"#/components/schemas/Links"},"page":{"$ref":"#/components/schemas/PageMetadata"}}},"ParticipantDTO":{"type":"object","properties":{"created_at":{"type":"string","description":"ParticipantCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"ParticipantDeletedAt","format":"date-time"},"first_name":{"type":"string","description":"ParticipantFirstName"},"id":{"type":"string","description":"ParticipantId","format":"uuid"},"last_name":{"type":"string","description":"ParticipantLastName"},"modified_at":{"type":"string","description":"ParticipantModifiedAt","format":"date-time"},"participant_type":{"type":"string","description":"ParticipantType","enum":["WITNESS","DEFENDANT"]}},"description":"ParticipantDTO"},"PlaybackDTO":{"type":"object","properties":{"dash_url":{"type":"string","description":"PlaybackDashUrl"},"hls_url":{"type":"string","description":"PlaybackHlsUrl"},"license_url":{"type":"string","description":"PlaybackLicenseUrl"},"token":{"type":"string","description":"PlaybackToken"}},"description":"PlaybackDTO"},"PlaybackReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"PlaybackReportCaseReference"},"court":{"type":"string","description":"PlaybackReportCourt"},"playback_at":{"type":"string","description":"PlaybackReportPlaybackAt","format":"date-time"},"recording_id":{"type":"string","description":"PlaybackReportRecordingId","format":"uuid"},"regions":{"uniqueItems":true,"type":"array","description":"PlaybackReportRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"user_email":{"type":"string","description":"PlaybackReportUserEmail"},"user_full_name":{"type":"string","description":"PlaybackReportUserFullName"}},"description":"PlaybackReportDTO"},"PlaybackReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"defendants":{"type":"string","description":"PlaybackReportDefendants"},"playback_date":{"type":"string","description":"PlaybackReportPlaybackDate"},"playback_time":{"type":"string","description":"PlaybackReportPlaybackTime"},"playback_time_zone":{"type":"string","description":"PlaybackReportTimeZone"},"postcode":{"type":"string","description":"ReportPostcode"},"recording_version":{"type":"integer","description":"PlaybackReportRecordingVersion","format":"int32"},"region":{"type":"string","description":"ReportRegion"},"user_email":{"type":"string","description":"PlaybackReportUserEmail"},"user_full_name":{"type":"string","description":"PlaybackReportUserFullName"},"user_organisation":{"type":"string","description":"PlaybackReportUserOrganisation"},"witness":{"type":"string","description":"PlaybackReportWitness"}},"description":"PlaybackReportDTOV2"},"PortalAccessDTO":{"type":"object","properties":{"deleted_at":{"type":"string","description":"PortalAccessDeletedAt","format":"date-time"},"id":{"type":"string","description":"PortalAccessId","format":"uuid"},"invited_at":{"type":"string","description":"PortalAccessInvitedAt","format":"date-time"},"last_access":{"type":"string","description":"PortalAccessLastAccess","format":"date-time"},"registered_at":{"type":"string","description":"PortalAccessRegisteredAt","format":"date-time"},"status":{"type":"string","description":"PortalAccessStatus","enum":["INVITATION_SENT","REGISTERED","ACTIVE","INACTIVE"]}},"description":"PortalAccessDTO"},"RecordingDTO":{"required":["filename","id","version"],"type":"object","properties":{"capture_session":{"$ref":"#/components/schemas/CaptureSessionDTO"},"case_id":{"type":"string","description":"RecordingCaseId","format":"uuid"},"case_reference":{"type":"string","description":"RecordingCaseReference"},"created_at":{"type":"string","description":"RecordingCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"RecordingDeletedAt","format":"date-time"},"duration":{"type":"string","description":"RecordingDuration","example":"PT3M"},"edit_instructions":{"type":"string","description":"RecordingEditInstructions"},"edit_requests":{"type":"array","description":"RecordingEditRequests","items":{"$ref":"#/components/schemas/EditRequestDTO"}},"edit_status":{"type":"string","description":"RecordingEditStatus","enum":["DRAFT","SUBMITTED","APPROVED","REJECTED","PENDING","PROCESSING","COMPLETE","ERROR"]},"filename":{"type":"string","description":"RecordingFilename"},"id":{"type":"string","description":"RecordingId","format":"uuid"},"is_test_case":{"type":"boolean","description":"RecordingIsTestCase"},"parent_recording_id":{"type":"string","description":"RecordingParentRecordingId","format":"uuid"},"participants":{"type":"array","description":"RecordingParticipants","items":{"$ref":"#/components/schemas/ParticipantDTO"}},"total_version_count":{"type":"integer","description":"RecordingTotalVersionCount","format":"int32"},"url":{"type":"string","description":"RecordingURL"},"version":{"minimum":1,"type":"integer","description":"RecordingVersion","format":"int32"}},"description":"RecordingDTO"},"RecordingParticipantsReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"RecordingParticipantCaseReference"},"court_name":{"type":"string","description":"RecordingParticipantCourtName"},"participant_name":{"type":"string","description":"RecordingParticipantName"},"participant_type":{"type":"string","description":"RecordingParticipantType","enum":["WITNESS","DEFENDANT"]},"recorded_at":{"type":"string","description":"RecordingParticipantRecordedAt","format":"date-time"},"recording_id":{"type":"string","description":"RecordingParticipantRecordingId","format":"uuid"}},"description":"RecordingParticipantsReportDTOV2"},"RecordingsPerCaseReportDTO":{"type":"object","properties":{"case_reference":{"type":"string","description":"RecordingsPerCaseCaseReference"},"count":{"type":"integer","description":"RecordingsPerCaseCount","format":"int32"},"court":{"type":"string","description":"RecordingsPerCaseCourt"},"regions":{"uniqueItems":true,"type":"array","description":"RecordingsPerCaseRegions","items":{"$ref":"#/components/schemas/RegionDTO"}}},"description":"RecordingsPerCaseReportDTO"},"RecordingsPerCaseReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"number_of_recordings":{"type":"integer","description":"RecordingsPerCaseNumberOfRecordings","format":"int32"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"}},"description":"RecordingsPerCaseReportDTOV2"},"RegionDTO":{"type":"object","properties":{"name":{"type":"string","description":"RegionName"}},"description":"RegionDTO"},"RoleDTO":{"type":"object","properties":{"description":{"type":"string","description":"RoleDescription"},"id":{"type":"string","description":"RoleId","format":"uuid"},"name":{"type":"string","description":"RoleName"}},"description":"RoleDTO"},"ScheduleReportDTO":{"type":"object","properties":{"booking_created_at":{"type":"string","description":"ScheduleReportBookingCreatedAt","format":"date-time"},"capture_session_user":{"type":"string","description":"ScheduleReportUserEmail"},"case_reference":{"type":"string","description":"ScheduleReportCaseReference"},"court":{"type":"string","description":"ScheduleReportCourtName"},"regions":{"uniqueItems":true,"type":"array","description":"ScheduleReportCourtRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"scheduled_for":{"type":"string","description":"ScheduleReportStartedAt","format":"date-time"}},"description":"ScheduleReportDTO"},"ScheduleReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"date_of_booking":{"type":"string","description":"ScheduleReportBookingCreatedAt"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"},"scheduled_date":{"type":"string","description":"ScheduleReportStartedDate"},"user":{"type":"string","description":"ScheduleReportUserEmail"}},"description":"ScheduleReportDTOV2"},"ShareBookingDTO":{"type":"object","properties":{"booking_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"deleted_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"shared_by_user":{"$ref":"#/components/schemas/BaseUserDTO"},"shared_with_user":{"$ref":"#/components/schemas/BaseUserDTO"}},"description":"BookingShares"},"SharedReportDTO":{"type":"object","properties":{"allocated_by":{"type":"string","description":"SharedReportAllocatedBy"},"allocated_by_full_name":{"type":"string","description":"SharedReportAllocatedToFullName"},"allocated_to":{"type":"string","description":"SharedReportAllocatedTo"},"allocated_to_full_name":{"type":"string","description":"SharedReportAllocatedToFullName"},"booking_id":{"type":"string","description":"SharedReportBookingId","format":"uuid"},"case_reference":{"type":"string","description":"SharedReportCaseReference"},"court":{"type":"string","description":"SharedReportCourtName"},"regions":{"uniqueItems":true,"type":"array","description":"SharedReportRegions","items":{"$ref":"#/components/schemas/RegionDTO"}},"shared_at":{"type":"string","description":"SharedReportSharedAt","format":"date-time"}},"description":"SharedReportDTO"},"SharedReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"granted_by":{"type":"string","description":"SharedReportGrantedBy"},"granted_by_full_name":{"type":"string","description":"SharedReportGrantedByFullName"},"postcode":{"type":"string","description":"ReportPostcode"},"region":{"type":"string","description":"ReportRegion"},"share_date":{"type":"string","description":"SharedReportShareDate"},"share_time":{"type":"string","description":"SharedReportShareTime"},"shared_with":{"type":"string","description":"SharedReportSharedWith"},"shared_with_full_name":{"type":"string","description":"SharedReportSharedWithFullName"},"timezone":{"type":"string","description":"SharedReportShareTimezone"}},"description":"SharedReportDTOV2"},"TermsAndConditionsDTO":{"type":"object","properties":{"created_at":{"type":"string","format":"date-time"},"html":{"type":"string"},"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["APP","PORTAL"]}}},"UpdateBookingCaseDTO":{"required":["booking_id","case_id"],"type":"object","properties":{"booking_id":{"type":"string","description":"UpdateBookingId","format":"uuid"},"case_id":{"type":"string","description":"CaseReferenceId","format":"uuid"}},"description":"UpdateBookingCaseDTO"},"UserAccessReportDTO":{"type":"object","properties":{"access_type":{"type":"string","description":"AccessType"},"active":{"type":"string","description":"UserReportActive"},"alternative_email":{"type":"string","description":"UserAlternativeEmail"},"court_name":{"type":"string","description":"CourtName"},"first_name":{"type":"string","description":"UserReportFirstName"},"last_name":{"type":"string","description":"UserReportLastName"},"primary_email":{"type":"string","description":"UserPrimaryEmail"},"role_name":{"type":"string","description":"UserReportRoleName"}},"description":"UserAccessReport"},"UserDTO":{"required":["email","first_name","id","last_name"],"type":"object","properties":{"alternative_email":{"type":"string","format":"email","description":"AlternativeEmail","maxLength":100,"minLength":0},"app_access":{"type":"array","description":"UserAppAccess","items":{"$ref":"#/components/schemas/BaseAppAccessDTO"}},"created_at":{"type":"string","description":"UserCreatedAt","format":"date-time"},"deleted_at":{"type":"string","description":"UserDeletedAt","format":"date-time"},"email":{"type":"string","format":"email","description":"UserEmail","minLength":1},"first_name":{"minLength":1,"type":"string","description":"UserFirstName"},"id":{"type":"string","description":"UserId","format":"uuid"},"last_name":{"minLength":1,"type":"string","description":"UserLastName"},"modified_at":{"type":"string","description":"UserModifiedAt","format":"date-time"},"organisation":{"type":"string","description":"UserOrganisation"},"phone_number":{"type":"string","description":"UserPhoneNumber"},"portal_access":{"type":"array","description":"UserPortalAccess","items":{"$ref":"#/components/schemas/PortalAccessDTO"}},"terms_accepted":{"type":"object","additionalProperties":{"type":"boolean","description":"UserTermsAccepted"},"description":"UserTermsAccepted"}},"description":"UserDTO"},"UserPrimaryCourtReportDTO":{"type":"object","properties":{"active":{"type":"string","description":"UserPrimaryCourtReportActive"},"first_name":{"type":"string","description":"UserPrimaryCourtReportFirstName"},"last_access":{"type":"string","description":"UserPrimaryCourtReportLastAccess","format":"date-time"},"last_name":{"type":"string","description":"UserPrimaryCourtReportLastName"},"primary_court_name":{"type":"string","description":"UserPrimaryCourtReportPrimaryCourtName"},"role_name":{"type":"string","description":"UserPrimaryCourtReportRoleName"}},"description":"UserPrimaryCourtReportDTOV2"},"UserRecordingPlaybackReportDTOV2":{"type":"object","properties":{"case_reference":{"type":"string","description":"ReportCaseReference"},"county":{"type":"string","description":"ReportCounty"},"court":{"type":"string","description":"ReportCourt"},"defendants":{"type":"string","description":"PlaybackReportDefendants"},"playback_date":{"type":"string","description":"PlaybackReportPlaybackDate"},"playback_time":{"type":"string","description":"PlaybackReportPlaybackTime"},"postcode":{"type":"string","description":"ReportPostcode"},"recording_version":{"type":"integer","description":"PlaybackReportRecordingVersion","format":"int32"},"region":{"type":"string","description":"ReportRegion"},"user_email":{"type":"string","description":"PlaybackReportUserEmail"},"user_full_name":{"type":"string","description":"PlaybackReportUserFullName"},"user_organisation":{"type":"string","description":"PlaybackReportUserOrganisation"},"witness":{"type":"string","description":"PlaybackReportWitness"}},"description":"UserRecordingPlaybackReportDTOV2"},"VerifyEmailRequestDTO":{"required":["email","verification_code"],"type":"object","properties":{"email":{"type":"string","format":"email","description":"Email","minLength":1},"verification_code":{"minLength":1,"pattern":"^[0-9]{6}$","type":"string","description":"VerificationCode"}},"description":"VerifyEmailRequestDTO"}},"securitySchemes":{"Ocp-Apim-Subscription-Key":{"in":"header","name":"Ocp-Apim-Subscription-Key","type":"apiKey"}}}} \ No newline at end of file diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/RecordingServiceIT.java b/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/RecordingServiceIT.java index 5ef9841acf..de0026309e 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/RecordingServiceIT.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/RecordingServiceIT.java @@ -19,7 +19,6 @@ import uk.gov.hmcts.reform.preapi.entities.Court; import uk.gov.hmcts.reform.preapi.entities.Recording; import uk.gov.hmcts.reform.preapi.enums.CaseState; -import uk.gov.hmcts.reform.preapi.enums.CaseState; import uk.gov.hmcts.reform.preapi.enums.CourtType; import uk.gov.hmcts.reform.preapi.enums.RecordingOrigin; import uk.gov.hmcts.reform.preapi.enums.UpsertResult; diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsServiceIT.java b/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsServiceIT.java index 165be7dff6..4e11242fa3 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsServiceIT.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsServiceIT.java @@ -20,7 +20,8 @@ class TermsAndConditionsServiceIT extends IntegrationTestBase { @BeforeEach public void setUp() { - termsAndConditionsApp = HelperFactory.createTermsAndConditions(TermsAndConditionsType.APP, "app content"); + termsAndConditionsApp = HelperFactory.createTermsAndConditions(TermsAndConditionsType.APP, + "app content"); entityManager.persist(termsAndConditionsApp); termsAndConditionsPortal = HelperFactory.createTermsAndConditions( @@ -32,30 +33,33 @@ public void setUp() { @Test @Transactional - void getLatestTermsAndConditionsApp() { - var latestAppTerms1 = termsAndConditionsService.getLatestTermsAndConditions(TermsAndConditionsType.APP); + void getLatestTermsAndConditionsByTypeApp() { + var latestAppTerms1 = termsAndConditionsService.getLatestTermsAndConditionsByType(TermsAndConditionsType.APP); assertThat(latestAppTerms1.getId()).isEqualTo(termsAndConditionsApp.getId()); var newTerms = HelperFactory.createTermsAndConditions(TermsAndConditionsType.APP, "app content 2"); entityManager.persist(newTerms); - var latestAppTerms2 = termsAndConditionsService.getLatestTermsAndConditions(TermsAndConditionsType.APP); + var latestAppTerms2 = termsAndConditionsService.getLatestTermsAndConditionsByType(TermsAndConditionsType.APP); assertThat(latestAppTerms2.getId()).isEqualTo(newTerms.getId()); assertThat(latestAppTerms2.getCreatedAt()).isAfter(latestAppTerms1.getCreatedAt()); } @Test @Transactional - void getLatestTermsAndConditionsPortal() { - var latestPortalTerms1 = termsAndConditionsService.getLatestTermsAndConditions(TermsAndConditionsType.PORTAL); + void getLatestTermsAndConditionsByTypePortal() { + var latestPortalTerms1 = termsAndConditionsService + .getLatestTermsAndConditionsByType(TermsAndConditionsType.PORTAL); assertThat(latestPortalTerms1.getId()).isEqualTo(termsAndConditionsPortal.getId()); - var newTerms = HelperFactory.createTermsAndConditions(TermsAndConditionsType.PORTAL, "portal content 2"); + var newTerms = HelperFactory.createTermsAndConditions(TermsAndConditionsType.PORTAL, + "portal content 2"); entityManager.persist(newTerms); - var latestPortalTerms2 = termsAndConditionsService.getLatestTermsAndConditions(TermsAndConditionsType.PORTAL); + var latestPortalTerms2 = termsAndConditionsService + .getLatestTermsAndConditionsByType(TermsAndConditionsType.PORTAL); assertThat(latestPortalTerms2.getId()).isEqualTo(newTerms.getId()); assertThat(latestPortalTerms2.getCreatedAt()).isAfter(latestPortalTerms1.getCreatedAt()); } diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/UserServiceIT.java b/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/UserServiceIT.java index 9612f2c4b7..087ab01db4 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/UserServiceIT.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/preapi/services/UserServiceIT.java @@ -8,6 +8,7 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.security.access.AccessDeniedException; +import uk.gov.hmcts.reform.preapi.controllers.params.SearchUsers; import uk.gov.hmcts.reform.preapi.dto.base.BaseUserDTO; import uk.gov.hmcts.reform.preapi.entities.AppAccess; import uk.gov.hmcts.reform.preapi.entities.Court; @@ -114,14 +115,18 @@ void searchUsersAsAdmin() { entityManager.persist(userEntity); entityManager.flush(); - var users = userService.findAllBy(null, null, null, null, null, null, false, null, Pageable.unpaged()).toList(); + var users = userService + .findAllBy(null, Pageable.unpaged()).toList(); Assertions.assertEquals(users.size(), 2); Assertions.assertTrue(users.stream().anyMatch(user -> user.getId().equals(portalUserEntity.getId()))); Assertions.assertTrue(users.stream().anyMatch(user -> user.getId().equals(appUserEntity.getId()))); Assertions.assertFalse(users.stream().anyMatch(user -> user.getId().equals(userEntity.getId()))); - var users2 = userService.findAllBy(null, null, null, null, null, null, true, null, Pageable.unpaged()).toList(); + SearchUsers params = new SearchUsers(); + params.setIncludeDeleted(true); + var users2 = userService + .findAllBy(params, Pageable.unpaged()).toList(); Assertions.assertEquals(users2.size(), 3); Assertions.assertTrue(users2.stream().anyMatch(user -> user.getId().equals(portalUserEntity.getId()))); @@ -137,7 +142,10 @@ public void searchUsersAsNonAdmin() { entityManager.persist(userEntity); entityManager.flush(); - var users = userService.findAllBy(null, null, null, null, null, null, false, null, Pageable.unpaged()).toList(); + var users = userService.findAllBy( + null, + Pageable.unpaged() + ).toList(); Assertions.assertEquals(users.size(), 2); Assertions.assertTrue(users.stream().anyMatch(user -> user.getId().equals(portalUserEntity.getId()))); @@ -146,7 +154,10 @@ public void searchUsersAsNonAdmin() { var message = Assertions.assertThrows( AccessDeniedException.class, - () -> userService.findAllBy(null, null, null, null, null, null, true, null, Pageable.unpaged()).toList() + () -> userService.findAllBy( + null, + Pageable.unpaged() + ).toList() ).getMessage(); Assertions.assertEquals(message, "Access Denied"); @@ -156,15 +167,10 @@ public void searchUsersAsNonAdmin() { @Transactional @Test void testGetUserByAccessType() { + SearchUsers params = new SearchUsers(); + params.setAccessType(AccessType.APP); var resultApp = userService.findAllBy( - null, - null, - null, - null, - null, - AccessType.APP, - false, - null, + params, PageRequest.of(0, 20) ); Assertions.assertEquals(2, resultApp.getContent().size()); @@ -173,15 +179,9 @@ void testGetUserByAccessType() { Assertions.assertEquals(appUserEntity.getId(), usersApp.get(0).getId()); Assertions.assertEquals(userEntity.getId(), usersApp.get(1).getId()); + params.setAccessType(AccessType.PORTAL); var resultPortal = userService.findAllBy( - null, - null, - null, - null, - null, - AccessType.PORTAL, - false, - null, + params, PageRequest.of(0, 20) ); Assertions.assertEquals(2, resultPortal.getContent().size()); @@ -190,7 +190,11 @@ void testGetUserByAccessType() { Assertions.assertEquals(userEntity.getFirstName(), usersPortal.get(0).getFirstName()); Assertions.assertEquals(portalUserEntity.getId(), usersPortal.get(1).getId()); - var resultAll = userService.findAllBy(null, null, null, null, null, null, false,null, PageRequest.of(0, 20)); + params.setAccessType(null); + var resultAll = userService.findAllBy( + params, + PageRequest.of(0, 20) + ); Assertions.assertEquals(3, resultAll.getContent().size()); var usersAll = resultAll.getContent().stream() .sorted(Comparator.comparing(BaseUserDTO::getFirstName)).toList(); @@ -199,15 +203,9 @@ void testGetUserByAccessType() { Assertions.assertEquals(portalUserEntity.getId(), usersAll.get(2).getId()); portalAccessEntity2.setStatus(AccessStatus.INACTIVE); + params.setAccessType(AccessType.PORTAL); var resultPortal2 = userService.findAllBy( - null, - null, - null, - null, - null, - AccessType.PORTAL, - false, - null, + params, PageRequest.of(0, 20) ); Assertions.assertEquals(1, resultPortal2.getContent().size()); diff --git a/src/main/java/uk/gov/hmcts/reform/preapi/controllers/TermsAndConditionsController.java b/src/main/java/uk/gov/hmcts/reform/preapi/controllers/TermsAndConditionsController.java index 4217f6649b..9c1d19a1de 100644 --- a/src/main/java/uk/gov/hmcts/reform/preapi/controllers/TermsAndConditionsController.java +++ b/src/main/java/uk/gov/hmcts/reform/preapi/controllers/TermsAndConditionsController.java @@ -34,7 +34,8 @@ public TermsAndConditionsController(TermsAndConditionsService termsAndConditions summary = "Get the latest terms and conditions for the app" ) public ResponseEntity getLatestAppTermsAndConditions() { - return ResponseEntity.ok(termsAndConditionsService.getLatestTermsAndConditions(TermsAndConditionsType.APP)); + return ResponseEntity.ok(termsAndConditionsService + .getLatestTermsAndConditionsByType(TermsAndConditionsType.APP)); } @GetMapping("/portal-terms-and-conditions/latest") @@ -43,7 +44,8 @@ public ResponseEntity getLatestAppTermsAndConditions() { summary = "Get the latest terms and conditions for the portal" ) public ResponseEntity getLatestPortalTermsAndConditions() { - return ResponseEntity.ok(termsAndConditionsService.getLatestTermsAndConditions(TermsAndConditionsType.PORTAL)); + return ResponseEntity.ok(termsAndConditionsService + .getLatestTermsAndConditionsByType(TermsAndConditionsType.PORTAL)); } @PostMapping("/accept-terms-and-conditions/{termsId}") diff --git a/src/main/java/uk/gov/hmcts/reform/preapi/controllers/UserController.java b/src/main/java/uk/gov/hmcts/reform/preapi/controllers/UserController.java index 6bef74dd69..8919f53c9d 100644 --- a/src/main/java/uk/gov/hmcts/reform/preapi/controllers/UserController.java +++ b/src/main/java/uk/gov/hmcts/reform/preapi/controllers/UserController.java @@ -77,6 +77,16 @@ public ResponseEntity getUserById(@PathVariable UUID userId) { description = "The name of the user to search by", schema = @Schema(implementation = String.class) ) + @Parameter( + name = "firstName", + description = "The first name of the user to search by", + schema = @Schema(implementation = String.class) + ) + @Parameter( + name = "lastName", + description = "The last name of the user to search by", + schema = @Schema(implementation = String.class) + ) @Parameter( name = "email", description = "The email of the user to search by", @@ -133,17 +143,7 @@ public ResponseEntity>> getUsers( @Parameter(hidden = true) Pageable pageable, @Parameter(hidden = true) PagedResourcesAssembler assembler ) { - Page resultPage = userService.findAllBy( - params.getName(), - params.getEmail(), - params.getOrganisation(), - params.getCourtId(), - params.getRoleId(), - params.getAccessType(), - params.getIncludeDeleted() != null && params.getIncludeDeleted(), - params.getAppActive(), - pageable - ); + Page resultPage = userService.findAllBy(params, pageable); if (pageable.getPageNumber() > resultPage.getTotalPages()) { throw new RequestedPageOutOfRangeException(pageable.getPageNumber(), resultPage.getTotalPages()); diff --git a/src/main/java/uk/gov/hmcts/reform/preapi/controllers/params/SearchUsers.java b/src/main/java/uk/gov/hmcts/reform/preapi/controllers/params/SearchUsers.java index c4fd72651f..098abe59b9 100644 --- a/src/main/java/uk/gov/hmcts/reform/preapi/controllers/params/SearchUsers.java +++ b/src/main/java/uk/gov/hmcts/reform/preapi/controllers/params/SearchUsers.java @@ -8,6 +8,8 @@ @Data public class SearchUsers { private String name; + private String firstName; + private String lastName; private String email; private String organisation; private UUID courtId; @@ -20,6 +22,14 @@ public String getName() { return name != null && !name.isEmpty() ? name : null; } + public String getFirstName() { + return firstName != null && !firstName.isEmpty() ? firstName : null; + } + + public String getLastName() { + return lastName != null && !lastName.isEmpty() ? lastName : null; + } + public String getEmail() { return email != null && !email.isEmpty() ? email : null; } diff --git a/src/main/java/uk/gov/hmcts/reform/preapi/dto/validators/PortalAppAccessValidator.java b/src/main/java/uk/gov/hmcts/reform/preapi/dto/validators/PortalAppAccessValidator.java index 396f839073..97437d856c 100644 --- a/src/main/java/uk/gov/hmcts/reform/preapi/dto/validators/PortalAppAccessValidator.java +++ b/src/main/java/uk/gov/hmcts/reform/preapi/dto/validators/PortalAppAccessValidator.java @@ -13,7 +13,7 @@ public class PortalAppAccessValidator private final RoleRepository roleRepository; - private static final String PORTAL_ROLE_NAME = "Level 3"; + public static final String PORTAL_ROLE_NAME = "Level 3"; @Autowired public PortalAppAccessValidator(final RoleRepository roleRepository) { diff --git a/src/main/java/uk/gov/hmcts/reform/preapi/repositories/UserRepository.java b/src/main/java/uk/gov/hmcts/reform/preapi/repositories/UserRepository.java index 266fe0bba6..7bbd61886b 100644 --- a/src/main/java/uk/gov/hmcts/reform/preapi/repositories/UserRepository.java +++ b/src/main/java/uk/gov/hmcts/reform/preapi/repositories/UserRepository.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.preapi.repositories; - import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.EntityGraph; @@ -44,6 +43,8 @@ public interface UserRepository extends JpaRepository { ELSE 0 END = 1 ) + AND (:firstName IS NULL OR u.firstName ILIKE %:firstName%) + AND (:lastName IS NULL OR u.lastName ILIKE %:lastName%) AND (:organisation IS NULL OR u.organisation ILIKE %:organisation%) AND (CAST(:courtId as uuid) IS NULL OR EXISTS (SELECT 1 FROM u.appAccess aa WHERE aa.court.id = :courtId)) AND (CAST(:roleId as uuid) IS NULL OR EXISTS (SELECT 1 FROM u.appAccess aa WHERE aa.role.id = :roleId)) @@ -58,8 +59,11 @@ OR EXISTS ( AND (:isAppUser = false OR EXISTS (SELECT 1 FROM u.appAccess aa WHERE aa.user = u AND aa.deletedAt IS NULL)) """ ) + @SuppressWarnings("PMD.ExcessiveParameterList") Page searchAllBy( @Param("name") String name, + @Param("firstName") String firstName, + @Param("lastName") String lastName, @Param("email") String email, @Param("organisation") String organisation, @Param("courtId") UUID courtId, diff --git a/src/main/java/uk/gov/hmcts/reform/preapi/services/AppAccessService.java b/src/main/java/uk/gov/hmcts/reform/preapi/services/AppAccessService.java index 160fce4684..0d64947b5e 100644 --- a/src/main/java/uk/gov/hmcts/reform/preapi/services/AppAccessService.java +++ b/src/main/java/uk/gov/hmcts/reform/preapi/services/AppAccessService.java @@ -90,4 +90,26 @@ public void deleteById(UUID appId) { appAccessRepository.save(access); }); } + + @Transactional + public void deleteByUserId(UUID userId) { + appAccessRepository + .findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userId) + .forEach(access -> { + access.setActive(false); + access.setDeletedAt(Timestamp.from(Instant.now())); + appAccessRepository.save(access); + }); + } + + @Transactional + public void undeleteByUserId(UUID userId) { + appAccessRepository + .findAllByUser_IdAndDeletedAtIsNotNull(userId) + .forEach(a -> { + a.setDeletedAt(null); + a.setActive(true); + appAccessRepository.save(a); + }); + } } diff --git a/src/main/java/uk/gov/hmcts/reform/preapi/services/PortalAccessService.java b/src/main/java/uk/gov/hmcts/reform/preapi/services/PortalAccessService.java index 2ea33ce6cb..50b764e3aa 100644 --- a/src/main/java/uk/gov/hmcts/reform/preapi/services/PortalAccessService.java +++ b/src/main/java/uk/gov/hmcts/reform/preapi/services/PortalAccessService.java @@ -6,6 +6,7 @@ import org.springframework.transaction.annotation.Transactional; import uk.gov.hmcts.reform.preapi.dto.CreatePortalAccessDTO; import uk.gov.hmcts.reform.preapi.entities.PortalAccess; +import uk.gov.hmcts.reform.preapi.entities.User; import uk.gov.hmcts.reform.preapi.enums.AccessStatus; import uk.gov.hmcts.reform.preapi.enums.UpsertResult; import uk.gov.hmcts.reform.preapi.exception.NotFoundException; @@ -53,6 +54,51 @@ public void deleteById(UUID portalId) { }); } + @Transactional + public void deleteByUserId(UUID userId) { + portalAccessRepository + .findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userId) + .ifPresent(access -> { + access.setStatus(AccessStatus.INACTIVE); + access.setDeletedAt(Timestamp.from(Instant.now())); + portalAccessRepository.save(access); + }); + } + + @Transactional + public void undeleteByUserId(UUID userId) { + portalAccessRepository + .findAllByUser_IdAndDeletedAtIsNotNull(userId) + .forEach(p -> { + p.setDeletedAt(null); + portalAccessRepository.save(p); + }); + } + + public Boolean exists(UUID id) { + return portalAccessRepository.existsById(id); + } + + public Boolean isNotDeletedPortalUser(UUID userId) { + return portalAccessRepository + .findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userId) + .isPresent(); + } + + public void upsertPortalAccessEntity(UUID id, + User userEntity, + AccessStatus accessStatus, + Timestamp timestamp) { + PortalAccess portalAccessEntity = portalAccessRepository + .findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(id) + .orElse(new PortalAccess()); + + portalAccessEntity.setUser(userEntity); + portalAccessEntity.setStatus(accessStatus); + portalAccessEntity.setInvitedAt(timestamp); + portalAccessRepository.save(portalAccessEntity); + } + private AccessStatus getNewStatus(CreatePortalAccessDTO dto) { if (dto.getStatus() == AccessStatus.ACTIVE && dto.getRegisteredAt() == null) { return AccessStatus.INVITATION_SENT; diff --git a/src/main/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsService.java b/src/main/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsService.java index c071eab11e..51dfd46fcc 100644 --- a/src/main/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsService.java +++ b/src/main/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsService.java @@ -3,11 +3,17 @@ import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import uk.gov.hmcts.reform.preapi.dto.TermsAndConditionsDTO; +import uk.gov.hmcts.reform.preapi.entities.TermsAndConditions; import uk.gov.hmcts.reform.preapi.enums.TermsAndConditionsType; import uk.gov.hmcts.reform.preapi.exception.NotFoundException; import uk.gov.hmcts.reform.preapi.repositories.TermsAndConditionsRepository; +import java.util.Arrays; +import java.util.Set; +import java.util.stream.Collectors; + @Service public class TermsAndConditionsService { private final TermsAndConditionsRepository termsAndConditionsRepository; @@ -17,9 +23,18 @@ public TermsAndConditionsService(TermsAndConditionsRepository termsAndConditions this.termsAndConditionsRepository = termsAndConditionsRepository; } - public TermsAndConditionsDTO getLatestTermsAndConditions(@NotNull TermsAndConditionsType type) { + public TermsAndConditionsDTO getLatestTermsAndConditionsByType(@NotNull TermsAndConditionsType type) { return termsAndConditionsRepository.findFirstByTypeOrderByCreatedAtDesc(type) .map(TermsAndConditionsDTO::new) .orElseThrow(() -> new NotFoundException("Terms and conditions of type: " + type)); } + + @Transactional + public Set getAllLatestTermsAndConditions() { + return Arrays.stream(TermsAndConditionsType.values()) + .map(type -> termsAndConditionsRepository.findFirstByTypeOrderByCreatedAtDesc(type) + .orElse(null)) + .collect(Collectors.toSet()); + } + } diff --git a/src/main/java/uk/gov/hmcts/reform/preapi/services/UserService.java b/src/main/java/uk/gov/hmcts/reform/preapi/services/UserService.java index 520f48fc23..4802b9ef0e 100644 --- a/src/main/java/uk/gov/hmcts/reform/preapi/services/UserService.java +++ b/src/main/java/uk/gov/hmcts/reform/preapi/services/UserService.java @@ -1,12 +1,12 @@ package uk.gov.hmcts.reform.preapi.services; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import uk.gov.hmcts.reform.preapi.controllers.params.SearchUsers; import uk.gov.hmcts.reform.preapi.dto.AccessDTO; import uk.gov.hmcts.reform.preapi.dto.CreateAppAccessDTO; import uk.gov.hmcts.reform.preapi.dto.CreateInviteDTO; @@ -20,63 +20,53 @@ import uk.gov.hmcts.reform.preapi.entities.User; import uk.gov.hmcts.reform.preapi.enums.AccessStatus; import uk.gov.hmcts.reform.preapi.enums.AccessType; -import uk.gov.hmcts.reform.preapi.enums.TermsAndConditionsType; import uk.gov.hmcts.reform.preapi.enums.UpsertResult; import uk.gov.hmcts.reform.preapi.exception.ConflictException; import uk.gov.hmcts.reform.preapi.exception.NotFoundException; import uk.gov.hmcts.reform.preapi.exception.ResourceInDeletedStateException; -import uk.gov.hmcts.reform.preapi.repositories.AppAccessRepository; import uk.gov.hmcts.reform.preapi.repositories.CourtRepository; -import uk.gov.hmcts.reform.preapi.repositories.PortalAccessRepository; import uk.gov.hmcts.reform.preapi.repositories.RoleRepository; -import uk.gov.hmcts.reform.preapi.repositories.TermsAndConditionsRepository; import uk.gov.hmcts.reform.preapi.repositories.UserRepository; import java.sql.Timestamp; import java.time.Instant; -import java.util.Arrays; import java.util.Collection; import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.regex.Pattern; -import java.util.stream.Collectors; import java.util.stream.Stream; +import static uk.gov.hmcts.reform.preapi.dto.validators.PortalAppAccessValidator.PORTAL_ROLE_NAME; + @Service @SuppressWarnings("PMD.CouplingBetweenObjects") public class UserService { - private final AppAccessRepository appAccessRepository; + private final AppAccessService appAccessService; + private final PortalAccessService portalAccessService; private final CourtRepository courtRepository; private final RoleRepository roleRepository; private final UserRepository userRepository; - private final PortalAccessRepository portalAccessRepository; - private final AppAccessService appAccessService; - private final PortalAccessService portalAccessService; - private final TermsAndConditionsRepository termsAndConditionsRepository; + private final TermsAndConditionsService termsAndConditionsService; private static final Pattern EMAIL_PATTERN = Pattern.compile( "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$" ); @Autowired - public UserService(AppAccessRepository appAccessRepository, - CourtRepository courtRepository, + public UserService(CourtRepository courtRepository, RoleRepository roleRepository, UserRepository userRepository, - PortalAccessRepository portalAccessRepository, AppAccessService appAccessService, PortalAccessService portalAccessService, - TermsAndConditionsRepository termsAndConditionsRepository) { - this.appAccessRepository = appAccessRepository; + TermsAndConditionsService termsAndConditionsService) { this.courtRepository = courtRepository; this.roleRepository = roleRepository; this.userRepository = userRepository; - this.portalAccessRepository = portalAccessRepository; this.appAccessService = appAccessService; this.portalAccessService = portalAccessService; - this.termsAndConditionsRepository = termsAndConditionsRepository; + this.termsAndConditionsService = termsAndConditionsService; } @Transactional() @@ -85,7 +75,7 @@ public UserDTO findById(UUID userId) { .map(user -> new UserDTO( user, - getAllLatestTermsAndConditions() + termsAndConditionsService.getAllLatestTermsAndConditions() )) .orElseThrow(() -> new NotFoundException("User: " + userId)); } @@ -95,8 +85,8 @@ public AccessDTO findByEmail(String email) { return userRepository.findByEmailOrAlternativeEmailIgnoreCaseAndDeletedAtIsNull(email) .map(access -> new AccessDTO( - access, - getAllLatestTermsAndConditions() + access, + termsAndConditionsService.getAllLatestTermsAndConditions() )) .orElseThrow(() -> new NotFoundException("User: " + email)); } @@ -104,38 +94,40 @@ public AccessDTO findByEmail(String email) { @Transactional @PreAuthorize("!#includeDeleted or @authorisationService.canViewDeleted(authentication)") public Page findAllBy( - String name, - String email, - String organisation, - UUID court, - UUID role, - AccessType accessType, - boolean includeDeleted, - Boolean isAppActive, + SearchUsers searchUsers, Pageable pageable ) { - if (court != null && !courtRepository.existsById(court)) { - throw new NotFoundException("Court: " + court); + if (searchUsers.getCourtId() != null && !courtRepository.existsById(searchUsers.getCourtId())) { + throw new NotFoundException("Court: " + searchUsers.getCourtId()); } - if (role != null && !roleRepository.existsById(role)) { - throw new NotFoundException("Role: " + role); + Set allLatestTermsAndConditions = termsAndConditionsService + .getAllLatestTermsAndConditions(); + + if (searchUsers.getRoleId() != null) { + Role roleFromDb = roleRepository.findById(searchUsers.getRoleId()) + .orElseThrow(() -> new NotFoundException("Role: " + searchUsers.getRoleId())); + + // Is a portal user + if (roleFromDb.getName().equals(PORTAL_ROLE_NAME) && searchUsers.getAccessType() == null) { + return userRepository.searchAllBy( + searchUsers.getName(), searchUsers.getFirstName(), searchUsers.getLastName(), + searchUsers.getEmail(), searchUsers.getOrganisation(), searchUsers.getCourtId(), + null, true, false, + searchUsers.getIncludeDeleted(), searchUsers.getAppActive(), pageable + ).map(user -> new UserDTO(user, allLatestTermsAndConditions)); + } } - Set allLatestTermsAndConditions = getAllLatestTermsAndConditions(); - - return userRepository.searchAllBy( - name, - email, - organisation, - court, - role, - accessType == AccessType.PORTAL, - accessType == AccessType.APP, - includeDeleted, - isAppActive, - pageable - ).map(user -> new UserDTO(user, allLatestTermsAndConditions)); + Page returnedFromDB = userRepository.searchAllBy( + searchUsers.getName(), searchUsers.getFirstName(), searchUsers.getLastName(), + searchUsers.getEmail(), searchUsers.getOrganisation(), searchUsers.getCourtId(), + searchUsers.getRoleId(), + searchUsers.getAccessType() == AccessType.PORTAL, + searchUsers.getAccessType() == AccessType.APP, + searchUsers.getIncludeDeleted(), searchUsers.getAppActive(), pageable + ); + return returnedFromDB.map(user -> new UserDTO(user, allLatestTermsAndConditions)); } @Transactional @@ -152,7 +144,7 @@ public UpsertResult upsert(CreateUserDTO createUserDTO) { } createUserDTO.getPortalAccess().stream().map(CreatePortalAccessDTO::getId).forEach(id -> { - if (!portalAccessRepository.existsById(id)) { + if (!portalAccessService.exists(id)) { throw new NotFoundException("Portal Access: " + id); } }); @@ -196,9 +188,7 @@ public UpsertResult upsert(CreateInviteDTO createInviteDTO) { Optional user = userRepository.findById(createInviteDTO.getUserId()); if (user.isPresent() && user.get().isDeleted()) { throw new ResourceInDeletedStateException("UserDTO", createInviteDTO.getUserId().toString()); - } else if (user.isPresent() && portalAccessRepository - .findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(createInviteDTO.getUserId()) - .isPresent()) { + } else if (user.isPresent() && portalAccessService.isNotDeletedPortalUser(createInviteDTO.getUserId())) { return UpsertResult.UPDATED; } @@ -212,14 +202,12 @@ public UpsertResult upsert(CreateInviteDTO createInviteDTO) { userEntity.setPhone(createInviteDTO.getPhone()); userRepository.save(userEntity); - PortalAccess portalAccessEntity = portalAccessRepository - .findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(createInviteDTO.getUserId()) - .orElse(new PortalAccess()); - - portalAccessEntity.setUser(userEntity); - portalAccessEntity.setStatus(AccessStatus.INVITATION_SENT); - portalAccessEntity.setInvitedAt(Timestamp.from(Instant.now())); - portalAccessRepository.save(portalAccessEntity); + portalAccessService.upsertPortalAccessEntity( + createInviteDTO.getUserId(), + userEntity, + AccessStatus.INVITATION_SENT, + Timestamp.from(Instant.now()) + ); return UpsertResult.CREATED; } @@ -230,15 +218,8 @@ public void deleteById(UUID userId) { throw new NotFoundException("User: " + userId); } - portalAccessRepository - .findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userId) - .ifPresent(portalAccess -> portalAccessService.deleteById(portalAccess.getId())); - - appAccessRepository - .findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userId) - .stream() - .map(AppAccess::getId) - .forEach(appAccessService::deleteById); + portalAccessService.deleteByUserId(userId); + appAccessService.deleteByUserId(userId); userRepository .findById(userId) @@ -258,29 +239,10 @@ public void undelete(UUID id) { entity.setDeletedAt(null); userRepository.save(entity); - appAccessRepository - .findAllByUser_IdAndDeletedAtIsNotNull(id) - .forEach(a -> { - a.setDeletedAt(null); - a.setActive(true); - appAccessRepository.save(a); - }); - - portalAccessRepository - .findAllByUser_IdAndDeletedAtIsNotNull(id) - .forEach(p -> { - p.setDeletedAt(null); - portalAccessRepository.save(p); - }); + appAccessService.undeleteByUserId(id); + portalAccessService.undeleteByUserId(id); } - @Transactional - public Set getAllLatestTermsAndConditions() { - return Arrays.stream(TermsAndConditionsType.values()) - .map(type -> termsAndConditionsRepository.findFirstByTypeOrderByCreatedAtDesc(type) - .orElse(null)) - .collect(Collectors.toSet()); - } @Transactional(readOnly = true) public Optional findByOriginalEmail(String email) { diff --git a/src/main/java/uk/gov/hmcts/reform/preapi/services/edit/EditRequestCrudService.java b/src/main/java/uk/gov/hmcts/reform/preapi/services/edit/EditRequestCrudService.java index d2cf70e871..8f91312ad9 100644 --- a/src/main/java/uk/gov/hmcts/reform/preapi/services/edit/EditRequestCrudService.java +++ b/src/main/java/uk/gov/hmcts/reform/preapi/services/edit/EditRequestCrudService.java @@ -142,7 +142,7 @@ public Set findRecordingIdsWithForceReencodeRequests(Set sourceRecor return editRequestRepository.findSourceRecordingIdsWithForceReencodeRequests(sourceRecordingIds); } - + private UpsertResult handleEmptyInstructions(CreateEditRequestDTO dto, Optional existingEditRequest, boolean isUpdate) { diff --git a/src/test/java/uk/gov/hmcts/reform/preapi/batch/application/services/MigrationRecordServiceTest.java b/src/test/java/uk/gov/hmcts/reform/preapi/batch/application/services/MigrationRecordServiceTest.java index 237f68e876..791edcbfc3 100644 --- a/src/test/java/uk/gov/hmcts/reform/preapi/batch/application/services/MigrationRecordServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/preapi/batch/application/services/MigrationRecordServiceTest.java @@ -80,7 +80,7 @@ void setUp() { @Test @DisplayName("Should return lowercase combined string from non-null parameters") void generateRecordingGroupKeyShouldReturnLowercaseCombinedString() { - LocalDateTime createTime = LocalDateTime.of(2024, 12, 11, 10, 0); + LocalDateTime createTime = LocalDateTime.of(2024, 12, 11, 10, 0); String result = MigrationRecordService.generateRecordingGroupKey( "URN123", "EXHIBIT1", "John", "Doe", "241211",createTime); @@ -90,7 +90,7 @@ void generateRecordingGroupKeyShouldReturnLowercaseCombinedString() { @Test @DisplayName("Should handle null values by replacing with empty strings") void generateRecordingGroupKeyShouldHandleNullValues() { - LocalDateTime createTime = LocalDateTime.of(2024, 12, 11, 10, 0); + LocalDateTime createTime = LocalDateTime.of(2024, 12, 11, 10, 0); String result = MigrationRecordService.generateRecordingGroupKey( null, "EXHIBIT1", null, "Doe","241211", createTime); @@ -100,7 +100,7 @@ void generateRecordingGroupKeyShouldHandleNullValues() { @Test @DisplayName("Should trim leading and trailing whitespace") void generateRecordingGroupKeyShouldTrimWhitespace() { - LocalDateTime createTime = LocalDateTime.of(2024, 12, 11, 10, 0); + LocalDateTime createTime = LocalDateTime.of(2024, 12, 11, 10, 0); String result = MigrationRecordService.generateRecordingGroupKey(" URN123 ", " EXHIBIT1 ", " John ", " Doe ","241211", createTime); @@ -1451,7 +1451,7 @@ void updateIgnoredRecord() { void updateIgnoredRecordWithNullCourtId() { final CreateVfMigrationRecordDTO dto = new CreateVfMigrationRecordDTO(); dto.setId(UUID.randomUUID()); - dto.setCourtId(null); + dto.setCourtId(null); dto.setUrn("updated-urn"); dto.setDefendantName("updated-defendant"); dto.setWitnessName("updated-witness"); @@ -1479,7 +1479,7 @@ void updateIgnoredRecordWithNullFieldsUsesExisting() { dto.setId(UUID.randomUUID()); dto.setCourtId(UUID.randomUUID()); dto.setUrn(null); - dto.setDefendantName(""); + dto.setDefendantName(""); dto.setWitnessName(null); dto.setRecordingVersion(VfMigrationRecordingVersion.ORIG); dto.setStatus(VfMigrationStatus.FAILED); @@ -1514,7 +1514,7 @@ void updateHandlesInvalidRecordingVersionInEntity() { dto.setUrn("URN1234567"); dto.setDefendantName("defendant-name"); dto.setWitnessName("witness-name"); - dto.setRecordingVersion(null); + dto.setRecordingVersion(null); dto.setRecordingVersionNumber(null); dto.setStatus(VfMigrationStatus.FAILED); @@ -1522,8 +1522,8 @@ void updateHandlesInvalidRecordingVersionInEntity() { court.setName("Test Court"); final MigrationRecord migrationRecord = createMigrationRecord(); - migrationRecord.setStatus(VfMigrationStatus.IGNORED); - migrationRecord.setRecordingVersion("INVALID_VERSION"); + migrationRecord.setStatus(VfMigrationStatus.IGNORED); + migrationRecord.setRecordingVersion("INVALID_VERSION"); when(migrationRecordRepository.findById(dto.getId())).thenReturn(Optional.of(migrationRecord)); when(courtRepository.findById(dto.getCourtId())).thenReturn(Optional.of(court)); @@ -1548,7 +1548,7 @@ void updateNonIgnoredRecordWithNullCourtIdThrowsException() { dto.setStatus(VfMigrationStatus.FAILED); final MigrationRecord migrationRecord = createMigrationRecord(); - migrationRecord.setStatus(VfMigrationStatus.PENDING); + migrationRecord.setStatus(VfMigrationStatus.PENDING); when(migrationRecordRepository.findById(dto.getId())).thenReturn(Optional.of(migrationRecord)); @@ -1589,14 +1589,14 @@ void updateNonIgnoredRecordWithEmptyUrnThrowsException() { final CreateVfMigrationRecordDTO dto = new CreateVfMigrationRecordDTO(); dto.setId(UUID.randomUUID()); dto.setCourtId(UUID.randomUUID()); - dto.setUrn(" "); + dto.setUrn(" "); dto.setDefendantName("defendant-name"); dto.setWitnessName("witness-name"); dto.setRecordingVersion(VfMigrationRecordingVersion.ORIG); dto.setStatus(VfMigrationStatus.FAILED); final MigrationRecord migrationRecord = createMigrationRecord(); - migrationRecord.setStatus(VfMigrationStatus.PENDING); + migrationRecord.setStatus(VfMigrationStatus.PENDING); when(migrationRecordRepository.findById(dto.getId())).thenReturn(Optional.of(migrationRecord)); @@ -1620,7 +1620,7 @@ void updateNonIgnoredRecordWithNullDefendantNameThrowsException() { dto.setStatus(VfMigrationStatus.FAILED); final MigrationRecord migrationRecord = createMigrationRecord(); - migrationRecord.setStatus(VfMigrationStatus.PENDING); + migrationRecord.setStatus(VfMigrationStatus.PENDING); when(migrationRecordRepository.findById(dto.getId())).thenReturn(Optional.of(migrationRecord)); @@ -1668,7 +1668,7 @@ void updateNonIgnoredRecordWithNullRecordingVersionThrowsException() { dto.setStatus(VfMigrationStatus.FAILED); final MigrationRecord migrationRecord = createMigrationRecord(); - migrationRecord.setStatus(VfMigrationStatus.PENDING); + migrationRecord.setStatus(VfMigrationStatus.PENDING); when(migrationRecordRepository.findById(dto.getId())).thenReturn(Optional.of(migrationRecord)); @@ -1688,7 +1688,7 @@ void updateIgnoredRecordWithNullRecordingVersionAndNoEntityVersion() { dto.setUrn("URN1234567"); dto.setDefendantName("defendant-name"); dto.setWitnessName("witness-name"); - dto.setRecordingVersion(null); + dto.setRecordingVersion(null); dto.setStatus(VfMigrationStatus.FAILED); final Court court = new Court(); @@ -1696,7 +1696,7 @@ void updateIgnoredRecordWithNullRecordingVersionAndNoEntityVersion() { final MigrationRecord migrationRecord = createMigrationRecord(); migrationRecord.setStatus(VfMigrationStatus.IGNORED); - migrationRecord.setRecordingVersion(null); + migrationRecord.setRecordingVersion(null); when(migrationRecordRepository.findById(dto.getId())).thenReturn(Optional.of(migrationRecord)); when(courtRepository.findById(dto.getCourtId())).thenReturn(Optional.of(court)); @@ -1777,7 +1777,7 @@ void getOrigFromCopyShouldReturnOriginalFromGroupWhenParentTempIdIsNull() { MigrationRecord copy = new MigrationRecord(); copy.setParentTempId(null); copy.setRecordingGroupKey("test-group"); - + MigrationRecord orig1 = new MigrationRecord(); orig1.setId(UUID.randomUUID()); orig1.setRecordingVersion("ORIG"); @@ -1786,7 +1786,7 @@ void getOrigFromCopyShouldReturnOriginalFromGroupWhenParentTempIdIsNull() { orig1.setIsPreferred(false); orig1.setArchiveName("test1.raw"); orig1.setCreatedAt(Timestamp.from(Instant.now().minusSeconds(100))); - + MigrationRecord orig2 = new MigrationRecord(); orig2.setId(UUID.randomUUID()); orig2.setRecordingVersion("ORIG"); @@ -1795,15 +1795,15 @@ void getOrigFromCopyShouldReturnOriginalFromGroupWhenParentTempIdIsNull() { orig2.setIsPreferred(true); orig2.setArchiveName("test2.mp4"); orig2.setCreatedAt(Timestamp.from(Instant.now().minusSeconds(50))); - + List groupRecords = List.of(orig1, orig2); - + when(migrationRecordRepository.findByRecordingGroupKey("test-group")).thenReturn(groupRecords); - + Optional result = migrationRecordService.getOrigFromCopy(copy); - + assertTrue(result.isPresent()); - assertThat(result.get()).isEqualTo(orig2); + assertThat(result.get()).isEqualTo(orig2); } @Test @@ -1812,7 +1812,7 @@ void getOrigFromCopyShouldReturnMp4RecordWhenNoPreferredFlag() { MigrationRecord copy = new MigrationRecord(); copy.setParentTempId(null); copy.setRecordingGroupKey("test-group"); - + MigrationRecord orig1 = new MigrationRecord(); orig1.setId(UUID.randomUUID()); orig1.setRecordingVersion("ORIG"); @@ -1821,7 +1821,7 @@ void getOrigFromCopyShouldReturnMp4RecordWhenNoPreferredFlag() { orig1.setIsPreferred(false); orig1.setArchiveName("test1.raw"); orig1.setCreatedAt(Timestamp.from(Instant.now().minusSeconds(100))); - + MigrationRecord orig2 = new MigrationRecord(); orig2.setId(UUID.randomUUID()); orig2.setRecordingVersion("ORIG"); @@ -1830,15 +1830,15 @@ void getOrigFromCopyShouldReturnMp4RecordWhenNoPreferredFlag() { orig2.setIsPreferred(false); orig2.setArchiveName("test2.mp4"); orig2.setCreatedAt(Timestamp.from(Instant.now().minusSeconds(50))); - + List groupRecords = List.of(orig1, orig2); - + when(migrationRecordRepository.findByRecordingGroupKey("test-group")).thenReturn(groupRecords); - + Optional result = migrationRecordService.getOrigFromCopy(copy); - + assertTrue(result.isPresent()); - assertThat(result.get()).isEqualTo(orig2); + assertThat(result.get()).isEqualTo(orig2); } @Test @@ -1847,7 +1847,7 @@ void getOrigFromCopyShouldReturnByCreationTimeWhenNoPreferredOrMp4() { MigrationRecord copy = new MigrationRecord(); copy.setParentTempId(null); copy.setRecordingGroupKey("test-group"); - + MigrationRecord orig1 = new MigrationRecord(); orig1.setId(UUID.randomUUID()); orig1.setRecordingVersion("ORIG"); @@ -1856,7 +1856,7 @@ void getOrigFromCopyShouldReturnByCreationTimeWhenNoPreferredOrMp4() { orig1.setIsPreferred(false); orig1.setArchiveName("test1.raw"); orig1.setCreatedAt(Timestamp.from(Instant.now().minusSeconds(100))); - + MigrationRecord orig2 = new MigrationRecord(); orig2.setId(UUID.randomUUID()); orig2.setRecordingVersion("ORIG"); @@ -1865,13 +1865,13 @@ void getOrigFromCopyShouldReturnByCreationTimeWhenNoPreferredOrMp4() { orig2.setIsPreferred(false); orig2.setArchiveName("test2.raw"); orig2.setCreatedAt(Timestamp.from(Instant.now().minusSeconds(50))); - + List groupRecords = List.of(orig1, orig2); - + when(migrationRecordRepository.findByRecordingGroupKey("test-group")).thenReturn(groupRecords); - + Optional result = migrationRecordService.getOrigFromCopy(copy); - + assertTrue(result.isPresent()); assertThat(result.get()).isEqualTo(orig1); } @@ -1882,19 +1882,19 @@ void getOrigFromCopyShouldReturnEmptyWhenNoOrigRecordsInGroup() { MigrationRecord copy = new MigrationRecord(); copy.setParentTempId(null); copy.setRecordingGroupKey("test-group"); - + MigrationRecord copyRecord = new MigrationRecord(); copyRecord.setId(UUID.randomUUID()); copyRecord.setRecordingVersion("COPY"); copyRecord.setStatus(VfMigrationStatus.SUCCESS); copyRecord.setRecordingId(UUID.randomUUID()); - + List groupRecords = List.of(copyRecord); - + when(migrationRecordRepository.findByRecordingGroupKey("test-group")).thenReturn(groupRecords); - + Optional result = migrationRecordService.getOrigFromCopy(copy); - + assertTrue(result.isEmpty()); } @@ -1904,19 +1904,19 @@ void getOrigFromCopyShouldReturnEmptyWhenOrigRecordsHaveNoRecordingId() { MigrationRecord copy = new MigrationRecord(); copy.setParentTempId(null); copy.setRecordingGroupKey("test-group"); - + MigrationRecord orig = new MigrationRecord(); orig.setId(UUID.randomUUID()); orig.setRecordingVersion("ORIG"); orig.setStatus(VfMigrationStatus.SUCCESS); orig.setRecordingId(null); - + List groupRecords = List.of(orig); - + when(migrationRecordRepository.findByRecordingGroupKey("test-group")).thenReturn(groupRecords); - + Optional result = migrationRecordService.getOrigFromCopy(copy); - + assertTrue(result.isEmpty()); } @@ -1949,7 +1949,7 @@ void getOrigFromCopyShouldPreferMp4WhenSorting() { MigrationRecord copy = new MigrationRecord(); copy.setParentTempId(null); copy.setRecordingGroupKey("test-group"); - + MigrationRecord orig1 = new MigrationRecord(); orig1.setId(UUID.randomUUID()); orig1.setRecordingVersion("ORIG"); @@ -1958,7 +1958,7 @@ void getOrigFromCopyShouldPreferMp4WhenSorting() { orig1.setIsPreferred(false); orig1.setArchiveName("test1.raw"); orig1.setCreatedAt(Timestamp.from(Instant.now().minusSeconds(50))); - + MigrationRecord orig2 = new MigrationRecord(); orig2.setId(UUID.randomUUID()); orig2.setRecordingVersion("ORIG"); @@ -1967,13 +1967,13 @@ void getOrigFromCopyShouldPreferMp4WhenSorting() { orig2.setIsPreferred(false); orig2.setArchiveName("test2.mp4"); orig2.setCreatedAt(Timestamp.from(Instant.now().minusSeconds(100))); - + List groupRecords = List.of(orig1, orig2); - + when(migrationRecordRepository.findByRecordingGroupKey("test-group")).thenReturn(groupRecords); - + Optional result = migrationRecordService.getOrigFromCopy(copy); - + assertTrue(result.isPresent()); assertThat(result.get()).isEqualTo(orig2); } @@ -1984,7 +1984,7 @@ void getOrigFromCopyShouldPreferPreferredFlagWhenSorting() { MigrationRecord copy = new MigrationRecord(); copy.setParentTempId(null); copy.setRecordingGroupKey("test-group"); - + MigrationRecord orig1 = new MigrationRecord(); orig1.setId(UUID.randomUUID()); orig1.setRecordingVersion("ORIG"); @@ -1993,7 +1993,7 @@ void getOrigFromCopyShouldPreferPreferredFlagWhenSorting() { orig1.setIsPreferred(false); orig1.setArchiveName("test1.mp4"); orig1.setCreatedAt(Timestamp.from(Instant.now().minusSeconds(50))); - + MigrationRecord orig2 = new MigrationRecord(); orig2.setId(UUID.randomUUID()); orig2.setRecordingVersion("ORIG"); @@ -2002,15 +2002,15 @@ void getOrigFromCopyShouldPreferPreferredFlagWhenSorting() { orig2.setIsPreferred(true); orig2.setArchiveName("test2.raw"); orig2.setCreatedAt(Timestamp.from(Instant.now().minusSeconds(100))); - + List groupRecords = List.of(orig1, orig2); - + when(migrationRecordRepository.findByRecordingGroupKey("test-group")).thenReturn(groupRecords); - + Optional result = migrationRecordService.getOrigFromCopy(copy); - + assertTrue(result.isPresent()); - assertThat(result.get()).isEqualTo(orig2); + assertThat(result.get()).isEqualTo(orig2); } @Test @@ -2019,11 +2019,11 @@ void getOrigFromCopyShouldReturnEmptyWhenNoOriginalRecordsFound() { MigrationRecord copy = new MigrationRecord(); copy.setParentTempId(null); copy.setRecordingGroupKey("test-group"); - + when(migrationRecordRepository.findByRecordingGroupKey("test-group")).thenReturn(List.of()); - + Optional result = migrationRecordService.getOrigFromCopy(copy); - + assertFalse(result.isPresent()); } @@ -2033,7 +2033,7 @@ void getOrigFromCopyShouldReturnEmptyWhenNoSuccessfulOriginalRecordsFound() { MigrationRecord copy = new MigrationRecord(); copy.setParentTempId(null); copy.setRecordingGroupKey("test-group"); - + MigrationRecord orig = new MigrationRecord(); orig.setId(UUID.randomUUID()); orig.setRecordingVersion("ORIG"); @@ -2042,11 +2042,11 @@ void getOrigFromCopyShouldReturnEmptyWhenNoSuccessfulOriginalRecordsFound() { orig.setIsPreferred(true); orig.setArchiveName("test.mp4"); orig.setCreatedAt(Timestamp.from(Instant.now())); - + when(migrationRecordRepository.findByRecordingGroupKey("test-group")).thenReturn(List.of(orig)); - + Optional result = migrationRecordService.getOrigFromCopy(copy); - + assertFalse(result.isPresent()); } @@ -2056,7 +2056,7 @@ void getOrigFromCopyShouldReturnEmptyWhenOriginalRecordHasNoRecordingId() { MigrationRecord copy = new MigrationRecord(); copy.setParentTempId(null); copy.setRecordingGroupKey("test-group"); - + MigrationRecord orig = new MigrationRecord(); orig.setId(UUID.randomUUID()); orig.setRecordingVersion("ORIG"); @@ -2065,11 +2065,11 @@ void getOrigFromCopyShouldReturnEmptyWhenOriginalRecordHasNoRecordingId() { orig.setIsPreferred(true); orig.setArchiveName("test.mp4"); orig.setCreatedAt(Timestamp.from(Instant.now())); - + when(migrationRecordRepository.findByRecordingGroupKey("test-group")).thenReturn(List.of(orig)); - + Optional result = migrationRecordService.getOrigFromCopy(copy); - + assertFalse(result.isPresent()); } diff --git a/src/test/java/uk/gov/hmcts/reform/preapi/controller/TermsAndConditionsControllerTest.java b/src/test/java/uk/gov/hmcts/reform/preapi/controller/TermsAndConditionsControllerTest.java index 125e2793f7..1c2a610bbb 100644 --- a/src/test/java/uk/gov/hmcts/reform/preapi/controller/TermsAndConditionsControllerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/preapi/controller/TermsAndConditionsControllerTest.java @@ -60,7 +60,7 @@ void getLatestTermsAndConditionsAppSuccess() throws Exception { model.setType(TermsAndConditionsType.APP); model.setCreatedAt(Timestamp.from(Instant.now())); - when(termsAndConditionsService.getLatestTermsAndConditions(TermsAndConditionsType.APP)) + when(termsAndConditionsService.getLatestTermsAndConditionsByType(TermsAndConditionsType.APP)) .thenReturn(model); mockMvc.perform(get(TEST_URL + "/app-terms-and-conditions/latest")) @@ -70,14 +70,14 @@ void getLatestTermsAndConditionsAppSuccess() throws Exception { .andExpect(jsonPath("$.type").value(model.getType().toString())) .andExpect(jsonPath("$.html").value(model.getHtml())); - verify(termsAndConditionsService).getLatestTermsAndConditions(TermsAndConditionsType.APP); + verify(termsAndConditionsService).getLatestTermsAndConditionsByType(TermsAndConditionsType.APP); } @Test @DisplayName("Should return 404 error when there are no terms and conditions for app") void getLatestTermsAndConditionsAppNotFound() throws Exception { doThrow(new NotFoundException("Terms and conditions of type: APP")) - .when(termsAndConditionsService).getLatestTermsAndConditions(TermsAndConditionsType.APP); + .when(termsAndConditionsService).getLatestTermsAndConditionsByType(TermsAndConditionsType.APP); mockMvc.perform(get(TEST_URL + "/app-terms-and-conditions/latest")) .andExpect(status().isNotFound()) @@ -85,7 +85,7 @@ void getLatestTermsAndConditionsAppNotFound() throws Exception { .andExpect(jsonPath("$.message") .value("Not found: Terms and conditions of type: APP")); - verify(termsAndConditionsService).getLatestTermsAndConditions(TermsAndConditionsType.APP); + verify(termsAndConditionsService).getLatestTermsAndConditionsByType(TermsAndConditionsType.APP); } @Test @@ -97,7 +97,7 @@ void getLatestTermsAndConditionsPortalSuccess() throws Exception { model.setType(TermsAndConditionsType.PORTAL); model.setCreatedAt(Timestamp.from(Instant.now())); - when(termsAndConditionsService.getLatestTermsAndConditions(TermsAndConditionsType.PORTAL)) + when(termsAndConditionsService.getLatestTermsAndConditionsByType(TermsAndConditionsType.PORTAL)) .thenReturn(model); mockMvc.perform(get(TEST_URL + "/portal-terms-and-conditions/latest")) @@ -107,14 +107,14 @@ void getLatestTermsAndConditionsPortalSuccess() throws Exception { .andExpect(jsonPath("$.type").value(model.getType().toString())) .andExpect(jsonPath("$.html").value(model.getHtml())); - verify(termsAndConditionsService).getLatestTermsAndConditions(TermsAndConditionsType.PORTAL); + verify(termsAndConditionsService).getLatestTermsAndConditionsByType(TermsAndConditionsType.PORTAL); } @Test @DisplayName("Should return 404 error when there are no terms and conditions for portal") void getLatestTermsAndConditionsPortalNotFound() throws Exception { doThrow(new NotFoundException("Terms and conditions of type: PORTAL")) - .when(termsAndConditionsService).getLatestTermsAndConditions(TermsAndConditionsType.PORTAL); + .when(termsAndConditionsService).getLatestTermsAndConditionsByType(TermsAndConditionsType.PORTAL); mockMvc.perform(get(TEST_URL + "/portal-terms-and-conditions/latest")) .andExpect(status().isNotFound()) @@ -122,7 +122,7 @@ void getLatestTermsAndConditionsPortalNotFound() throws Exception { .andExpect(jsonPath("$.message") .value("Not found: Terms and conditions of type: PORTAL")); - verify(termsAndConditionsService).getLatestTermsAndConditions(TermsAndConditionsType.PORTAL); + verify(termsAndConditionsService).getLatestTermsAndConditionsByType(TermsAndConditionsType.PORTAL); } @Test diff --git a/src/test/java/uk/gov/hmcts/reform/preapi/controller/UserControllerTest.java b/src/test/java/uk/gov/hmcts/reform/preapi/controller/UserControllerTest.java index cfd8bb66ed..77e6ed479d 100644 --- a/src/test/java/uk/gov/hmcts/reform/preapi/controller/UserControllerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/preapi/controller/UserControllerTest.java @@ -5,6 +5,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -14,6 +15,7 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import uk.gov.hmcts.reform.preapi.controllers.UserController; +import uk.gov.hmcts.reform.preapi.controllers.params.SearchUsers; import uk.gov.hmcts.reform.preapi.dto.AccessDTO; import uk.gov.hmcts.reform.preapi.dto.CreateAppAccessDTO; import uk.gov.hmcts.reform.preapi.dto.CreatePortalAccessDTO; @@ -40,9 +42,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; @@ -115,22 +114,16 @@ void getUserByIdNotFound() throws Exception { .andExpect(jsonPath("$.message").value("Not found: User: " + userId)); } - @DisplayName("Should return a list of users with 200 response code") + @DisplayName("Should return a list of users with 200 response code with empty params") @Test void getUsersSuccess() throws Exception { var userId = UUID.randomUUID(); var mockCourt = new UserDTO(); mockCourt.setId(userId); var userList = new PageImpl<>(List.of(mockCourt)); + when(userService.findAllBy( - isNull(), - isNull(), - isNull(), - isNull(), - isNull(), - isNull(), - eq(false), - isNull(), + any(), any() )).thenReturn(userList); @@ -139,17 +132,19 @@ void getUsersSuccess() throws Exception { .andExpect(jsonPath("$._embedded.userDTOList").isNotEmpty()) .andExpect(jsonPath("$._embedded.userDTOList[0].id").value(userId.toString())); - verify(userService, times(1)).findAllBy( - isNull(), - isNull(), - isNull(), - isNull(), - isNull(), - isNull(), - eq(false), - isNull(), - any() - ); + ArgumentCaptor paramsCaptor = ArgumentCaptor.forClass(SearchUsers.class); + verify(userService, times(1)).findAllBy(paramsCaptor.capture(), any()); + + SearchUsers parameters = paramsCaptor.getValue(); + assertThat(parameters.getCourtId()).isNull(); + assertThat(parameters.getRoleId()).isNull(); + assertThat(parameters.getEmail()).isNull(); + assertThat(parameters.getFirstName()).isNull(); + assertThat(parameters.getLastName()).isNull(); + assertThat(parameters.getOrganisation()).isNull(); + assertThat(parameters.getIncludeDeleted()).isNull(); + assertThat(parameters.getAppActive()).isNull(); + assertThat(parameters.getAccessType()).isNull(); } @DisplayName("Should return a 404 when searching by a court that doesn't exist") @@ -158,7 +153,10 @@ void getUsersCourtNotFound() throws Exception { UUID courtId = UUID.randomUUID(); doThrow(new NotFoundException("Court: " + courtId)) .when(userService) - .findAllBy(isNull(), isNull(), isNull(), eq(courtId), isNull(), isNull(), eq(false), isNull(), any()); + .findAllBy( + any(), + any() + ); mockMvc.perform(get("/users") .param("courtId", courtId.toString())) @@ -172,7 +170,7 @@ void getUsersRoleNotFound() throws Exception { UUID roleId = UUID.randomUUID(); doThrow(new NotFoundException("Role: " + roleId)) .when(userService) - .findAllBy(any(), any(), any(), any(), eq(roleId), any(), eq(false), any(), any()); + .findAllBy(any(), any()); mockMvc.perform(get("/users") .param("roleId", roleId.toString())) @@ -210,7 +208,7 @@ void deleteUserByIdNotFound() throws Exception { @Test void createUserCreated() throws Exception { var userId = UUID.randomUUID(); - var user = new CreateUserDTO(); + var user = new CreateUserDTO(); user.setId(userId); user.setFirstName("Example"); user.setLastName("Person"); @@ -238,7 +236,7 @@ void createUserCreated() throws Exception { @Test void updateUserNoContent() throws Exception { var userId = UUID.randomUUID(); - var user = new CreateUserDTO(); + var user = new CreateUserDTO(); user.setId(userId); user.setFirstName("Example"); user.setLastName("Person"); @@ -266,7 +264,7 @@ void updateUserNoContent() throws Exception { @Test void createUserIdMismatch() throws Exception { var userId = UUID.randomUUID(); - var user = new CreateUserDTO(); + var user = new CreateUserDTO(); user.setId(userId); user.setFirstName("Example"); user.setLastName("Person"); @@ -913,21 +911,13 @@ void getUserByEmailNotFound() throws Exception { .andExpect(jsonPath("$.message").value("Not found: User: " + userEmail)); } - @DisplayName("Should set include deleted param to false if not set") + @DisplayName("Should pass through params as they are set") @Test public void testGetCasesIncludeDeletedNotSet() throws Exception { when(userService.findAllBy( - isNull(), - isNull(), - isNull(), - isNull(), - isNull(), - isNull(), - anyBoolean(), - isNull(), + any(), any() - )) - .thenReturn(new PageImpl<>(List.of())); + )).thenReturn(new PageImpl<>(List.of())); mockMvc.perform(get("/users") .with(csrf()) @@ -935,22 +925,22 @@ public void testGetCasesIncludeDeletedNotSet() throws Exception { .andExpect(status().isOk()) .andReturn(); + ArgumentCaptor searchUsersCaptor = ArgumentCaptor.forClass(SearchUsers.class); verify(userService, times(1)) - .findAllBy(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), eq(false), isNull(), any()); + .findAllBy( + searchUsersCaptor.capture(), + any() + ); + assertThat(searchUsersCaptor.getValue().getIncludeDeleted()).isNull(); } @DisplayName("Should set include deleted param to false when set to false") @Test public void testGetCasesIncludeDeletedFalse() throws Exception { + SearchUsers searchUsers = mock(SearchUsers.class); + when(searchUsers.getIncludeDeleted()).thenReturn(false); when(userService.findAllBy( - isNull(), - isNull(), - isNull(), - isNull(), - isNull(), - isNull(), - anyBoolean(), - isNull(), + any(), any() )).thenReturn(new PageImpl<>(List.of())); @@ -961,22 +951,17 @@ public void testGetCasesIncludeDeletedFalse() throws Exception { .andExpect(status().isOk()) .andReturn(); + ArgumentCaptor searchUsersCaptor = ArgumentCaptor.forClass(SearchUsers.class); verify(userService, times(1)) - .findAllBy(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), eq(false), isNull(), any()); + .findAllBy(searchUsersCaptor.capture(), any()); + assertThat(searchUsersCaptor.getValue().getIncludeDeleted()).isFalse(); } @DisplayName("Should set include deleted param to true when set to true") @Test public void testGetCasesIncludeDeletedTrue() throws Exception { when(userService.findAllBy( - isNull(), - isNull(), - isNull(), - isNull(), - isNull(), - isNull(), - anyBoolean(), - isNull(), + any(), any() )).thenReturn(new PageImpl<>(List.of())); @@ -987,8 +972,14 @@ public void testGetCasesIncludeDeletedTrue() throws Exception { .andExpect(status().isOk()) .andReturn(); + ArgumentCaptor searchUsersCaptor = ArgumentCaptor.forClass(SearchUsers.class); verify(userService, times(1)) - .findAllBy(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), eq(true), isNull(), any()); + .findAllBy( + searchUsersCaptor.capture(), + any() + ); + + assertThat(searchUsersCaptor.getValue().getIncludeDeleted()).isTrue(); } @DisplayName("Should undelete a user by id and return a 200 response") diff --git a/src/test/java/uk/gov/hmcts/reform/preapi/controller/VfMigrationControllerTest.java b/src/test/java/uk/gov/hmcts/reform/preapi/controller/VfMigrationControllerTest.java index 2ae2e67f9c..2c1804fedc 100644 --- a/src/test/java/uk/gov/hmcts/reform/preapi/controller/VfMigrationControllerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/preapi/controller/VfMigrationControllerTest.java @@ -353,7 +353,7 @@ public void putMigrationRecordExhibitReferenceNull() throws Exception { createDto.setWitnessName("witness-name"); createDto.setCourtId(UUID.randomUUID()); createDto.setRecordingVersion(VfMigrationRecordingVersion.ORIG); - + when(migrationRecordService.update(any(CreateVfMigrationRecordDTO.class))).thenReturn(UpsertResult.UPDATED); mockMvc.perform(put("/vf-migration-records/" + mockId) @@ -361,7 +361,7 @@ public void putMigrationRecordExhibitReferenceNull() throws Exception { .content(OBJECT_MAPPER.writeValueAsString(createDto)) .contentType(MediaType.APPLICATION_JSON_VALUE) .accept(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isNoContent()); + .andExpect(status().isNoContent()); } @Test @@ -394,7 +394,7 @@ public void putMigrationRecordExhibitReferenceTooShort() throws Exception { UUID mockId = UUID.randomUUID(); CreateVfMigrationRecordDTO createDto = new CreateVfMigrationRecordDTO(); createDto.setId(mockId); - createDto.setStatus(VfMigrationStatus.READY); + createDto.setStatus(VfMigrationStatus.READY); createDto.setUrn("URN1234567"); createDto.setExhibitReference("EX"); createDto.setDefendantName("defendant-name"); @@ -409,7 +409,7 @@ public void putMigrationRecordExhibitReferenceTooShort() throws Exception { .content(OBJECT_MAPPER.writeValueAsString(createDto)) .contentType(MediaType.APPLICATION_JSON_VALUE) .accept(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isNoContent()); + .andExpect(status().isNoContent()); } @Test @@ -418,7 +418,7 @@ public void putMigrationRecordExhibitReferenceTooLong() throws Exception { UUID mockId = UUID.randomUUID(); CreateVfMigrationRecordDTO createDto = new CreateVfMigrationRecordDTO(); createDto.setId(mockId); - createDto.setStatus(VfMigrationStatus.READY); + createDto.setStatus(VfMigrationStatus.READY); createDto.setUrn("URN1234567"); createDto.setExhibitReference("EXHIBIT12345678901234567890"); createDto.setDefendantName("defendant-name"); @@ -432,7 +432,7 @@ public void putMigrationRecordExhibitReferenceTooLong() throws Exception { .contentType(MediaType.APPLICATION_JSON_VALUE) .accept(MediaType.APPLICATION_JSON_VALUE)) .andExpect(status().isBadRequest()) - .andExpect(jsonPath("$.exhibitReference").value("length must be between 0 and 11")); + .andExpect(jsonPath("$.exhibitReference").value("length must be between 0 and 11")); } @Test diff --git a/src/test/java/uk/gov/hmcts/reform/preapi/controller/params/SearchUsersTest.java b/src/test/java/uk/gov/hmcts/reform/preapi/controller/params/SearchUsersTest.java index 6a50b17290..ec0bc2ed59 100644 --- a/src/test/java/uk/gov/hmcts/reform/preapi/controller/params/SearchUsersTest.java +++ b/src/test/java/uk/gov/hmcts/reform/preapi/controller/params/SearchUsersTest.java @@ -21,6 +21,32 @@ public void getName() { assertNull(searchUsers.getName()); } + @Test + public void getFirstName() { + var searchUsers = new SearchUsers(); + searchUsers.setFirstName("John"); + assertEquals("John", searchUsers.getFirstName()); + + searchUsers.setFirstName(""); + assertNull(searchUsers.getFirstName()); + + searchUsers.setFirstName(null); + assertNull(searchUsers.getFirstName()); + } + + @Test + public void getLastName() { + var searchUsers = new SearchUsers(); + searchUsers.setLastName("Doe"); + assertEquals("Doe", searchUsers.getLastName()); + + searchUsers.setLastName(""); + assertNull(searchUsers.getLastName()); + + searchUsers.setLastName(null); + assertNull(searchUsers.getLastName()); + } + @Test public void getEmail() { var searchUsers = new SearchUsers(); diff --git a/src/test/java/uk/gov/hmcts/reform/preapi/services/AppAccessServiceTest.java b/src/test/java/uk/gov/hmcts/reform/preapi/services/AppAccessServiceTest.java index 25507c433b..0376f6b96b 100644 --- a/src/test/java/uk/gov/hmcts/reform/preapi/services/AppAccessServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/preapi/services/AppAccessServiceTest.java @@ -2,6 +2,7 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.bean.override.mockito.MockitoBean; @@ -20,6 +21,7 @@ import java.sql.Timestamp; import java.time.Instant; +import java.util.List; import java.util.Optional; import java.util.UUID; @@ -27,13 +29,15 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @SpringBootTest(classes = AppAccessService.class) -public class AppAccessServiceTest { +class AppAccessServiceTest { @MockitoBean private AppAccessRepository appAccessRepository; @@ -47,7 +51,7 @@ public class AppAccessServiceTest { private RoleRepository roleRepository; @Autowired - private AppAccessService appAccessService; + private AppAccessService underTest; @DisplayName("Create an app access entity") @Test @@ -63,7 +67,7 @@ void createAppAccessSuccess() { when(roleRepository.findById(model.getRoleId())).thenReturn(Optional.of(new Role())); when(courtRepository.findById(model.getCourtId())).thenReturn(Optional.of(new Court())); - assertThat(appAccessService.upsert(model)).isEqualTo(UpsertResult.CREATED); + assertThat(underTest.upsert(model)).isEqualTo(UpsertResult.CREATED); verify(appAccessRepository, times(1)).findById(model.getId()); verify(userRepository, times(1)).findByIdAndDeletedAtIsNull(model.getUserId()); @@ -90,7 +94,7 @@ void updateAppAccessSuccess() { when(roleRepository.findById(model.getRoleId())).thenReturn(Optional.of(new Role())); when(courtRepository.findById(model.getCourtId())).thenReturn(Optional.of(new Court())); - assertThat(appAccessService.upsert(model)).isEqualTo(UpsertResult.UPDATED); + assertThat(underTest.upsert(model)).isEqualTo(UpsertResult.UPDATED); verify(appAccessRepository, times(1)).findById(model.getId()); verify(userRepository, times(1)).findByIdAndDeletedAtIsNull(model.getUserId()); @@ -115,7 +119,7 @@ void createAppAccessDeleted() { assertThrows( ResourceInDeletedStateException.class, - () -> appAccessService.upsert(model) + () -> underTest.upsert(model) ); verify(appAccessRepository, times(1)).findById(model.getId()); @@ -136,7 +140,7 @@ void createAppAccessUserNotFound() { var message = assertThrows( NotFoundException.class, - () -> appAccessService.upsert(model) + () -> underTest.upsert(model) ).getMessage(); assertThat(message).isEqualTo("Not found: User: " + model.getUserId()); @@ -160,7 +164,7 @@ void createAppAccessCourtNotFound() { var message = assertThrows( NotFoundException.class, - () -> appAccessService.upsert(model) + () -> underTest.upsert(model) ).getMessage(); assertThat(message).isEqualTo("Not found: Court: " + model.getCourtId()); @@ -186,7 +190,7 @@ void createAppAccessRoleNotFound() { var message = assertThrows( NotFoundException.class, - () -> appAccessService.upsert(model) + () -> underTest.upsert(model) ).getMessage(); assertThat(message).isEqualTo("Not found: Role: " + model.getRoleId()); @@ -207,7 +211,7 @@ void deleteByIdSuccess() { when(appAccessRepository.findById(id)).thenReturn(Optional.of(access)); - appAccessService.deleteById(id); + underTest.deleteById(id); assertThat(access.getDeletedAt()).isNotNull(); assertFalse(access.isActive()); @@ -234,7 +238,7 @@ void upsertSetCourtAccessType() { when(courtRepository.findById(dto.getCourtId())).thenReturn(Optional.of(new Court())); when(roleRepository.findById(dto.getRoleId())).thenReturn(Optional.of(new Role())); - assertThat(appAccessService.upsert(dto)).isEqualTo(UpsertResult.UPDATED); + assertThat(underTest.upsert(dto)).isEqualTo(UpsertResult.UPDATED); assertThat(appAccess.isDefaultCourt()).isTrue(); verify(appAccessRepository, times(1)).findById(dto.getId()); @@ -243,4 +247,95 @@ void upsertSetCourtAccessType() { verify(roleRepository, times(1)).findById(dto.getRoleId()); verify(appAccessRepository, times(1)).save(any()); } + + @Test + @DisplayName("Should delete by user ID") + void deleteByUserIdSuccess() { + UUID userId = UUID.randomUUID(); + User user = mock(User.class); + when(user.getId()).thenReturn(userId); + + AppAccess access = new AppAccess(); + access.setId(UUID.randomUUID()); + access.setActive(true); + access.setUser(user); + + when(appAccessRepository.findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userId)) + .thenReturn(List.of(access)); + + underTest.deleteByUserId(userId); + + verify(appAccessRepository, times(1)) + .findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userId); + + ArgumentCaptor captor = ArgumentCaptor.forClass(AppAccess.class); + verify(appAccessRepository, times(1)).save(captor.capture()); + AppAccess capturedAccess = captor.getValue(); + assertThat(capturedAccess.getId()).isEqualTo(access.getId()); + assertThat(capturedAccess.getUser()).isEqualTo(user); + assertThat(capturedAccess.getDeletedAt()).isNotNull(); + assertThat(capturedAccess.isActive()).isFalse(); + + verifyNoMoreInteractions(appAccessRepository); + + } + + @Test + @DisplayName("Should cope if deleting by a non-existent user") + void deleteByNonExistentUser() { + when(appAccessRepository.findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(any(UUID.class))) + .thenReturn(List.of()); + + underTest.deleteByUserId(UUID.randomUUID()); + + verify(appAccessRepository, times(1)) + .findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(any(UUID.class)); + + verifyNoMoreInteractions(appAccessRepository); + } + + @Test + @DisplayName("Should undelete by user ID") + void undeleteByUserIdSuccess() { + UUID userId = UUID.randomUUID(); + User user = mock(User.class); + when(user.getId()).thenReturn(userId); + + AppAccess access = new AppAccess(); + access.setId(UUID.randomUUID()); + access.setActive(false); + access.setDeletedAt(Timestamp.from(Instant.now())); + access.setUser(user); + + when(appAccessRepository.findAllByUser_IdAndDeletedAtIsNotNull(userId)) + .thenReturn(List.of(access)); + + underTest.undeleteByUserId(userId); + + verify(appAccessRepository, times(1)) + .findAllByUser_IdAndDeletedAtIsNotNull(userId); + + ArgumentCaptor captor = ArgumentCaptor.forClass(AppAccess.class); + verify(appAccessRepository, times(1)).save(captor.capture()); + assertThat(captor.getValue().getId()).isEqualTo(access.getId()); + assertThat(captor.getValue().getUser()).isEqualTo(user); + assertThat(captor.getValue().getDeletedAt()).isNull(); + assertThat(captor.getValue().isActive()).isTrue(); + + verifyNoMoreInteractions(appAccessRepository); + } + + @Test + @DisplayName("Should cope if undeleting a non-existent user") + void undeleteByNonExistentUser() { + when(appAccessRepository.findAllByUser_IdAndDeletedAtIsNotNull(any(UUID.class))) + .thenReturn(List.of()); + + underTest.undeleteByUserId(UUID.randomUUID()); + + verify(appAccessRepository, times(1)) + .findAllByUser_IdAndDeletedAtIsNotNull(any(UUID.class)); + + verifyNoMoreInteractions(appAccessRepository); + } } diff --git a/src/test/java/uk/gov/hmcts/reform/preapi/services/PortalAccessServiceTest.java b/src/test/java/uk/gov/hmcts/reform/preapi/services/PortalAccessServiceTest.java index d4e5726439..06b7c2f677 100644 --- a/src/test/java/uk/gov/hmcts/reform/preapi/services/PortalAccessServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/preapi/services/PortalAccessServiceTest.java @@ -2,11 +2,13 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.bean.override.mockito.MockitoBean; import uk.gov.hmcts.reform.preapi.dto.CreatePortalAccessDTO; import uk.gov.hmcts.reform.preapi.entities.PortalAccess; +import uk.gov.hmcts.reform.preapi.entities.User; import uk.gov.hmcts.reform.preapi.enums.AccessStatus; import uk.gov.hmcts.reform.preapi.enums.UpsertResult; import uk.gov.hmcts.reform.preapi.exception.NotFoundException; @@ -14,28 +16,31 @@ import java.sql.Timestamp; import java.time.Instant; +import java.util.List; import java.util.Optional; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @SpringBootTest(classes = PortalAccessService.class) -public class PortalAccessServiceTest { +class PortalAccessServiceTest { @MockitoBean private PortalAccessRepository portalAccessRepository; @Autowired - private PortalAccessService portalAccessService; + private PortalAccessService underTest; @DisplayName("Update a portal access entity") @Test - public void updateSuccess() { + void updateSuccess() { var model = new CreatePortalAccessDTO(); model.setId(UUID.randomUUID()); model.setStatus(AccessStatus.ACTIVE); @@ -48,7 +53,7 @@ public void updateSuccess() { when(portalAccessRepository.findByIdAndDeletedAtIsNull(model.getId())) .thenReturn(Optional.of(entity)); - assertThat(portalAccessService.update(model)).isEqualTo(UpsertResult.UPDATED); + assertThat(underTest.update(model)).isEqualTo(UpsertResult.UPDATED); verify(portalAccessRepository, times(1)).findByIdAndDeletedAtIsNull(model.getId()); verify(portalAccessRepository, times(1)).save(any()); @@ -56,7 +61,7 @@ public void updateSuccess() { @DisplayName("Update a portal access entity when portal access does not exist") @Test - public void updateNotFound() { + void updateNotFound() { var model = new CreatePortalAccessDTO(); model.setId(UUID.randomUUID()); model.setStatus(AccessStatus.ACTIVE); @@ -68,7 +73,7 @@ public void updateNotFound() { var message = assertThrows( NotFoundException.class, - () -> portalAccessService.update(model) + () -> underTest.update(model) ).getMessage(); assertThat(message).isEqualTo("Not found: PortalAccess: " + model.getId()); @@ -94,7 +99,7 @@ void updateFromInactiveToActiveWhenRegisteredAtIsNull() { when(portalAccessRepository.findByIdAndDeletedAtIsNull(model.getId())) .thenReturn(Optional.of(entity)); - assertThat(portalAccessService.update(model)).isEqualTo(UpsertResult.UPDATED); + assertThat(underTest.update(model)).isEqualTo(UpsertResult.UPDATED); verify(portalAccessRepository, times(1)).findByIdAndDeletedAtIsNull(model.getId()); verify(portalAccessRepository, times(1)).save(any()); @@ -122,7 +127,7 @@ void updateFromInactiveToActiveWhenRegisteredAtIsNotNull() { when(portalAccessRepository.findByIdAndDeletedAtIsNull(model.getId())) .thenReturn(Optional.of(entity)); - assertThat(portalAccessService.update(model)).isEqualTo(UpsertResult.UPDATED); + assertThat(underTest.update(model)).isEqualTo(UpsertResult.UPDATED); verify(portalAccessRepository, times(1)).findByIdAndDeletedAtIsNull(model.getId()); verify(portalAccessRepository, times(1)).save(any()); @@ -148,7 +153,7 @@ void updateWhenNewStatusIsInactive() { when(portalAccessRepository.findByIdAndDeletedAtIsNull(model.getId())) .thenReturn(Optional.of(entity)); - assertThat(portalAccessService.update(model)).isEqualTo(UpsertResult.UPDATED); + assertThat(underTest.update(model)).isEqualTo(UpsertResult.UPDATED); verify(portalAccessRepository, times(1)).findByIdAndDeletedAtIsNull(model.getId()); verify(portalAccessRepository, times(1)).save(any()); @@ -166,7 +171,7 @@ void deleteByIdSuccess() { access.setStatus(AccessStatus.ACTIVE); when(portalAccessRepository.findById(id)).thenReturn(Optional.of(access)); - portalAccessService.deleteById(id); + underTest.deleteById(id); assertThat(access.getDeletedAt()).isNotNull(); assertThat(access.getStatus()).isEqualTo(AccessStatus.INACTIVE); @@ -175,4 +180,91 @@ void deleteByIdSuccess() { verify(portalAccessRepository, times(1)).save(any()); } + @Test + @DisplayName("Should delete by user ID") + void deleteByUserIdSuccess() { + UUID userId = UUID.randomUUID(); + User user = mock(User.class); + when(user.getId()).thenReturn(userId); + + PortalAccess access = new PortalAccess(); + access.setId(UUID.randomUUID()); + access.setStatus(AccessStatus.ACTIVE); + access.setUser(user); + + when(portalAccessRepository.findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userId)) + .thenReturn(Optional.of(access)); + + underTest.deleteByUserId(userId); + + verify(portalAccessRepository, times(1)) + .findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userId); + + ArgumentCaptor captor = ArgumentCaptor.forClass(PortalAccess.class); + verify(portalAccessRepository, times(1)).save(captor.capture()); + assertThat(captor.getValue().getId()).isEqualTo(access.getId()); + assertThat(captor.getValue().getUser()).isEqualTo(user); + assertThat(captor.getValue().getDeletedAt()).isNotNull(); + assertThat(captor.getValue().getStatus()).isEqualTo(AccessStatus.INACTIVE); + } + + @Test + @DisplayName("Should cope if deleting by a non-existent user") + void deleteByNonExistentUser() { + when(portalAccessRepository.findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(any(UUID.class))) + .thenReturn(Optional.empty()); + + underTest.deleteByUserId(UUID.randomUUID()); + + verify(portalAccessRepository, times(1)) + .findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(any(UUID.class)); + + verifyNoMoreInteractions(portalAccessRepository); + } + + @Test + @DisplayName("Should undelete by user ID") + void undeleteByUserIdSuccess() { + UUID userId = UUID.randomUUID(); + User user = mock(User.class); + when(user.getId()).thenReturn(userId); + + PortalAccess access = new PortalAccess(); + access.setId(UUID.randomUUID()); + access.setStatus(AccessStatus.INACTIVE); + access.setDeletedAt(Timestamp.from(Instant.now())); + access.setUser(user); + + when(portalAccessRepository.findAllByUser_IdAndDeletedAtIsNotNull(userId)) + .thenReturn(List.of(access)); + + underTest.undeleteByUserId(userId); + + verify(portalAccessRepository, times(1)) + .findAllByUser_IdAndDeletedAtIsNotNull(userId); + + ArgumentCaptor captor = ArgumentCaptor.forClass(PortalAccess.class); + verify(portalAccessRepository, times(1)).save(captor.capture()); + assertThat(captor.getValue().getId()).isEqualTo(access.getId()); + assertThat(captor.getValue().getUser()).isEqualTo(user); + assertThat(captor.getValue().getDeletedAt()).isNull(); + + // Not sure what the status should be after undeleting. This is here for documentation of current behaviour. + assertThat(captor.getValue().getStatus()).isEqualTo(AccessStatus.INACTIVE); + } + + @Test + @DisplayName("Should cope if undeleting a non-existent user") + void undeleteByNonExistentUser() { + when(portalAccessRepository.findAllByUser_IdAndDeletedAtIsNotNull(any(UUID.class))) + .thenReturn(List.of()); + + underTest.undeleteByUserId(UUID.randomUUID()); + + verify(portalAccessRepository, times(1)) + .findAllByUser_IdAndDeletedAtIsNotNull(any(UUID.class)); + + verifyNoMoreInteractions(portalAccessRepository); + } + } diff --git a/src/test/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsServiceTest.java b/src/test/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsServiceTest.java index 1372ea3399..1cb89be08f 100644 --- a/src/test/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/preapi/services/TermsAndConditionsServiceTest.java @@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.bean.override.mockito.MockitoBean; +import uk.gov.hmcts.reform.preapi.entities.TermsAndConditions; import uk.gov.hmcts.reform.preapi.enums.TermsAndConditionsType; import uk.gov.hmcts.reform.preapi.exception.NotFoundException; import uk.gov.hmcts.reform.preapi.repositories.TermsAndConditionsRepository; @@ -13,31 +14,34 @@ import java.sql.Timestamp; import java.time.Instant; import java.util.Optional; +import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @SpringBootTest(classes = TermsAndConditionsService.class) -public class TermsAndConditionsServiceTest { +class TermsAndConditionsServiceTest { @MockitoBean private TermsAndConditionsRepository termsAndConditionsRepository; @Autowired - private TermsAndConditionsService termsAndConditionsService; + private TermsAndConditionsService underTest; @Test @DisplayName("Should get the latest app terms and conditions and return model") - public void getLatestAppTermsAndConditionsSuccess() { + void getLatestAppTermsAndConditionsSuccess() { var termsAndConditions = HelperFactory.createTermsAndConditions(TermsAndConditionsType.APP, "some content"); termsAndConditions.setCreatedAt(Timestamp.from(Instant.now())); when(termsAndConditionsRepository.findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.APP)) .thenReturn(Optional.of(termsAndConditions)); - var model = termsAndConditionsService.getLatestTermsAndConditions(TermsAndConditionsType.APP); + var model = underTest.getLatestTermsAndConditionsByType(TermsAndConditionsType.APP); assertThat(model.getId()).isEqualTo(termsAndConditions.getId()); assertThat(model.getType()).isEqualTo(termsAndConditions.getType()); @@ -49,14 +53,14 @@ public void getLatestAppTermsAndConditionsSuccess() { @Test @DisplayName("Should get the latest portal terms and conditions and return model") - public void getLatestPortalTermsAndConditionsSuccess() { + void getLatestPortalTermsAndConditionsSuccess() { var termsAndConditions = HelperFactory.createTermsAndConditions(TermsAndConditionsType.PORTAL, "some content"); termsAndConditions.setCreatedAt(Timestamp.from(Instant.now())); when(termsAndConditionsRepository.findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.PORTAL)) .thenReturn(Optional.of(termsAndConditions)); - var model = termsAndConditionsService.getLatestTermsAndConditions(TermsAndConditionsType.PORTAL); + var model = underTest.getLatestTermsAndConditionsByType(TermsAndConditionsType.PORTAL); assertThat(model.getId()).isEqualTo(termsAndConditions.getId()); assertThat(model.getType()).isEqualTo(termsAndConditions.getType()); @@ -69,17 +73,56 @@ public void getLatestPortalTermsAndConditionsSuccess() { @Test @DisplayName("Should throw exception when there are no terms matching the specified type") - public void getLatestTermsAndConditionsNotFound() { + void getLatestTermsAndConditionsByTypeNotFound() { when(termsAndConditionsRepository.findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.APP)) .thenReturn(Optional.empty()); var message = assertThrows( NotFoundException.class, - () -> termsAndConditionsService.getLatestTermsAndConditions(TermsAndConditionsType.APP) + () -> underTest.getLatestTermsAndConditionsByType(TermsAndConditionsType.APP) ).getMessage(); assertThat(message).isEqualTo("Not found: Terms and conditions of type: APP"); verify(termsAndConditionsRepository, times(1)).findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.APP); } + + @Test + @DisplayName("Should get the latest terms and conditions") + void getLatestTermsAndConditionsSuccess() { + TermsAndConditions termsAndConditionsPortal = mock(TermsAndConditions.class); + TermsAndConditions termsAndConditionsApp = mock(TermsAndConditions.class); + + when(termsAndConditionsRepository.findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.PORTAL)) + .thenReturn(Optional.of(termsAndConditionsPortal)); + when(termsAndConditionsRepository.findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.APP)) + .thenReturn(Optional.of(termsAndConditionsApp)); + + Set allLatestTermsAndConditions = underTest.getAllLatestTermsAndConditions(); + assertThat(allLatestTermsAndConditions.size()).isEqualTo(2); + assertThat(allLatestTermsAndConditions) + .containsExactlyInAnyOrder(termsAndConditionsPortal, termsAndConditionsApp); + verify(termsAndConditionsRepository, times(1)) + .findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.APP); + verify(termsAndConditionsRepository, times(1)) + .findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.PORTAL); + verifyNoMoreInteractions(termsAndConditionsRepository); + } + + @Test + @DisplayName("Should cope if there are no latest terms and conditions") + void handleGracefullyIfNothingReturnedFromDB() { + when(termsAndConditionsRepository.findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.PORTAL)) + .thenReturn(Optional.empty()); + when(termsAndConditionsRepository.findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.APP)) + .thenReturn(Optional.empty()); + + Set allLatestTermsAndConditions = underTest.getAllLatestTermsAndConditions(); + assertThat(allLatestTermsAndConditions.isEmpty()); + verify(termsAndConditionsRepository, times(1)) + .findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.APP); + verify(termsAndConditionsRepository, times(1)) + .findFirstByTypeOrderByCreatedAtDesc(TermsAndConditionsType.PORTAL); + verifyNoMoreInteractions(termsAndConditionsRepository); + } } diff --git a/src/test/java/uk/gov/hmcts/reform/preapi/services/UserServiceTest.java b/src/test/java/uk/gov/hmcts/reform/preapi/services/UserServiceTest.java index ef46b0c47f..a02de6d77f 100644 --- a/src/test/java/uk/gov/hmcts/reform/preapi/services/UserServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/preapi/services/UserServiceTest.java @@ -1,9 +1,10 @@ package uk.gov.hmcts.reform.preapi.services; -import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Page; @@ -11,6 +12,7 @@ import org.springframework.data.domain.Pageable; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.test.context.bean.override.mockito.MockitoBean; +import uk.gov.hmcts.reform.preapi.controllers.params.SearchUsers; import uk.gov.hmcts.reform.preapi.dto.CreateAppAccessDTO; import uk.gov.hmcts.reform.preapi.dto.CreateInviteDTO; import uk.gov.hmcts.reform.preapi.dto.CreatePortalAccessDTO; @@ -21,21 +23,19 @@ import uk.gov.hmcts.reform.preapi.entities.PortalAccess; import uk.gov.hmcts.reform.preapi.entities.Role; import uk.gov.hmcts.reform.preapi.entities.User; +import uk.gov.hmcts.reform.preapi.enums.AccessStatus; import uk.gov.hmcts.reform.preapi.enums.UpsertResult; import uk.gov.hmcts.reform.preapi.exception.ConflictException; import uk.gov.hmcts.reform.preapi.exception.NotFoundException; import uk.gov.hmcts.reform.preapi.exception.ResourceInDeletedStateException; -import uk.gov.hmcts.reform.preapi.repositories.AppAccessRepository; import uk.gov.hmcts.reform.preapi.repositories.CourtRepository; -import uk.gov.hmcts.reform.preapi.repositories.PortalAccessRepository; import uk.gov.hmcts.reform.preapi.repositories.RoleRepository; -import uk.gov.hmcts.reform.preapi.repositories.TermsAndConditionsRepository; import uk.gov.hmcts.reform.preapi.repositories.UserRepository; import uk.gov.hmcts.reform.preapi.security.authentication.UserAuthentication; +import uk.gov.hmcts.reform.preapi.util.HelperFactory; import java.sql.Timestamp; import java.time.Instant; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Optional; @@ -51,6 +51,8 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @SpringBootTest(classes = UserService.class) @@ -63,9 +65,6 @@ public class UserServiceTest { private static PortalAccess portalAccessEntity; private static PortalAccess portalAccessEntity2; - @MockitoBean - private AppAccessRepository appAccessRepository; - @MockitoBean private RoleRepository roleRepository; @@ -75,9 +74,6 @@ public class UserServiceTest { @MockitoBean private UserRepository userRepository; - @MockitoBean - private PortalAccessRepository portalAccessRepository; - @MockitoBean private AppAccessService appAccessService; @@ -85,33 +81,23 @@ public class UserServiceTest { private PortalAccessService portalAccessService; @MockitoBean - private TermsAndConditionsRepository termsAndConditionsRepository; + private TermsAndConditionsService termsAndConditionsService; + + private static SearchUsers searchUsers; @Autowired private UserService userService; - @BeforeAll - static void setUp() { - userEntity = new User(); - userEntity.setId(UUID.randomUUID()); - userEntity.setFirstName("Example"); - userEntity.setLastName("Person"); - userEntity.setEmail("example@example.com"); - userEntity.setOrganisation("Example Org"); - - portalUserEntity = new User(); - portalUserEntity.setId(UUID.randomUUID()); - portalUserEntity.setFirstName("Portal"); - portalUserEntity.setLastName("Person"); - portalUserEntity.setEmail("portal@example.com"); - portalUserEntity.setOrganisation("Portal Org"); - - appUserEntity = new User(); - appUserEntity.setId(UUID.randomUUID()); - appUserEntity.setFirstName("App"); - appUserEntity.setLastName("Person"); - appUserEntity.setEmail("app@example.com"); - appUserEntity.setOrganisation("App Org"); + @BeforeEach + void setUp() { + userEntity = HelperFactory.createUser("Example", "Person", "example@example.com", + null, null, "Example Org"); + + portalUserEntity = HelperFactory.createUser("Portal", "Person", "portal@example.com", + null, null, "Portal Org"); + + appUserEntity = HelperFactory.createUser("App", "Person", "app@example.com", + null, null, "App Org"); var court = new Court(); court.setId(UUID.randomUUID()); @@ -126,6 +112,9 @@ static void setUp() { appAccessEntity.setActive(true); userEntity.setAppAccess(Set.of(appAccessEntity)); + searchUsers = mock(SearchUsers.class); + when(searchUsers.getRoleId()).thenReturn(appAccessEntity.getRole().getId()); + appAccessEntity2 = new AppAccess(); appAccessEntity2.setId(UUID.randomUUID()); appAccessEntity2.setUser(appUserEntity); @@ -143,9 +132,45 @@ static void setUp() { portalAccessEntity2.setId(UUID.randomUUID()); portalAccessEntity2.setUser(portalUserEntity); portalUserEntity.setPortalAccess(Set.of(portalAccessEntity2)); + + searchUsers = mock(SearchUsers.class); + when(searchUsers.getName()).thenReturn(null); + when(searchUsers.getFirstName()).thenReturn(null); + when(searchUsers.getLastName()).thenReturn(null); + when(searchUsers.getEmail()).thenReturn(null); + when(searchUsers.getOrganisation()).thenReturn(null); + when(searchUsers.getCourtId()).thenReturn(null); + when(searchUsers.getRoleId()).thenReturn(null); + when(searchUsers.getAccessType()).thenReturn(null); + when(searchUsers.getAppActive()).thenReturn(null); + + // Defaults for happy path + when(courtRepository.existsById(appAccessEntity.getCourt().getId())).thenReturn(true); + + when(roleRepository.existsById(appAccessEntity.getRole().getId())).thenReturn(true); + when(roleRepository.findById(appAccessEntity.getRole().getId())).thenReturn(Optional.of(role)); + + when(userRepository.findByIdAndDeletedAtIsNull(userEntity.getId())).thenReturn(Optional.of(userEntity)); + when(userRepository.existsByIdAndDeletedAtIsNull(userEntity.getId())).thenReturn(true); + when(userRepository.findById(userEntity.getId())).thenReturn(Optional.ofNullable(userEntity)); + + when(userRepository.searchAllBy( + null, + null, + null, + null, + null, + null, + null, + false, + false, + false, + null, + null + )).thenReturn(new PageImpl<>(List.of(userEntity, portalUserEntity, appUserEntity))); } - @BeforeEach + @AfterEach void reset() { userEntity.setDeletedAt(null); appAccessEntity.setDeletedAt(null); @@ -155,10 +180,6 @@ void reset() { @DisplayName("Find a user by it's id and return a model") @Test void findUserByIdSuccess() { - when( - userRepository.findByIdAndDeletedAtIsNull(userEntity.getId()) - ).thenReturn(Optional.of(userEntity)); - var model = userService.findById(userEntity.getId()); assertThat(model.getId()).isEqualTo(userEntity.getId()); assertThat(model.getFirstName()).isEqualTo(userEntity.getFirstName()); @@ -167,24 +188,40 @@ void findUserByIdSuccess() { @DisplayName("Find a user by it's id which doesn't exist") @Test void findUserByIdNotFound() { + UUID randomUserId = UUID.randomUUID(); when( - userRepository.findByIdAndDeletedAtIsNull(UUID.randomUUID()) + userRepository.findByIdAndDeletedAtIsNull(randomUserId) ).thenReturn(Optional.empty()); assertThrows( NotFoundException.class, - () -> userService.findById(userEntity.getId()) + () -> userService.findById(randomUserId) ); verify(userRepository, times(1)) - .findByIdAndDeletedAtIsNull(userEntity.getId()); + .findByIdAndDeletedAtIsNull(randomUserId); } @DisplayName("Find all users and return a list of models") @Test void findAllUsersSuccess() { + var models = userService.findAllBy(searchUsers, null); + assertThat(models.isEmpty()).isFalse(); + assertThat(models.getTotalElements()).isEqualTo(3); + + assertAllUsers(models); + } + + @DisplayName("Find all users when filtered by first name") + @Test + void findAllUsersFirstNameFilterSuccess() { + // using name param + when(searchUsers.getName()).thenReturn(userEntity.getFirstName()); + when( userRepository.searchAllBy( + userEntity.getFirstName(), + null, null, null, null, @@ -195,22 +232,67 @@ void findAllUsersSuccess() { false, null, null - ) - ).thenReturn(new PageImpl<>(List.of(userEntity, portalUserEntity, appUserEntity))); + )).thenReturn(new PageImpl<>(List.of(userEntity))); - var models = userService.findAllBy(null, null, null, null, null, null, false, null, null); + var models = userService.findAllBy( + searchUsers, + null + ); assertThat(models.isEmpty()).isFalse(); - assertThat(models.getTotalElements()).isEqualTo(3); + assertThat(models.getTotalElements()).isEqualTo(1); - assertAllUsers(models); + var model = models.get().toList().getFirst(); + assertThat(model.getId()).isEqualTo(userEntity.getId()); + assertThat(model.getFirstName()).isEqualTo(userEntity.getFirstName()); + assertThat(model.getAppAccess().stream().toList().getFirst().getRole().getId()).isEqualTo(appAccessEntity + .getRole() + .getId()); + assertThat(model.getAppAccess().stream().toList().getFirst().getCourt().getId()).isEqualTo(appAccessEntity + .getCourt() + .getId()); + // using first name param + when(searchUsers.getName()).thenReturn(null); + when(searchUsers.getFirstName()).thenReturn(userEntity.getFirstName()); + when( + userRepository.searchAllBy( + null, + userEntity.getFirstName(), + null, + null, + null, + null, + null, + false, + false, + false, + null, + null + )).thenReturn(new PageImpl<>(List.of(userEntity))); + + var models2 = userService.findAllBy(searchUsers, null); + assertThat(models2.isEmpty()).isFalse(); + assertThat(models2.getTotalElements()).isEqualTo(1); + + var model2 = models2.get().toList().getFirst(); + assertThat(model2.getId()).isEqualTo(userEntity.getId()); + assertThat(model2.getFirstName()).isEqualTo(userEntity.getFirstName()); + assertThat(model2.getAppAccess().stream().toList().getFirst().getRole().getId()).isEqualTo(appAccessEntity + .getRole() + .getId()); + assertThat(model2.getAppAccess().stream().toList().getFirst().getCourt().getId()).isEqualTo(appAccessEntity + .getCourt() + .getId()); } - @DisplayName("Find all users when filtered by first name") @Test - void findAllUsersFirstNameFilterSuccess() { + @DisplayName("Find all users when filtered by last name") + void findAllUsersLastNameFilterSuccess() { + when(searchUsers.getLastName()).thenReturn(userEntity.getLastName()); when( userRepository.searchAllBy( - userEntity.getFirstName(), + null, + null, + userEntity.getLastName(), null, null, null, @@ -222,13 +304,14 @@ void findAllUsersFirstNameFilterSuccess() { null )).thenReturn(new PageImpl<>(List.of(userEntity))); - var models = userService.findAllBy(userEntity.getFirstName(), null, null, null, null, null, false, null, null); + var models = userService + .findAllBy(searchUsers, null); assertThat(models.isEmpty()).isFalse(); assertThat(models.getTotalElements()).isEqualTo(1); var model = models.get().toList().getFirst(); assertThat(model.getId()).isEqualTo(userEntity.getId()); - assertThat(model.getFirstName()).isEqualTo(userEntity.getFirstName()); + assertThat(model.getLastName()).isEqualTo(userEntity.getLastName()); assertThat(model.getAppAccess().stream().toList().getFirst().getRole().getId()).isEqualTo(appAccessEntity .getRole() .getId()); @@ -240,13 +323,28 @@ void findAllUsersFirstNameFilterSuccess() { @DisplayName("Find all users when filtered by email") @Test void findAllUsersEmailFilterSuccess() { - when(courtRepository.existsById(appAccessEntity.getCourt().getId())).thenReturn(true); - when(roleRepository.existsById(appAccessEntity.getRole().getId())).thenReturn(true); + when(searchUsers.getEmail()).thenReturn(userEntity.getEmail()); when( - userRepository.searchAllBy(null, userEntity.getEmail(), null, null, null, false, false, false, null,null) + userRepository.searchAllBy( + null, + null, + null, + userEntity.getEmail(), + null, + null, + null, + false, + false, + false, + null, + null + ) ).thenReturn(new PageImpl<>(List.of(userEntity))); - var models = userService.findAllBy(null, userEntity.getEmail(), null, null, null, null, false, null, null); + var models = userService.findAllBy( + searchUsers, + null + ); assertThat(models.isEmpty()).isFalse(); assertThat(models.getTotalElements()).isEqualTo(1); @@ -264,10 +362,11 @@ void findAllUsersEmailFilterSuccess() { @DisplayName("Find all users when filtered by organisation") @Test void findAllUsersOrganisationFilterSuccess() { - when(courtRepository.existsById(appAccessEntity.getCourt().getId())).thenReturn(true); - when(roleRepository.existsById(appAccessEntity.getRole().getId())).thenReturn(true); + when(searchUsers.getOrganisation()).thenReturn(userEntity.getOrganisation()); when( userRepository.searchAllBy( + null, + null, null, null, userEntity.getOrganisation(), @@ -282,14 +381,7 @@ void findAllUsersOrganisationFilterSuccess() { ).thenReturn(new PageImpl<>(List.of(userEntity))); var models = userService.findAllBy( - null, - null, - userEntity.getOrganisation(), - null, - null, - null, - false, - null, + searchUsers, null ); assertThat(models.isEmpty()).isFalse(); @@ -309,10 +401,11 @@ void findAllUsersOrganisationFilterSuccess() { @DisplayName("Find all users when filtered by court") @Test void findAllUsersCourtFilterSuccess() { - when(courtRepository.existsById(appAccessEntity.getCourt().getId())).thenReturn(true); - when(roleRepository.existsById(appAccessEntity.getRole().getId())).thenReturn(true); + when(searchUsers.getCourtId()).thenReturn(appAccessEntity.getCourt().getId()); when( userRepository.searchAllBy( + null, + null, null, null, null, @@ -327,14 +420,7 @@ void findAllUsersCourtFilterSuccess() { ).thenReturn(new PageImpl<>(List.of(userEntity, appUserEntity))); var models = userService.findAllBy( - null, - null, - null, - appAccessEntity.getCourt().getId(), - null, - null, - false, - null, + searchUsers, null ); assertThat(models.isEmpty()).isFalse(); @@ -367,15 +453,19 @@ void findAllUsersCourtFilterSuccess() { @DisplayName("Find all users when filtered by role") @Test void findAllUsersRoleFilterSuccess() { - when(courtRepository.existsById(appAccessEntity.getCourt().getId())).thenReturn(true); - when(roleRepository.existsById(appAccessEntity.getRole().getId())).thenReturn(true); + var role = new Role(); + role.setName("Some Role"); + when(searchUsers.getRoleId()).thenReturn(role.getId()); + when(roleRepository.findById(role.getId())).thenReturn(Optional.of(role)); when( userRepository.searchAllBy( null, null, null, null, - appAccessEntity.getRole().getId(), + null, + null, + role.getId(), false, false, false, @@ -384,17 +474,7 @@ void findAllUsersRoleFilterSuccess() { ) ).thenReturn(new PageImpl<>(List.of(userEntity, appUserEntity))); - var models = userService.findAllBy( - null, - null, - null, - null, - appAccessEntity.getRole().getId(), - null, - false, - null, - null - ); + var models = userService.findAllBy(searchUsers, null); assertThat(models.isEmpty()).isFalse(); assertThat(models.getTotalElements()).isEqualTo(2); @@ -425,15 +505,16 @@ void findAllUsersRoleFilterSuccess() { @DisplayName("Find all users when filtered by court that doesn't exist") @Test void findAllUsersCourtFilterNotFound() { - UUID courtId = UUID.randomUUID(); - when(courtRepository.existsById(courtId)).thenReturn(false); + UUID randomCourtId = UUID.randomUUID(); + when(searchUsers.getCourtId()).thenReturn(randomCourtId); + when(courtRepository.existsById(randomCourtId)).thenReturn(false); assertThrows( NotFoundException.class, - () -> userService.findAllBy(null, null, null, courtId, null, null, false, null, null) + () -> userService.findAllBy(searchUsers, null) ); - verify(courtRepository, times(1)).existsById(courtId); + verify(courtRepository, times(1)).existsById(randomCourtId); verify(roleRepository, never()).existsById(any()); verify(userRepository, never()).searchAllBy( any(), @@ -443,6 +524,8 @@ void findAllUsersCourtFilterNotFound() { any(), any(), any(), + any(), + any(), eq(false), any(), any() @@ -452,21 +535,22 @@ void findAllUsersCourtFilterNotFound() { @DisplayName("Find all users when filtered by role that doesn't exist") @Test void findAllUsersRoleFilterNotFound() { + UUID roleId = UUID.randomUUID(); + when(searchUsers.getRoleId()).thenReturn(roleId); + when(roleRepository.existsById(roleId)).thenReturn(false); + var mockAuth = mock(UserAuthentication.class); when(mockAuth.isAdmin()).thenReturn(true); when(mockAuth.isAppUser()).thenReturn(true); SecurityContextHolder.getContext().setAuthentication(mockAuth); - UUID roleId = UUID.randomUUID(); - when(roleRepository.existsById(roleId)).thenReturn(false); - assertThrows( NotFoundException.class, - () -> userService.findAllBy(null, null, null, null, roleId, null, false, null, null) + () -> userService.findAllBy(searchUsers, null) ); verify(courtRepository, never()).existsById(any()); - verify(roleRepository, times(1)).existsById(roleId); + verify(roleRepository, times(1)).findById(roleId); verify(userRepository, never()).searchAllBy( any(), any(), @@ -475,52 +559,22 @@ void findAllUsersRoleFilterNotFound() { any(), any(), any(), + any(), + any(), eq(false), any(), any() ); } - @DisplayName("Delete a user by it's id") + @DisplayName("Delete a user by its id") @Test void deleteUserByIdSuccess() { - when(userRepository.existsByIdAndDeletedAtIsNull(userEntity.getId())).thenReturn(true); - when(portalAccessRepository.findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId())) - .thenReturn(Optional.of(portalAccessEntity)); - ArrayList appAccessEntities = new ArrayList<>(); - appAccessEntities.add(appAccessEntity); - when(appAccessRepository.findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId())) - .thenReturn(appAccessEntities); - when(userRepository.findById(userEntity.getId())).thenReturn(Optional.ofNullable(userEntity)); - userService.deleteById(userEntity.getId()); verify(userRepository, times(1)).existsByIdAndDeletedAtIsNull(userEntity.getId()); - verify(portalAccessRepository, times(1)).findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId()); - verify(portalAccessService, times(1)).deleteById(portalAccessEntity.getId()); - verify(appAccessRepository, times(1)).findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId()); - verify(appAccessService, times(1)).deleteById(appAccessEntity.getId()); - verify(userRepository, times(1)).saveAndFlush(userEntity); - } - - @DisplayName("Delete a user by it's id when user is not attached to portal access or app access") - @Test - void deleteUserByIdNoAccessSuccess() { - ArrayList emptySet = new ArrayList<>(){}; - when(userRepository.existsByIdAndDeletedAtIsNull(userEntity.getId())).thenReturn(true); - when(portalAccessRepository.findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId())) - .thenReturn(Optional.empty()); - when(appAccessRepository.findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId())) - .thenReturn(emptySet); - when(userRepository.findById(userEntity.getId())).thenReturn(Optional.ofNullable(userEntity)); - - userService.deleteById(userEntity.getId()); - - verify(userRepository, times(1)).existsByIdAndDeletedAtIsNull(userEntity.getId()); - verify(portalAccessRepository, times(1)).findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId()); - verify(portalAccessRepository, never()).save(any()); - verify(appAccessRepository, times(1)).findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId()); - verify(appAccessRepository, never()).save(any()); + verify(portalAccessService, times(1)).deleteByUserId(userEntity.getId()); + verify(appAccessService, times(1)).deleteByUserId(userEntity.getId()); verify(userRepository, times(1)).saveAndFlush(userEntity); } @@ -536,36 +590,11 @@ void deleteUserByIdNotFound() { ); verify(userRepository, times(1)).existsByIdAndDeletedAtIsNull(userId); - verify(portalAccessRepository, never()).findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId()); - verify(portalAccessRepository, never()).save(any()); - verify(appAccessRepository, never()).findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId()); - verify(appAccessRepository, never()).save(any()); + verifyNoInteractions(portalAccessService); + verifyNoInteractions(appAccessService); verify(userRepository, never()).deleteById(userEntity.getId()); } - @DisplayName("Delete a user when App Access entry doesn't exist") - @Test - void deleteUserWithEmptyAppAccess() { - when(userRepository.existsByIdAndDeletedAtIsNull(userEntity.getId())).thenReturn(true); - when(portalAccessRepository.findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId())) - .thenReturn(Optional.of(portalAccessEntity)); - ArrayList emptyAppAccessEntities = new ArrayList<>(){}; - when(appAccessRepository.findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId())) - .thenReturn(emptyAppAccessEntities); - when(userRepository.findById(userEntity.getId())).thenReturn(Optional.ofNullable(userEntity)); - - userService.deleteById(userEntity.getId()); - - verify(userRepository, times(1)).existsByIdAndDeletedAtIsNull(userEntity.getId()); - verify(portalAccessRepository, times(1)) - .findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId()); - verify(portalAccessService, times(1)).deleteById(portalAccessEntity.getId()); - verify(appAccessRepository, times(1)) - .findAllByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(userEntity.getId()); - verify(appAccessService, never()).deleteById(any()); - verify(userRepository, times(1)).saveAndFlush(userEntity); - } - @DisplayName("Create a user") @Test void createUserSuccess() { @@ -584,10 +613,8 @@ void createUserSuccess() { verify(userRepository, times(1)).findById(model.getId()); verify(userRepository, times(1)).saveAndFlush(any()); - verify(appAccessRepository, never()).deleteById(any()); - verify(appAccessService, never()).upsert(any()); - verify(portalAccessRepository, never()).existsById(any()); - verify(portalAccessService, never()).update(any()); + verifyNoInteractions(appAccessService); + verifyNoInteractions(portalAccessService); } @DisplayName("Update a user") @@ -628,7 +655,7 @@ void updateUserSuccess() { when(userRepository.findById(model.getId())).thenReturn(Optional.of(entity)); when(appAccessService.upsert(accessModel)).thenReturn(UpsertResult.CREATED); - when(portalAccessRepository.existsById(portalModel.getId())).thenReturn(true); + when(portalAccessService.exists(portalModel.getId())).thenReturn(true); when(portalAccessService.update(portalModel)).thenReturn(UpsertResult.UPDATED); assertThat(userService.upsert(model)).isEqualTo(UpsertResult.UPDATED); @@ -637,7 +664,7 @@ void updateUserSuccess() { verify(userRepository, times(1)).saveAndFlush(any()); verify(appAccessService, times(1)).deleteById(accessEntity.getId()); verify(appAccessService, times(1)).upsert(accessModel); - verify(portalAccessRepository, times(1)).existsById(portalModel.getId()); + verify(portalAccessService, times(1)).exists(portalModel.getId()); verify(portalAccessService, times(1)).update(portalModel); } @@ -679,7 +706,7 @@ void updateUserPortalAccessNotFound() { when(userRepository.findById(model.getId())).thenReturn(Optional.of(entity)); when(appAccessService.upsert(accessModel)).thenReturn(UpsertResult.CREATED); - when(portalAccessRepository.existsById(portalModel.getId())).thenReturn(false); + when(portalAccessService.exists(portalModel.getId())).thenReturn(false); when(portalAccessService.update(portalModel)).thenReturn(UpsertResult.UPDATED); var message = assertThrows( @@ -690,10 +717,9 @@ void updateUserPortalAccessNotFound() { verify(userRepository, times(1)).findById(model.getId()); verify(userRepository, never()).saveAndFlush(any()); - verify(appAccessRepository, never()).deleteById(accessEntity.getId()); - verify(appAccessService, never()).upsert(accessModel); - verify(portalAccessRepository, times(1)).existsById(portalModel.getId()); - verify(portalAccessService, never()).update(portalModel); + verifyNoInteractions(appAccessService); + verify(portalAccessService, times(1)).exists(portalModel.getId()); + verifyNoMoreInteractions(portalAccessService); } @DisplayName("Should throw resource deleted error when updating a user that has been deleted") @@ -827,30 +853,14 @@ void undeleteSuccess() { user.setId(UUID.randomUUID()); user.setDeletedAt(Timestamp.from(Instant.now())); - var appAccess = new AppAccess(); - appAccess.setId(UUID.randomUUID()); - appAccess.setUser(user); - appAccess.setDeletedAt(Timestamp.from(Instant.now())); - appAccess.setActive(false); - - var portalAccess = new PortalAccess(); - portalAccess.setId(UUID.randomUUID()); - portalAccess.setUser(user); - portalAccess.setDeletedAt(Timestamp.from(Instant.now())); - when(userRepository.findById(user.getId())).thenReturn(Optional.of(user)); - when(appAccessRepository.findAllByUser_IdAndDeletedAtIsNotNull(user.getId())).thenReturn(List.of(appAccess)); - when(portalAccessRepository.findAllByUser_IdAndDeletedAtIsNotNull(user.getId())) - .thenReturn(List.of(portalAccess)); userService.undelete(user.getId()); verify(userRepository, times(1)).findById(user.getId()); verify(userRepository, times(1)).save(user); - verify(appAccessRepository, times(1)).findAllByUser_IdAndDeletedAtIsNotNull(user.getId()); - verify(appAccessRepository, times(1)).save(appAccess); - verify(portalAccessRepository, times(1)).findAllByUser_IdAndDeletedAtIsNotNull(user.getId()); - verify(portalAccessRepository, times(1)).save(portalAccess); + verify(appAccessService, times(1)).undeleteByUserId(user.getId()); + verify(portalAccessService, times(1)).undeleteByUserId(user.getId()); } @DisplayName("Should do nothing when user is not deleted") @@ -865,8 +875,7 @@ void undeleteNotDeletedSuccess() { verify(userRepository, times(1)).findById(user.getId()); verify(userRepository, never()).save(user); - verify(appAccessRepository, never()).save(any()); - verify(portalAccessRepository, never()).save(any()); + verifyNoInteractions(appAccessService, portalAccessService); } @DisplayName("Should throw not found exception when user cannot be found") @@ -885,28 +894,38 @@ void undeleteNotFound() { verify(userRepository, times(1)).findById(userId); verify(userRepository, never()).save(any()); - verify(appAccessRepository, never()).save(any()); - verify(portalAccessRepository, never()).save(any()); + verifyNoInteractions(appAccessService, portalAccessService); } @DisplayName("Should create a new user and portal access entity on create invite") @Test void createNewUserFromInvite() { - var dto = new CreateInviteDTO(); - dto.setUserId(UUID.randomUUID()); - dto.setFirstName("Example"); - dto.setLastName("Example"); - dto.setEmail("example@example.com"); + var invitedUser = new CreateInviteDTO(); + invitedUser.setUserId(UUID.randomUUID()); + invitedUser.setFirstName("Example"); + invitedUser.setLastName("Example"); + invitedUser.setEmail("example@example.com"); - when(userRepository.findById(dto.getUserId())).thenReturn(Optional.empty()); - when(portalAccessRepository.findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(dto.getUserId())) - .thenReturn(Optional.empty()); + when(userRepository.findById(invitedUser.getUserId())).thenReturn(Optional.empty()); - assertThat(userService.upsert(dto)).isEqualTo(UpsertResult.CREATED); + assertThat(userService.upsert(invitedUser)).isEqualTo(UpsertResult.CREATED); - verify(userRepository, times(1)).findById(dto.getUserId()); - verify(portalAccessRepository, times(1)).findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(dto.getUserId()); - verify(portalAccessRepository, times(1)).save(any()); + verify(userRepository, times(1)).findById(invitedUser.getUserId()); + + ArgumentCaptor uuidArgumentCaptor = ArgumentCaptor.forClass(UUID.class); + ArgumentCaptor userArgumentCaptor = ArgumentCaptor.forClass(User.class); + ArgumentCaptor accessStatusArgumentCaptor = ArgumentCaptor.forClass(AccessStatus.class); + + verify(portalAccessService, times(1)) + .upsertPortalAccessEntity(uuidArgumentCaptor.capture(), + userArgumentCaptor.capture(), + accessStatusArgumentCaptor.capture(), + any()); + assertThat(uuidArgumentCaptor.getValue()).isEqualTo(invitedUser.getUserId()); + assertThat(userArgumentCaptor.getValue().getId()).isEqualTo(invitedUser.getUserId()); + assertThat(accessStatusArgumentCaptor.getValue()).isEqualTo(AccessStatus.INVITATION_SENT); + + verifyNoMoreInteractions(portalAccessService); } @DisplayName("Should fail create a new user and portal access entity on create invite when user has been deleted") @@ -922,8 +941,6 @@ void createNewUserFromInviteUserResourceDeleted() { user.setDeletedAt(Timestamp.from(Instant.now())); when(userRepository.findById(dto.getUserId())).thenReturn(Optional.of(user)); - when(portalAccessRepository.findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(dto.getUserId())) - .thenReturn(Optional.empty()); assertThrows( ResourceInDeletedStateException.class, @@ -931,8 +948,7 @@ void createNewUserFromInviteUserResourceDeleted() { ); verify(userRepository, times(1)).findById(dto.getUserId()); - verify(portalAccessRepository, never()).findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(dto.getUserId()); - verify(portalAccessRepository, never()).save(any()); + verifyNoInteractions(portalAccessService); } @DisplayName("Should return updated when invitation has already been sent") @@ -945,17 +961,15 @@ void createNewUserFromInviteUpdated() { dto.setEmail("example@example.com"); var user = new User(); - var portalAccess = new PortalAccess(); when(userRepository.findById(dto.getUserId())).thenReturn(Optional.of(user)); - when(portalAccessRepository.findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(dto.getUserId())) - .thenReturn(Optional.of(portalAccess)); + when(portalAccessService.isNotDeletedPortalUser(dto.getUserId())).thenReturn(Boolean.TRUE); assertThat(userService.upsert(dto)).isEqualTo(UpsertResult.UPDATED); verify(userRepository, times(1)).findById(dto.getUserId()); - verify(portalAccessRepository, times(1)).findByUser_IdAndDeletedAtNullAndUser_DeletedAtNull(dto.getUserId()); - verify(portalAccessRepository, never()).save(any()); + verify(portalAccessService, times(1)).isNotDeletedPortalUser(dto.getUserId()); + verifyNoMoreInteractions(portalAccessService); } @DisplayName("Should find user by original email successfully")