From ba13a3fddd26fe94297d31581345f0c8904393cc Mon Sep 17 00:00:00 2001 From: Shaed Parkar Date: Mon, 25 Nov 2024 20:49:34 +0000 Subject: [PATCH] VIH-10899 remove obsolete hearing types and case roles --- .../packages.lock.json | 18 +- .../HearingsController/EditHearingTests.cs | 9 - .../GetStatusHearingTests.cs | 1 - .../HearingsControllerTests.cs | 3 - .../GetUnallocatedHearingsTests.cs | 4 +- .../HearingDetailsResponseMapperTests.cs | 2 - .../AdminWebsite.UnitTests/packages.lock.json | 18 +- AdminWebsite/AdminWebsite/AdminWebsite.csproj | 4 +- .../AdminWebsite/ClientApp/package-lock.json | 102 +- .../add-participant-base.component.ts | 38 +- .../add-participant.component.html | 3 +- .../add-participant.component.spec.ts | 247 +--- .../add-participant.component.ts | 34 +- .../assign-judge.component.spec.ts | 1 - .../assign-judge/assign-judge.component.ts | 1 - .../create-hearing.component.ts | 53 +- .../endpoints/endpoints.component.spec.ts | 1 - .../item/participant-item.component.html | 12 - .../item/participant-item.component.spec.ts | 27 - .../item/participant-item.component.ts | 8 - .../list/participant-list.component.spec.ts | 71 +- .../list/participant-list.component.ts | 32 +- .../search-email.component.spec.ts | 2 - .../search-email/search-email.component.ts | 2 - .../services/participant.service.spec.ts | 22 +- .../booking/services/participant.service.ts | 15 +- .../booking/summary/summary.component.html | 1 - .../booking/summary/summary.component.spec.ts | 15 - .../app/booking/summary/summary.component.ts | 2 - .../booking-details.component.spec.ts | 4 - ...booking-participant-list.component.spec.ts | 60 +- .../booking-participant-list.component.ts | 27 +- .../bookings-list.component.spec.ts | 28 +- .../hearing-details.component.html | 3 - .../hearing-details.component.spec.ts | 3 - .../participant-details.component.html | 4 - .../participant-details.component.spec.ts | 3 - .../common/model/booking-list.model.spec.ts | 3 - .../app/common/model/bookings-list.model.ts | 3 - .../src/app/common/model/hearing.model.ts | 3 - .../model/participant-details.model.spec.ts | 137 +- .../common/model/participant-details.model.ts | 17 - .../common/model/participant-model.spec.ts | 8 +- .../src/app/common/model/participant.model.ts | 5 +- .../src/app/common/model/party.model.ts | 12 - .../services/booking-details.service.spec.ts | 10 - .../app/services/booking-details.service.ts | 6 +- .../services/bookings-list.service.spec.ts | 25 +- .../src/app/services/bookings-list.service.ts | 1 - .../services/bookings-persist.service.spec.ts | 1 - .../src/app/services/clients/api-client.ts | 1126 ++++++----------- .../participant-edit-service.service.spec.ts | 4 +- .../src/app/services/search.service.spec.ts | 4 +- .../src/app/services/search.service.ts | 4 +- .../services/video-hearings.service.spec.ts | 41 - .../app/services/video-hearings.service.ts | 22 +- .../case-types-menu.component.ts | 2 +- .../app/testing/data/response-test-data.ts | 15 - .../app/testing/stubs/service-service-stub.ts | 4 +- .../Requests/BookingDetailsRequest.cs | 1 - .../Contracts/Requests/ParticipantRequest.cs | 2 - .../Responses/HearingDetailsResponse.cs | 16 - .../Responses/HearingTypeResponse.cs | 23 + .../Controllers/HearingsController.cs | 17 +- .../ReferenceData/HearingTypesController.cs | 45 + .../Controllers/WorkAllocationController.cs | 2 +- .../Mappers/HearingDetailsResponseMapper.cs | 2 - AdminWebsite/AdminWebsite/packages.lock.json | 18 +- AdminWebsite/nuget.config | 1 + 69 files changed, 672 insertions(+), 1788 deletions(-) delete mode 100644 AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/party.model.ts create mode 100644 AdminWebsite/AdminWebsite/Contracts/Responses/HearingTypeResponse.cs create mode 100644 AdminWebsite/AdminWebsite/Controllers/ReferenceData/HearingTypesController.cs diff --git a/AdminWebsite/AdminWebsite.IntegrationTests/packages.lock.json b/AdminWebsite/AdminWebsite.IntegrationTests/packages.lock.json index cac81aa60..876627b22 100644 --- a/AdminWebsite/AdminWebsite.IntegrationTests/packages.lock.json +++ b/AdminWebsite/AdminWebsite.IntegrationTests/packages.lock.json @@ -113,18 +113,18 @@ }, "BookingsApi.Client": { "type": "Transitive", - "resolved": "3.1.2-pr-0919-0010", - "contentHash": "uTjHes/RCMLANtbDLm2sfQTdqSA/90fwUGb2KthKSsZWpjoYdZtJYDjLtTNFqeH7qAKQTV0herli/gAyAAP0hg==", + "resolved": "3.1.2-pr-0919-0013", + "contentHash": "obv+kZ7pXc1ijmIiFzwEmFca1sNIIodlRHwzoiX5fUaIGNwX4Zgm4UZYEx2aM3kn0z1CMVXiYSerD6TGiNf4MA==", "dependencies": { - "BookingsApi.Common.DotNet6": "3.1.2-pr-0919-0010", + "BookingsApi.Common.DotNet6": "3.1.2-pr-0919-0013", "Microsoft.AspNetCore.Mvc.Core": "2.2.5", "System.Text.Json": "8.0.5" } }, "BookingsApi.Common.DotNet6": { "type": "Transitive", - "resolved": "3.1.2-pr-0919-0010", - "contentHash": "JBKWH0dvKUOBh9AnUV0C6ExjeV0Wem3bfmk7Gkxrqnc+Iz5cUvz6zyMMnGVX1mFlsEgrxVeJXj/DoTV0YCyN0Q==", + "resolved": "3.1.2-pr-0919-0013", + "contentHash": "BV8KrhMjIlCeRJajRCQ6X47VJSBAIql8O/1JSOgISVnnxTSNKiBc9htjyXgAsobkbAv6ylSTYVi6UENFp8BOiw==", "dependencies": { "System.Text.Json": "8.0.5" } @@ -943,8 +943,8 @@ }, "Microsoft.Identity.Client": { "type": "Transitive", - "resolved": "4.61.0", - "contentHash": "3TDPEie+9t/NgBhoNifLFwM6nkypYUa8GUHfMnkYtovDDTQM8bsS2KEIP5tAh28BgfJZgof/KlCEKvGxz0H3Eg==", + "resolved": "4.61.3", + "contentHash": "naJo/Qm35Caaoxp5utcw+R8eU8ZtLz2ALh8S+gkekOYQ1oazfCQMWVT4NJ/FnHzdIJlm8dMz0oMpMGCabx5odA==", "dependencies": { "Microsoft.IdentityModel.Abstractions": "6.35.0", "System.Diagnostics.DiagnosticSource": "6.0.1" @@ -2161,7 +2161,7 @@ "type": "Project", "dependencies": { "AspNetCore.HealthChecks.Uris": "[8.0.1, )", - "BookingsApi.Client": "[3.1.2-pr-0919-0010, )", + "BookingsApi.Client": "[3.1.2-pr-0919-0013, )", "FluentValidation.AspNetCore": "[11.3.0, )", "LaunchDarkly.ServerSdk": "[8.5.0, )", "MicroElements.Swashbuckle.FluentValidation": "[6.0.0, )", @@ -2172,7 +2172,7 @@ "Microsoft.AspNetCore.SpaServices": "[3.1.32, )", "Microsoft.AspNetCore.SpaServices.Extensions": "[8.0.4, )", "Microsoft.Graph": "[5.52.0, )", - "Microsoft.Identity.Client": "[4.61.0, )", + "Microsoft.Identity.Client": "[4.61.3, )", "Microsoft.OpenApi": "[1.6.14, )", "Microsoft.VisualStudio.Azure.Containers.Tools.Targets": "[1.20.1, )", "NWebsec.AspNetCore.Middleware": "[3.0.0, )", diff --git a/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/EditHearingTests.cs b/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/EditHearingTests.cs index db01b8242..baab8cdfa 100644 --- a/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/EditHearingTests.cs +++ b/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/EditHearingTests.cs @@ -1,5 +1,4 @@ using System.Linq; -using System.Threading; using System.Threading.Tasks; using AdminWebsite.Configuration; using AdminWebsite.Models; @@ -9,8 +8,6 @@ using BookingsApi.Contract.V2.Enums; using BookingsApi.Contract.V2.Requests; using BookingsApi.Contract.V2.Responses; -using FluentValidation; -using FluentValidation.Results; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -28,7 +25,6 @@ public class EditHearingTests private AdminWebsite.Controllers.HearingsController _controller; private EditHearingRequest _editEndpointOnHearingRequestWithJudge; - private Mock> _editHearingRequestValidator; private IHearingsService _hearingsService; private Mock> _participantGroupLogger; @@ -45,7 +41,6 @@ public void Setup() { _bookingsApiClient = new Mock(); _userIdentity = new Mock(); - _editHearingRequestValidator = new Mock>(); _conferencesServiceMock = new Mock(); _conferencesServiceMock.Setup(cs => cs.GetConferenceDetailsByHearingId(It.IsAny(), false)) .ReturnsAsync(new ConferenceDetailsResponse @@ -69,7 +64,6 @@ public void Setup() _hearingsService = new HearingsService(_bookingsApiClient.Object, _participantGroupLogger.Object); _controller = new AdminWebsite.Controllers.HearingsController(_bookingsApiClient.Object, _userIdentity.Object, - _editHearingRequestValidator.Object, new Mock>().Object, _hearingsService, _conferencesServiceMock.Object); @@ -161,9 +155,6 @@ public void Setup() _bookingsApiClient.Setup(x => x.GetHearingDetailsByIdV2Async(It.IsAny())) .ReturnsAsync(_updatedExistingParticipantHearingOriginal); - _editHearingRequestValidator.Setup(x => x.ValidateAsync(It.IsAny(), It.IsAny())) - .ReturnsAsync(new ValidationResult()); - _v2HearingDetailsResponse = new HearingDetailsResponseV2 { Id = _validId, diff --git a/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/GetStatusHearingTests.cs b/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/GetStatusHearingTests.cs index 463ec1292..7ff207aac 100644 --- a/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/GetStatusHearingTests.cs +++ b/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/GetStatusHearingTests.cs @@ -34,7 +34,6 @@ public void Setup() _hearingServiceMock = new Mock(); _controller = new AdminWebsite.Controllers.HearingsController(_bookingsApiClientMock.Object, new Mock().Object, - new Mock>().Object, new Mock>().Object, _hearingServiceMock.Object, _conferenceDetailsServiceMock.Object); diff --git a/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/HearingsControllerTests.cs b/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/HearingsControllerTests.cs index 332e5ba93..34598c472 100644 --- a/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/HearingsControllerTests.cs +++ b/AdminWebsite/AdminWebsite.UnitTests/Controllers/HearingsController/HearingsControllerTests.cs @@ -17,7 +17,6 @@ public abstract class HearingsControllerTests { private Mock _conferencesServiceMock; - private Mock> _editHearingRequestValidator; private IHearingsService _hearingsService; private Mock> _participantGroupLogger; private Mock _VodafoneConfigurationMock; @@ -32,7 +31,6 @@ protected virtual void Setup() { BookingsApiClient = new Mock(); UserIdentity = new Mock(); - _editHearingRequestValidator = new Mock>(); _conferencesServiceMock = new Mock(); FeatureToggle = new Mock(); _conferencesServiceMock.Setup(cs => cs.GetConferenceDetailsByHearingId(It.IsAny(), false)) @@ -58,7 +56,6 @@ protected virtual void Setup() Controller = new AdminWebsite.Controllers.HearingsController(BookingsApiClient.Object, UserIdentity.Object, - _editHearingRequestValidator.Object, new Mock>().Object, _hearingsService, _conferencesServiceMock.Object); diff --git a/AdminWebsite/AdminWebsite.UnitTests/Controllers/WorkAllocationController/GetUnallocatedHearingsTests.cs b/AdminWebsite/AdminWebsite.UnitTests/Controllers/WorkAllocationController/GetUnallocatedHearingsTests.cs index 9785f913d..f1d133f35 100644 --- a/AdminWebsite/AdminWebsite.UnitTests/Controllers/WorkAllocationController/GetUnallocatedHearingsTests.cs +++ b/AdminWebsite/AdminWebsite.UnitTests/Controllers/WorkAllocationController/GetUnallocatedHearingsTests.cs @@ -24,7 +24,7 @@ public void Setup() public async Task Should_get_unallocated_hearings() { // Arrange - _mocker.Mock().Setup(client => client.GetUnallocatedHearingsAsync()) + _mocker.Mock().Setup(client => client.GetUnallocatedHearingsV2Async()) .ReturnsAsync(new List {new ()}); // Act var response = await _controller.GetUnallocatedHearings(); @@ -40,7 +40,7 @@ public async Task Should_get_unallocated_hearings() public async Task Should_try_get_unallocated_hearings_and_return_empty_list() { // Arrange - _mocker.Mock().Setup(client => client.GetUnallocatedHearingsAsync()) + _mocker.Mock().Setup(client => client.GetUnallocatedHearingsV2Async()) .ReturnsAsync(new List()); // Act diff --git a/AdminWebsite/AdminWebsite.UnitTests/Mappers/HearingDetailsResponseMapperTests.cs b/AdminWebsite/AdminWebsite.UnitTests/Mappers/HearingDetailsResponseMapperTests.cs index b6f1d5511..b01a2a516 100644 --- a/AdminWebsite/AdminWebsite.UnitTests/Mappers/HearingDetailsResponseMapperTests.cs +++ b/AdminWebsite/AdminWebsite.UnitTests/Mappers/HearingDetailsResponseMapperTests.cs @@ -27,10 +27,8 @@ public void should_map_v2_model_to_hearing_detail_response() actual.Id.Should().Be(hearing.Id); actual.ScheduledDateTime.Should().Be(hearing.ScheduledDateTime); actual.ScheduledDuration.Should().Be(hearing.ScheduledDuration); - actual.HearingVenueName.Should().Be(hearing.HearingVenueName); actual.HearingVenueCode.Should().Be(hearing.HearingVenueCode); actual.ServiceId.Should().Be(hearing.ServiceId); - actual.CaseTypeName.Should().Be(hearing.ServiceName); actual.ConferenceSupplier.Should().Be(AdminWebsite.Contracts.Enums.VideoSupplier.Vodafone); actual.AllocatedToUsername.Should().Be(hearing.AllocatedToUsername); } diff --git a/AdminWebsite/AdminWebsite.UnitTests/packages.lock.json b/AdminWebsite/AdminWebsite.UnitTests/packages.lock.json index 1d9255994..1121dfa8e 100644 --- a/AdminWebsite/AdminWebsite.UnitTests/packages.lock.json +++ b/AdminWebsite/AdminWebsite.UnitTests/packages.lock.json @@ -109,18 +109,18 @@ }, "BookingsApi.Client": { "type": "Transitive", - "resolved": "3.1.2-pr-0919-0010", - "contentHash": "uTjHes/RCMLANtbDLm2sfQTdqSA/90fwUGb2KthKSsZWpjoYdZtJYDjLtTNFqeH7qAKQTV0herli/gAyAAP0hg==", + "resolved": "3.1.2-pr-0919-0013", + "contentHash": "obv+kZ7pXc1ijmIiFzwEmFca1sNIIodlRHwzoiX5fUaIGNwX4Zgm4UZYEx2aM3kn0z1CMVXiYSerD6TGiNf4MA==", "dependencies": { - "BookingsApi.Common.DotNet6": "3.1.2-pr-0919-0010", + "BookingsApi.Common.DotNet6": "3.1.2-pr-0919-0013", "Microsoft.AspNetCore.Mvc.Core": "2.2.5", "System.Text.Json": "8.0.5" } }, "BookingsApi.Common.DotNet6": { "type": "Transitive", - "resolved": "3.1.2-pr-0919-0010", - "contentHash": "JBKWH0dvKUOBh9AnUV0C6ExjeV0Wem3bfmk7Gkxrqnc+Iz5cUvz6zyMMnGVX1mFlsEgrxVeJXj/DoTV0YCyN0Q==", + "resolved": "3.1.2-pr-0919-0013", + "contentHash": "BV8KrhMjIlCeRJajRCQ6X47VJSBAIql8O/1JSOgISVnnxTSNKiBc9htjyXgAsobkbAv6ylSTYVi6UENFp8BOiw==", "dependencies": { "System.Text.Json": "8.0.5" } @@ -861,8 +861,8 @@ }, "Microsoft.Identity.Client": { "type": "Transitive", - "resolved": "4.61.0", - "contentHash": "3TDPEie+9t/NgBhoNifLFwM6nkypYUa8GUHfMnkYtovDDTQM8bsS2KEIP5tAh28BgfJZgof/KlCEKvGxz0H3Eg==", + "resolved": "4.61.3", + "contentHash": "naJo/Qm35Caaoxp5utcw+R8eU8ZtLz2ALh8S+gkekOYQ1oazfCQMWVT4NJ/FnHzdIJlm8dMz0oMpMGCabx5odA==", "dependencies": { "Microsoft.IdentityModel.Abstractions": "6.35.0", "System.Diagnostics.DiagnosticSource": "6.0.1" @@ -2231,7 +2231,7 @@ "type": "Project", "dependencies": { "AspNetCore.HealthChecks.Uris": "[8.0.1, )", - "BookingsApi.Client": "[3.1.2-pr-0919-0010, )", + "BookingsApi.Client": "[3.1.2-pr-0919-0013, )", "FluentValidation.AspNetCore": "[11.3.0, )", "LaunchDarkly.ServerSdk": "[8.5.0, )", "MicroElements.Swashbuckle.FluentValidation": "[6.0.0, )", @@ -2242,7 +2242,7 @@ "Microsoft.AspNetCore.SpaServices": "[3.1.32, )", "Microsoft.AspNetCore.SpaServices.Extensions": "[8.0.4, )", "Microsoft.Graph": "[5.52.0, )", - "Microsoft.Identity.Client": "[4.61.0, )", + "Microsoft.Identity.Client": "[4.61.3, )", "Microsoft.OpenApi": "[1.6.14, )", "Microsoft.VisualStudio.Azure.Containers.Tools.Targets": "[1.20.1, )", "NWebsec.AspNetCore.Middleware": "[3.0.0, )", diff --git a/AdminWebsite/AdminWebsite/AdminWebsite.csproj b/AdminWebsite/AdminWebsite/AdminWebsite.csproj index b0b6b30f4..b74926c91 100644 --- a/AdminWebsite/AdminWebsite/AdminWebsite.csproj +++ b/AdminWebsite/AdminWebsite/AdminWebsite.csproj @@ -30,10 +30,10 @@ - + - + diff --git a/AdminWebsite/AdminWebsite/ClientApp/package-lock.json b/AdminWebsite/AdminWebsite/ClientApp/package-lock.json index 8067ef6ec..063d6a09a 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/package-lock.json +++ b/AdminWebsite/AdminWebsite/ClientApp/package-lock.json @@ -4726,13 +4726,12 @@ } }, "node_modules/@puppeteer/browsers": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.4.0.tgz", - "integrity": "sha512-x8J1csfIygOwf6D6qUAZ0ASk3z63zPb7wkNeHRerCMh82qWKUrOgkuP005AJC8lDL6/evtXETGEJVcwykKT4/g==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.4.1.tgz", + "integrity": "sha512-0kdAbmic3J09I6dT8e9vE2JOCSt13wHCW5x/ly8TSt2bDtuIWe2TgLZZDHdcziw9AVCzflMAXCrVyRIhIs44Ng==", "dev": true, - "license": "Apache-2.0", "dependencies": { - "debug": "^4.3.6", + "debug": "^4.3.7", "extract-zip": "^2.0.1", "progress": "^2.0.3", "proxy-agent": "^6.4.0", @@ -4753,7 +4752,6 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, - "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -5060,8 +5058,7 @@ "version": "0.23.0", "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@tufjs/canonical-json": { "version": "2.0.0", @@ -6524,7 +6521,6 @@ "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", "dev": true, - "license": "MIT", "dependencies": { "tslib": "^2.0.1" }, @@ -6629,8 +6625,7 @@ "version": "1.6.7", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.7.tgz", "integrity": "sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg==", - "dev": true, - "license": "Apache-2.0" + "dev": true }, "node_modules/babel-loader": { "version": "9.1.3", @@ -6756,7 +6751,6 @@ "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.5.0.tgz", "integrity": "sha512-/E8dDe9dsbLyh2qrZ64PEPadOQ0F4gbl1sUJOrmph7xOiIxfY8vwab/4bFLh4Y88/Hk/ujKcrQKc+ps0mv873A==", "dev": true, - "license": "Apache-2.0", "optional": true }, "node_modules/bare-fs": { @@ -6764,7 +6758,6 @@ "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-2.3.5.tgz", "integrity": "sha512-SlE9eTxifPDJrT6YgemQ1WGFleevzwY+XAP1Xqgl56HtcrisC2CHCZ2tq6dBpcH2TnNxwUEUGhweo+lrQtYuiw==", "dev": true, - "license": "Apache-2.0", "optional": true, "dependencies": { "bare-events": "^2.0.0", @@ -6777,7 +6770,6 @@ "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-2.4.4.tgz", "integrity": "sha512-z3UiI2yi1mK0sXeRdc4O1Kk8aOa/e+FNWZcTiPB/dfTWyLypuE99LibgRaQki914Jq//yAWylcAt+mknKdixRQ==", "dev": true, - "license": "Apache-2.0", "optional": true }, "node_modules/bare-path": { @@ -6785,18 +6777,16 @@ "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-2.1.3.tgz", "integrity": "sha512-lh/eITfU8hrj9Ru5quUp0Io1kJWIk1bTjzo7JH1P5dWmQ2EL4hFUlfI8FonAhSlgIfhn63p84CDY/x+PisgcXA==", "dev": true, - "license": "Apache-2.0", "optional": true, "dependencies": { "bare-os": "^2.1.0" } }, "node_modules/bare-stream": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.3.2.tgz", - "integrity": "sha512-EFZHSIBkDgSHIwj2l2QZfP4U5OcD4xFAOwhSb/vlr9PIqyGJGvB/nfClJbcnh3EY4jtPE4zsb5ztae96bVF79A==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.4.0.tgz", + "integrity": "sha512-sd96/aZ8LjF1uJbEHzIo1LrERPKRFPEy1nZ1eOILftBxrVsFDAQkimHIIq87xrHcubzjNeETsD9PwN0wp+vLiQ==", "dev": true, - "license": "Apache-2.0", "optional": true, "dependencies": { "streamx": "^2.20.0" @@ -6835,7 +6825,6 @@ "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.5.tgz", "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", "dev": true, - "license": "MIT", "engines": { "node": ">=10.0.0" } @@ -7252,7 +7241,6 @@ "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.8.0.tgz", "integrity": "sha512-uJydbGdTw0DEUjhoogGveneJVWX/9YuqkWePzMmkBYwtdAqo5d3J/ovNKFr+/2hWXYmYCr6it8mSSTIj6SS6Ug==", "dev": true, - "license": "Apache-2.0", "dependencies": { "mitt": "3.0.1", "urlpattern-polyfill": "10.0.0", @@ -7939,7 +7927,6 @@ "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", "dev": true, - "license": "MIT", "engines": { "node": ">= 14" } @@ -8099,7 +8086,6 @@ "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", "dev": true, - "license": "MIT", "dependencies": { "ast-types": "^0.13.4", "escodegen": "^2.1.0", @@ -8153,11 +8139,10 @@ "dev": true }, "node_modules/devtools-protocol": { - "version": "0.0.1354347", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1354347.tgz", - "integrity": "sha512-BlmkSqV0V84E2WnEnoPnwyix57rQxAM5SKJjf4TbYOCGLAWtz8CDH8RIaGOjPgPCXo2Mce3kxSY497OySidY3Q==", - "dev": true, - "license": "BSD-3-Clause" + "version": "0.0.1367902", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1367902.tgz", + "integrity": "sha512-XxtPuC3PGakY6PD7dG66/o8KwJ/LkH2/EKe19Dcw58w53dv4/vSQEkn/SzuyhHE2q4zPgCkxQBxus3VV4ql+Pg==", + "dev": true }, "node_modules/di": { "version": "0.0.1", @@ -8757,7 +8742,6 @@ "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "esprima": "^4.0.1", "estraverse": "^5.2.0", @@ -8779,7 +8763,6 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, - "license": "BSD-3-Clause", "optional": true, "engines": { "node": ">=0.10.0" @@ -9570,8 +9553,7 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/fast-glob": { "version": "3.3.2", @@ -10067,7 +10049,6 @@ "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.3.tgz", "integrity": "sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw==", "dev": true, - "license": "MIT", "dependencies": { "basic-ftp": "^5.0.2", "data-uri-to-buffer": "^6.0.2", @@ -12692,8 +12673,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/mkdirp": { "version": "0.5.6", @@ -12841,7 +12821,6 @@ "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.4.0" } @@ -14042,7 +14021,6 @@ "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.0.2.tgz", "integrity": "sha512-BFi3vZnO9X5Qt6NRz7ZOaPja3ic0PhlsmCRYLOpN11+mWBCR6XJDqW5RF3j8jm4WGGQZtBA+bTfxYzeKW73eHg==", "dev": true, - "license": "MIT", "dependencies": { "@tootallnate/quickjs-emscripten": "^0.23.0", "agent-base": "^7.0.2", @@ -14062,7 +14040,6 @@ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", "dev": true, - "license": "MIT", "dependencies": { "agent-base": "^7.0.2", "debug": "4" @@ -14076,7 +14053,6 @@ "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", "dev": true, - "license": "MIT", "dependencies": { "degenerator": "^5.0.0", "netmask": "^2.0.2" @@ -14699,7 +14675,6 @@ "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.4.0.tgz", "integrity": "sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==", "dev": true, - "license": "MIT", "dependencies": { "agent-base": "^7.0.2", "debug": "^4.3.4", @@ -14719,7 +14694,6 @@ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", "dev": true, - "license": "ISC", "engines": { "node": ">=12" } @@ -14757,18 +14731,17 @@ } }, "node_modules/puppeteer": { - "version": "23.6.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.6.1.tgz", - "integrity": "sha512-8+ALGQgwXd3P/tGcuSsxTPGDaOQIjcDIm04I5hpWZv/PiN5q8bQNHRUyfYrifT+flnM9aTWCP7tLEzuB6SlIgA==", + "version": "23.9.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.9.0.tgz", + "integrity": "sha512-WfB8jGwFV+qrD9dcJJVvWPFJBU6kxeu2wxJz9WooDGfM3vIiKLgzImEDBxUQnCBK/2cXB3d4dV6gs/LLpgfLDg==", "dev": true, "hasInstallScript": true, - "license": "Apache-2.0", "dependencies": { - "@puppeteer/browsers": "2.4.0", + "@puppeteer/browsers": "2.4.1", "chromium-bidi": "0.8.0", "cosmiconfig": "^9.0.0", - "devtools-protocol": "0.0.1354347", - "puppeteer-core": "23.6.1", + "devtools-protocol": "0.0.1367902", + "puppeteer-core": "23.9.0", "typed-query-selector": "^2.12.0" }, "bin": { @@ -14779,16 +14752,15 @@ } }, "node_modules/puppeteer-core": { - "version": "23.6.1", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.6.1.tgz", - "integrity": "sha512-DoNLAzQfGklPauEn33N4h9cM9GubJSINEn+AUMwAXwW159Y9JLk5y34Jsbv4c7kG8P0puOYWV9leu2siMZ/QpQ==", + "version": "23.9.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.9.0.tgz", + "integrity": "sha512-hLVrav2HYMVdK0YILtfJwtnkBAwNOztUdR4aJ5YKDvgsbtagNr6urUJk9HyjRA9e+PaLI3jzJ0wM7A4jSZ7Qxw==", "dev": true, - "license": "Apache-2.0", "dependencies": { - "@puppeteer/browsers": "2.4.0", + "@puppeteer/browsers": "2.4.1", "chromium-bidi": "0.8.0", "debug": "^4.3.7", - "devtools-protocol": "0.0.1354347", + "devtools-protocol": "0.0.1367902", "typed-query-selector": "^2.12.0", "ws": "^8.18.0" }, @@ -14843,8 +14815,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/randombytes": { "version": "2.1.0", @@ -16103,11 +16074,10 @@ } }, "node_modules/streamx": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.1.tgz", - "integrity": "sha512-uTa0mU6WUC65iUvzKH4X9hEdvSW7rbPxPtwfWiLMSj3qTdQbAiUboZTxauKfpFuGIGa1C2BYijZ7wgdUXICJhA==", + "version": "2.20.2", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.2.tgz", + "integrity": "sha512-aDGDLU+j9tJcUdPGOaHmVF1u/hhI+CsGkT02V3OKlHDV7IukOI+nTWAGkiZEKCO35rWN1wIr4tS7YFr1f4qSvA==", "dev": true, - "license": "MIT", "dependencies": { "fast-fifo": "^1.3.2", "queue-tick": "^1.0.1", @@ -16337,7 +16307,6 @@ "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.6.tgz", "integrity": "sha512-iokBDQQkUyeXhgPYaZxmczGPhnhXZ0CmrqI+MOb/WFGS9DW5wnfrLgtjUJBvz50vQ3qfRwJ62QVoCFu8mPVu5w==", "dev": true, - "license": "MIT", "dependencies": { "pump": "^3.0.0", "tar-stream": "^3.1.5" @@ -16352,7 +16321,6 @@ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", "dev": true, - "license": "MIT", "dependencies": { "b4a": "^1.6.4", "fast-fifo": "^1.2.0", @@ -16573,8 +16541,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.1.tgz", "integrity": "sha512-x9v3H/lTKIJKQQe7RPQkLfKAnc9lUTkWDypIQgTzPJAq+5/GCDHonmshfvlsNSj58yyshbIJJDLmU15qNERrXQ==", - "dev": true, - "license": "Apache-2.0" + "dev": true }, "node_modules/text-table": { "version": "0.2.0", @@ -16978,8 +16945,7 @@ "version": "2.12.0", "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.0.tgz", "integrity": "sha512-SbklCd1F0EiZOyPiW192rrHZzZ5sBijB6xM+cpmrwDqObvdtunOHHIk9fCGsoK5JVIYXoyEp4iEdE3upFH3PAg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/typescript": { "version": "5.4.4", @@ -17180,8 +17146,7 @@ "version": "10.0.0", "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz", "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/util-deprecate": { "version": "1.0.2", @@ -18398,7 +18363,6 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", "dev": true, - "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant-base/add-participant-base.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant-base/add-participant-base.component.ts index ebbba9b2b..5e180bfd1 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant-base/add-participant-base.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant-base/add-participant-base.component.ts @@ -5,7 +5,6 @@ import { Constants } from 'src/app/common/constants'; import { HearingRoles } from 'src/app/common/model/hearing-roles.model'; import { HearingModel } from 'src/app/common/model/hearing.model'; import { ParticipantModel } from 'src/app/common/model/participant.model'; -import { PartyModel } from 'src/app/common/model/party.model'; import { BookingService } from 'src/app/services/booking.service'; import { Logger } from 'src/app/services/logger'; import { VideoHearingsService } from 'src/app/services/video-hearings.service'; @@ -17,7 +16,6 @@ import { InterpreterFormComponent } from '../interpreter-form/interpreter-form.c @Directive() export abstract class AddParticipantBaseDirective extends BookingBaseComponent implements OnInit { isShowErrorSummary = false; - caseAndHearingRoles: PartyModel[] = []; hearingRoles: HearingRoleModel[] = []; participantDetails: ParticipantModel; @@ -54,7 +52,6 @@ export abstract class AddParticipantBaseDirective extends BookingBaseComponent i role: FormControl; interpreterFor: FormControl; lastName: FormControl; - party: FormControl; phone: FormControl; representing: FormControl; title: FormControl; @@ -89,10 +86,6 @@ export abstract class AddParticipantBaseDirective extends BookingBaseComponent i return this.phone.invalid && (this.phone.dirty || this.phone.touched || this.isShowErrorSummary); } - get partyInvalid() { - return this.party.invalid && (this.party.dirty || this.party.touched || this.isShowErrorSummary); - } - get roleInvalid() { return this.role.invalid && (this.role.dirty || this.role.touched || this.isShowErrorSummary); } @@ -124,7 +117,6 @@ export abstract class AddParticipantBaseDirective extends BookingBaseComponent i Validators.required, Validators.pattern(this.constants.PleaseSelectPattern) ]); - this.party = new FormControl(this.constants.PleaseSelect); this.title = new FormControl(this.constants.PleaseSelect); this.firstName = new FormControl('', [ Validators.required, @@ -153,7 +145,6 @@ export abstract class AddParticipantBaseDirective extends BookingBaseComponent i this.form = new FormGroup({ role: this.role, - party: this.party, title: this.title, firstName: this.firstName, lastName: this.lastName, @@ -223,7 +214,6 @@ export abstract class AddParticipantBaseDirective extends BookingBaseComponent i this.resetPartyAndRole(); this.isRepresentative = this.isRoleRepresentative(this.participantDetails.hearing_role_name); const formControlsObj = { - party: this.participantDetails.case_role_name, role: this.participantDetails.hearing_role_name, title: this.participantDetails.title ?? this.constants.PleaseSelect, firstName: this.participantDetails.first_name?.trim(), @@ -256,7 +246,6 @@ export abstract class AddParticipantBaseDirective extends BookingBaseComponent i } protected disableCaseAndHearingRoles() { - this.form.get('party').disable(); this.form.get('role').disable(); } @@ -283,21 +272,10 @@ export abstract class AddParticipantBaseDirective extends BookingBaseComponent i this.emailDisabled = false; this.form.get('lastName').enable(); this.form.get('firstName').enable(); - this.form.get('party').enable(); this.form.get('role').enable(); } resetPartyAndRole() { - if (this.participantDetails.case_role_name) { - this.setupHearingRoles(this.participantDetails.case_role_name); - } - if ( - this.isPartySelected && - !this.existingParticipant && - (!this.participantDetails.case_role_name || this.participantDetails.case_role_name.length === 0) - ) { - this.participantDetails.case_role_name = this.party.value; - } if ( this.isRoleSelected && !this.existingParticipant && @@ -307,15 +285,6 @@ export abstract class AddParticipantBaseDirective extends BookingBaseComponent i } } - setupHearingRoles(caseRoleName: string) { - const list = this.caseAndHearingRoles.find(x => x.name === caseRoleName && x.name !== 'Judge' && x.name !== 'Staff Member'); - this.hearingRoleList = list ? list.hearingRoles.map(x => x.name) : []; - this.updateHearingRoleList(this.hearingRoleList); - if (!this.hearingRoleList.find(s => s === this.constants.PleaseSelect)) { - this.hearingRoleList.unshift(this.constants.PleaseSelect); - } - } - setupHearingRolesWithoutCaseRole() { this.hearingRoleList = this.hearingRoles ? this.hearingRoles.map(x => x.name) : []; this.updateHearingRoleList(this.hearingRoleList); @@ -429,11 +398,8 @@ export abstract class AddParticipantBaseDirective extends BookingBaseComponent i this.interpreterForm?.forceValidation(); } - protected isAnObserver(participant): boolean { - return ( - participant.hearing_role_name === Constants.HearingRoles.Observer || - participant.case_role_name === Constants.HearingRoles.Observer - ); + protected isAnObserver(participant: ParticipantModel): boolean { + return participant.hearing_role_name === Constants.HearingRoles.Observer; } private setRepresenteeLabel() { diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.html b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.html index 8f4104c2b..3c546e881 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.html +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.html @@ -54,8 +54,7 @@

Add a participant

[disabled]="emailDisabled" (findParticipant)="getParticipant($event)" (emailChanged)="emailChanged()" - [hearingRoleParticipant]="role.value" - [caseRole]="party.value" + [hearingRoleParticipant]="constants.Citizen" > diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.spec.ts index f502778e2..e36aa95e3 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.spec.ts @@ -1,5 +1,5 @@ import { ComponentFixture, fakeAsync, flush, TestBed, tick, waitForAsync } from '@angular/core/testing'; -import { AbstractControl, Validators } from '@angular/forms'; +import { AbstractControl } from '@angular/forms'; import { NavigationEnd, Router, RouterModule } from '@angular/router'; import { of, Subscription } from 'rxjs'; import { SharedModule } from 'src/app/shared/shared.module'; @@ -7,9 +7,8 @@ import { SearchServiceStub } from 'src/app/testing/stubs/service-service-stub'; import { Constants } from '../../common/constants'; import { HearingModel } from '../../common/model/hearing.model'; import { ParticipantModel } from '../../common/model/participant.model'; -import { PartyModel } from '../../common/model/party.model'; import { BookingService } from '../../services/booking.service'; -import { CaseAndHearingRolesResponse, ClientSettingsResponse, HearingRole, HearingRoleResponse } from '../../services/clients/api-client'; +import { ClientSettingsResponse, HearingRoleResponse } from '../../services/clients/api-client'; import { ConfigService } from '../../services/config.service'; import { Logger } from '../../services/logger'; import { SearchService } from '../../services/search.service'; @@ -23,7 +22,6 @@ import { LinkedParticipantModel, LinkedParticipantType } from 'src/app/common/mo import { BookingModule } from '../booking.module'; import { PopupModule } from 'src/app/popups/popup.module'; import { TestingModule } from 'src/app/testing/testing.module'; -import { By } from '@angular/platform-browser'; import { HearingRoles } from '../../common/model/hearing-roles.model'; import { FeatureFlags, LaunchDarklyService } from 'src/app/services/launch-darkly.service'; import { InterpreterFormComponent } from '../interpreter-form/interpreter-form.component'; @@ -34,17 +32,6 @@ import { FeatureFlagDirective } from 'src/app/src/app/shared/feature-flag.direct let component: AddParticipantComponent; let fixture: ComponentFixture; -const roleList: CaseAndHearingRolesResponse[] = [ - new CaseAndHearingRolesResponse({ - name: 'Applicant', - hearing_roles: [ - new HearingRole({ name: 'Representative', user_role: 'Representative' }), - new HearingRole({ name: 'Litigant in person', user_role: 'Individual' }), - new HearingRole({ name: 'presenting officer', user_role: 'Representative' }), - new HearingRole({ name: 'Interpreter', user_role: 'Individual' }) - ] - }) -]; const flatRoleList: HearingRoleResponse[] = [ new HearingRoleResponse({ name: 'Applicant', @@ -88,19 +75,9 @@ const flatRoleList: HearingRoleResponse[] = [ }) ]; -const partyR = new PartyModel('Applicant'); -partyR.hearingRoles = [ - new HearingRoleModel('Representative', 'Representative'), - new HearingRoleModel('Litigant in person', 'Individual'), - new HearingRoleModel('presenting officer', 'Representative'), - new HearingRoleModel('Interpreter', 'Interpreter') -]; -const partyList: PartyModel[] = [partyR]; - const mappedHearingRoles: HearingRoleModel[] = flatRoleList.map(x => new HearingRoleModel(x.name, x.user_role, x.code)); let role: AbstractControl; -let party: AbstractControl; let title: AbstractControl; let firstName: AbstractControl; let lastName: AbstractControl; @@ -123,7 +100,6 @@ p1.title = 'Mr.'; p1.email = 'test1@hmcts.net'; p1.phone = '32332'; p1.hearing_role_name = 'Representative'; -p1.case_role_name = 'Applicant'; p1.company = 'CN'; p1.representee = 'representee'; p1.user_role_name = 'Representative'; @@ -138,7 +114,6 @@ p2.title = 'Mr.'; p2.email = 'test2@hmcts.net'; p2.phone = '32332'; p2.hearing_role_name = 'Representative'; -p2.case_role_name = 'Applicant'; p2.company = 'CN'; p2.representee = 'representee'; p2.user_role_name = 'Representative'; @@ -153,7 +128,6 @@ p3.title = 'Mr.'; p3.email = 'test3@hmcts.net'; p3.phone = '32332'; p3.hearing_role_name = 'Representative'; -p3.case_role_name = 'Applicant'; p3.company = 'CN'; p3.is_exist_person = true; p3.id = '1234'; @@ -168,7 +142,6 @@ p4.title = 'Mr.'; p4.email = 'test4@hmcts.net'; p4.phone = '32332'; p4.hearing_role_name = 'Litigant in person'; -p4.case_role_name = 'Applicant'; p4.company = 'CN'; p4.id = '1234'; p4.user_role_name = 'Individual'; @@ -182,7 +155,6 @@ p5.title = 'Mr.'; p5.email = 'test7@hmcts.net'; p5.phone = '32332'; p5.hearing_role_name = 'Interpreter'; -p5.case_role_name = 'Applicant'; p5.company = 'CN'; p5.id = '1234666'; p5.user_role_name = 'Individual'; @@ -197,7 +169,6 @@ p6.title = 'Mr.'; p6.email = 'test8@hmcts.net'; p6.phone = '32332'; p6.hearing_role_name = 'Litigant in Person'; -p6.case_role_name = 'Applicant'; p6.company = 'CN'; p6.id = '1234555'; p6.user_role_name = 'Individual'; @@ -210,7 +181,6 @@ participants.push(p4); function initHearingRequest(): HearingModel { const newHearing = new HearingModel(); newHearing.cases = []; - newHearing.hearing_type_id = -1; newHearing.hearing_venue_id = -1; newHearing.scheduled_duration = 0; newHearing.participants = participants; @@ -223,7 +193,6 @@ function initExistHearingRequest(): HearingModel { const newHearing = new HearingModel(); newHearing.cases = []; newHearing.hearing_id = '12345'; - newHearing.hearing_type_id = 1; newHearing.hearing_venue_id = 1; newHearing.scheduled_duration = 20; newHearing.participants = participants; @@ -244,7 +213,6 @@ function initParticipant() { participant.display_name = 'Sam Green'; participant.title = 'Mr'; participant.hearing_role_name = 'Representative'; - participant.case_role_name = 'Applicant'; participant.company = 'CN'; participant.representee = 'test representee'; participant.user_role_name = 'Individual'; @@ -258,7 +226,6 @@ const routerSpy: jasmine.SpyObj = { let videoHearingsServiceSpy: jasmine.SpyObj; videoHearingsServiceSpy = jasmine.createSpyObj([ - 'getParticipantRoles', 'getCurrentRequest', 'setBookingHasChanged', 'unsetBookingHasChanged', @@ -279,7 +246,6 @@ const loggerSpy = jasmine.createSpyObj('Logger', ['error', 'debug', 'war let participantServiceSpy = jasmine.createSpyObj('ParticipantService', [ 'checkDuplication', 'removeParticipant', - 'mapParticipantsRoles', 'mapParticipantHearingRoles' ]); @@ -293,18 +259,15 @@ describe('AddParticipantComponent', () => { initParticipant(); const hearing = initHearingRequest(); - videoHearingsServiceSpy.getParticipantRoles.and.returnValue(Promise.resolve(roleList)); videoHearingsServiceSpy.getCurrentRequest.and.returnValue(hearing); videoHearingsServiceSpy.getHearingRoles.and.returnValue(Promise.resolve(flatRoleList)); participantServiceSpy = jasmine.createSpyObj([ - 'mapParticipantsRoles', 'checkDuplication', 'removeParticipant', 'mapParticipantHearingRoles' ]); launchDarklyServiceSpy.getFlag.withArgs(FeatureFlags.interpreterEnhancements).and.returnValue(of(false)); launchDarklyServiceSpy.getFlag.withArgs(FeatureFlags.specialMeasures).and.returnValue(of(false)); - participantServiceSpy.mapParticipantsRoles.and.returnValue(partyList); participantServiceSpy.mapParticipantHearingRoles.and.returnValue(mappedHearingRoles); bookingServiceSpy = jasmine.createSpyObj(['isEditMode', 'resetEditMode']); bookingServiceSpy.isEditMode.and.returnValue(false); @@ -336,7 +299,6 @@ describe('AddParticipantComponent', () => { component.ngOnInit(); role = component.form.controls['role']; - party = component.form.controls['party']; title = component.form.controls['title']; firstName = component.form.controls['firstName']; lastName = component.form.controls['lastName']; @@ -383,7 +345,6 @@ describe('AddParticipantComponent', () => { component.ngOnInit(); tick(500); expect(role.value).toBe(Constants.PleaseSelect); - expect(party.value).toBe(Constants.PleaseSelect); expect(firstName.value).toBe(''); expect(lastName.value).toBe(''); expect(email.value).toBe(''); @@ -431,31 +392,9 @@ describe('AddParticipantComponent', () => { component.roleSelected(); expect(role.valid && component.isRoleSelected).toBeTruthy(); }); - it('should reset undefined value for party and role to Please select', () => { - participant.case_role_name = undefined; - participant.hearing_role_name = undefined; - component.getParticipant(participant); - - expect(component.participantDetails.case_role_name).toBeTruthy(); - expect(component.participantDetails.case_role_name).toEqual(Constants.PleaseSelect); - expect(component.participantDetails.hearing_role_name).toEqual(Constants.PleaseSelect); - }); - it('should reset empty party and role to Please select', () => { - participant.case_role_name = ''; - participant.hearing_role_name = ''; - - component.isPartySelected = true; - component.isRoleSelected = true; - component.getParticipant(participant); - - expect(component.participantDetails.case_role_name).toBeTruthy(); - expect(component.participantDetails.case_role_name).toEqual(Constants.PleaseSelect); - expect(component.participantDetails.hearing_role_name).toEqual(Constants.PleaseSelect); - }); it('should populate the form fields if the participant is found in data store', () => { participant.id = '2345'; component.isPartySelected = true; - component.form.get('party').setValue('Applicant'); component.isRoleSelected = true; component.form.get('role').setValue('Representative'); @@ -465,7 +404,6 @@ describe('AddParticipantComponent', () => { participant.last_name = participant.last_name + ' '; component.getParticipant(participant); expect(role.value).toBe(participant.hearing_role_name); - expect(party.value).toBe(participant.case_role_name); expect(firstName.value).toBe(originalFirstName); expect(lastName.value).toBe(originalLastName); expect(email.value).toBe(participant.email); @@ -495,7 +433,6 @@ describe('AddParticipantComponent', () => { component.getParticipant(participant); component.clearForm(); expect(role.value).toBe(Constants.PleaseSelect); - expect(party.value).toBe(Constants.PleaseSelect); expect(firstName.value).toBe(''); expect(lastName.value).toBe(''); expect(email.value).toBe(''); @@ -504,7 +441,6 @@ describe('AddParticipantComponent', () => { expect(displayName.value).toBe(''); expect(companyName.value).toBe(''); expect(role.untouched).toBeTruthy(); - expect(party.untouched).toBeTruthy(); expect(firstName.untouched).toBeTruthy(); expect(interpretee.value).toBe(Constants.PleaseSelect); }); @@ -530,7 +466,6 @@ describe('AddParticipantComponent', () => { component.searchEmail.initialValue = 'mockInitialValue@hmcts.net'; component.searchEmail.email = 'mock@hmcts.net'; role.setValue('Litigant in person'); - party.setValue('Applicant'); firstName.setValue('Sam'); lastName.setValue('Green'); email.setValue('Sam.Green@litigant.com'); @@ -634,41 +569,6 @@ describe('AddParticipantComponent', () => { component.next(); expect(routerSpy.navigate).toHaveBeenCalledWith(['/video-access-points']); }); - it('the case roles and hearing roles were populated', () => { - component.setupRoles(roleList); - expect(component.roleList.length).toBe(2); - expect(component.roleList[0]).toEqual(Constants.PleaseSelect); - - expect(component.hearingRoleList.length).toBe(5); - expect(component.hearingRoleList[0]).toEqual(Constants.PleaseSelect); - }); - it('party selected will reset hearing roles', () => { - role.setValue('Applicant'); - component.partySelected(); - expect(component.isRoleSelected).toBeTruthy(); - expect(component.hearingRoleList.length).toBe(1); - }); - it('should not add second time value: Please select to a hearing role list', () => { - const roles = new PartyModel('Applicant'); - roles.hearingRoles = [ - new HearingRoleModel(Constants.PleaseSelect, 'None'), - new HearingRoleModel('Representative', 'Representative') - ]; - component.caseAndHearingRoles = [roles]; - role.setValue('Applicant'); - component.setupHearingRoles('Applicant'); - expect(component.hearingRoleList.length).toBe(2); - }); - it('the hearing role list should be empty if selected party name was not found, ', () => { - const roles = new PartyModel('Applicant'); - roles.hearingRoles = [ - new HearingRoleModel(Constants.PleaseSelect, 'None'), - new HearingRoleModel('Representative', 'Representative') - ]; - component.caseAndHearingRoles = [roles]; - component.setupHearingRoles('Respondent'); - expect(component.hearingRoleList.length).toBe(1); - }); it('should set to true isTitleSelected', () => { title.setValue('Mr'); component.titleSelected(); @@ -692,83 +592,7 @@ describe('AddParticipantComponent', () => { component.handleContinueBooking(); expect(component.showCancelPopup).toBeFalsy(); }); - it('should not list an interpreter in hearing roles if there are no interpretees in the participant list', fakeAsync(() => { - component.ngOnInit(); - component.ngAfterViewInit(); - tick(1000); - expect(component.hearingRoleList).toContain('Interpreter'); - component.hearing.participants = []; - component.setupHearingRoles('Claimant'); - tick(1000); - expect(component.hearingRoleList).not.toContain('Interpreter'); - })); - it('should show the interpreter in hearings role if lip or witness is added', fakeAsync(() => { - component.ngOnInit(); - component.ngAfterViewInit(); - tick(1000); - component.setupHearingRoles('Claimant'); - expect(component.hearingRoleList).not.toContain('Interpreter'); - })); - it('should not show the interpreter option in hearings role if an interpreter participant is added', fakeAsync(() => { - component.ngOnInit(); - component.ngAfterViewInit(); - tick(1000); - component.hearing.participants = []; - component.setupHearingRoles('Claimant'); - expect(component.hearingRoleList).not.toContain('Interpreter'); - let participant01 = new ParticipantModel(); - participant01.first_name = 'firstName'; - participant01.last_name = 'lastName'; - participant01.hearing_role_name = 'Witness'; - participant01.user_role_name = 'Individual'; - component.hearing.participants.push(participant01); - participant01 = new ParticipantModel(); - participant01.first_name = 'firstName'; - participant01.last_name = 'lastName'; - participant01.hearing_role_name = 'Interpreter'; - participant01.user_role_name = 'Individual'; - component.hearing.participants.push(participant01); - component.setupHearingRoles('Claimant'); - tick(1000); - expect(component.hearingRoleList).not.toContain('Interpreter'); - })); - it('should not show the interpreter option in hearings role if observer/appraiser participant is added.', fakeAsync(() => { - component.ngOnInit(); - component.ngAfterViewInit(); - tick(1000); - component.hearing.participants = []; - expect(component.hearingRoleList).toContain('Interpreter'); - let participant01 = new ParticipantModel(); - participant01.first_name = 'firstName'; - participant01.last_name = 'lastName'; - participant01.hearing_role_name = 'Observer'; - participant01.case_role_name = 'Observer'; - participant01.user_role_name = 'Individual'; - component.hearing.participants.push(participant01); - participant01 = new ParticipantModel(); - participant01.first_name = 'firstName'; - participant01.last_name = 'lastName'; - participant01.hearing_role_name = 'Appraiser'; - participant01.case_role_name = 'Observer'; - participant01.user_role_name = 'Individual'; - component.hearing.participants.push(participant01); - participant01 = new ParticipantModel(); - participant01.first_name = 'firstName'; - participant01.last_name = 'lastName'; - participant01.hearing_role_name = 'Observer'; - participant01.case_role_name = 'Vets UK'; - participant01.user_role_name = 'Individual'; - component.hearing.participants.push(participant01); - participant01 = new ParticipantModel(); - participant01.first_name = 'firstName'; - participant01.last_name = 'lastName'; - participant01.hearing_role_name = 'Observer'; - participant01.case_role_name = Constants.None; - participant01.user_role_name = 'Individual'; - component.hearing.participants.push(participant01); - component.setupHearingRoles('Applicant'); - expect(component.hearingRoleList).not.toContain('Interpreter'); - })); + it('should not show observers in the interpretee list', fakeAsync(() => { component.ngOnInit(); component.ngAfterViewInit(); @@ -778,23 +602,13 @@ describe('AddParticipantComponent', () => { observer01.first_name = 'firstName'; observer01.last_name = 'lastName'; observer01.hearing_role_name = 'Observer'; - observer01.case_role_name = 'Observer'; observer01.user_role_name = 'Individual'; component.hearing.participants.push(observer01); - const observer02 = new ParticipantModel(); - observer02.id = 'Observer Appraiser'; - observer02.first_name = 'firstName'; - observer02.last_name = 'lastName'; - observer02.hearing_role_name = 'Appraiser'; - observer02.case_role_name = 'Observer'; - observer02.user_role_name = 'Individual'; - component.hearing.participants.push(observer02); const observer03 = new ParticipantModel(); observer03.id = 'Vets UK Observer'; observer03.first_name = 'firstName'; observer03.last_name = 'lastName'; observer03.hearing_role_name = 'Observer'; - observer03.case_role_name = 'Vets UK'; observer03.user_role_name = 'Individual'; component.hearing.participants.push(observer03); const observer04 = new ParticipantModel(); @@ -802,12 +616,10 @@ describe('AddParticipantComponent', () => { observer04.first_name = 'firstName'; observer04.last_name = 'lastName'; observer04.hearing_role_name = 'Observer'; - observer04.case_role_name = Constants.None; observer04.user_role_name = 'Individual'; component.hearing.participants.push(observer04); component.populateInterpretedForList(); expect(component.interpreteeList.find(i => i.id === observer01.id)).toBeUndefined(); - expect(component.interpreteeList.find(i => i.id === observer02.id)).toBeUndefined(); expect(component.interpreteeList.find(i => i.id === observer03.id)).toBeUndefined(); expect(component.interpreteeList.find(i => i.id === observer04.id)).toBeUndefined(); })); @@ -842,7 +654,6 @@ describe('AddParticipantComponent', () => { pa1.is_judge = false; pa1.email = 'firstname.lastname-interpretee@email.com'; pa1.hearing_role_name = 'Litigant in Person'; - pa1.case_role_name = 'Claimant'; const pa2 = new ParticipantModel(); pa2.first_name = 'firstname'; @@ -851,7 +662,6 @@ describe('AddParticipantComponent', () => { pa2.is_judge = false; pa2.email = 'firstname.lastname-interpreter@email.com'; pa2.hearing_role_name = 'Interpreter'; - pa2.case_role_name = 'Claimant'; pa2.interpreterFor = 'firstname.lastname-interpretee@email.com'; component.hearing.participants.push(pa1); component.hearing.participants.push(pa2); @@ -878,7 +688,6 @@ describe('AddParticipantComponent', () => { part1.is_judge = false; part1.email = 'firstname.lastname-interpretee@email.com'; part1.hearing_role_name = 'Litigant in Person'; - part1.case_role_name = 'Claimant'; const part2 = new ParticipantModel(); part2.first_name = 'firstname'; @@ -887,7 +696,6 @@ describe('AddParticipantComponent', () => { part2.is_judge = false; part2.email = 'firstname.lastname-interpreter@email.com'; part2.hearing_role_name = 'Interpreter'; - part2.case_role_name = 'Claimant'; part2.interpreterFor = 'firstname.lastname-interpretee@email.com'; component.hearing.participants.push(part1); component.hearing.participants.push(part2); @@ -1025,7 +833,6 @@ describe('AddParticipantComponent edit mode', () => { beforeEach(waitForAsync(() => { videoHearingsServiceSpy = jasmine.createSpyObj([ 'getCurrentRequest', - 'getParticipantRoles', 'setBookingHasChanged', 'unsetBookingHasChanged', 'updateHearingRequest', @@ -1055,10 +862,8 @@ describe('AddParticipantComponent edit mode', () => { launchDarklyServiceSpy.getFlag.withArgs(FeatureFlags.specialMeasures).and.returnValue(of(false)); const hearing = initExistHearingRequest(); - videoHearingsServiceSpy.getParticipantRoles.and.returnValue(Promise.resolve(roleList)); videoHearingsServiceSpy.getCurrentRequest.and.returnValue(hearing); videoHearingsServiceSpy.getHearingRoles.and.returnValue(Promise.resolve(flatRoleList)); - participantServiceSpy.mapParticipantsRoles.and.returnValue(partyList); participantServiceSpy.mapParticipantHearingRoles.and.returnValue(mappedHearingRoles); bookingServiceSpy.isEditMode.and.returnValue(true); bookingServiceSpy.getParticipantEmail.and.returnValue('test3@hmcts.net'); @@ -1072,7 +877,6 @@ describe('AddParticipantComponent edit mode', () => { fixture.detectChanges(); role = component.form.controls['role']; - party = component.form.controls['party']; title = component.form.controls['title']; firstName = component.form.controls['firstName']; lastName = component.form.controls['lastName']; @@ -1084,9 +888,7 @@ describe('AddParticipantComponent edit mode', () => { interpretee = component.form.controls['interpreterFor']; })); - afterEach(() => { - videoHearingsServiceSpy.getParticipantRoles.calls.reset(); - }); + afterEach(() => {}); it('should initialize form controls', () => { component.initialiseForm(); @@ -1116,7 +918,6 @@ describe('AddParticipantComponent edit mode', () => { title: 'Mr', firstName: participant.first_name, lastName: participant.last_name, - party: 'Panel Member', role: 'Panel Member', email: participant.email, phone: participant.phone, @@ -1225,12 +1026,8 @@ describe('AddParticipantComponent edit mode', () => { fixture.detectChanges(); fixture.whenStable().then(() => { - const partyControl = component.form.controls['party']; - const partyElement = fixture.debugElement.query(By.css('#party')); expect(videoHearingsServiceSpy.getHearingRoles).toHaveBeenCalled(); - expect(partyControl.hasValidator(Validators.required)).toBeFalsy(); expect(component.hearingRoleList).toEqual(['Please select', 'Applicant', 'Litigant in person']); - expect(partyElement).toBeNull(); expect(component.displayNextButton).toBeTruthy(); expect(component.displayClearButton).toBeFalsy(); expect(component.displayAddButton).toBeFalsy(); @@ -1245,7 +1042,6 @@ describe('AddParticipantComponent edit mode', () => { component.searchEmail.email = 'mock@hmcts.net'; role.setValue('Representative'); - party.setValue('Applicant'); firstName.setValue('Sam'); lastName.setValue('Green'); email.setValue('Sam.Green@Representative.com'); @@ -1279,7 +1075,6 @@ describe('AddParticipantComponent edit mode', () => { fixture.detectChanges(); component.searchEmail.email = participant.email; component.form.setValue({ - party: 'Applicant', role: 'Representative', title: 'Ms', firstName: participant.first_name, @@ -1305,7 +1100,6 @@ describe('AddParticipantComponent edit mode', () => { fixture.detectChanges(); component.searchEmail.email = participant.email; component.form.setValue({ - party: Constants.PleaseSelect, role: '', title: Constants.PleaseSelect, firstName: participant.first_name, @@ -1395,7 +1189,6 @@ describe('AddParticipantComponent edit mode', () => { part1.is_judge = false; part1.email = 'firstname.lastname-interpretee@email.com'; part1.hearing_role_name = 'Litigant in Person'; - part1.case_role_name = 'Claimant'; part1.id = '100'; const part2 = new ParticipantModel(); @@ -1405,7 +1198,6 @@ describe('AddParticipantComponent edit mode', () => { part2.is_judge = false; part2.email = 'firstname.lastname-interpreter@email.com'; part2.hearing_role_name = 'Interpreter'; - part2.case_role_name = 'Claimant'; part2.interpreterFor = 'firstname.lastname-interpretee@email.com'; part2.id = '300'; component.hearing.participants.push(part1); @@ -1432,7 +1224,6 @@ describe('AddParticipantComponent edit mode', () => { spyOn(component.searchEmail, 'validateEmail').and.returnValue(true); component.searchEmail.email = 'test7@hmcts.net'; role.setValue('Interpreter'); - party.setValue('Applicant'); firstName.setValue('Test'); lastName.setValue('Participant8'); title.setValue('Mr'); @@ -1451,7 +1242,6 @@ describe('AddParticipantComponent edit mode no participants added', () => { beforeEach(waitForAsync(() => { const hearing = initExistHearingRequest(); videoHearingsServiceSpy = jasmine.createSpyObj([ - 'getParticipantRoles', 'getCurrentRequest', 'setBookingHasChanged', 'unsetBookingHasChanged', @@ -1462,10 +1252,8 @@ describe('AddParticipantComponent edit mode no participants added', () => { 'getHearingRoles' ]); launchDarklyServiceSpy = jasmine.createSpyObj('LaunchDarklyService', ['getFlag']); - videoHearingsServiceSpy.getParticipantRoles.and.returnValue(Promise.resolve(roleList)); videoHearingsServiceSpy.getCurrentRequest.and.returnValue(hearing); videoHearingsServiceSpy.getHearingRoles.and.returnValue(Promise.resolve(flatRoleList)); - participantServiceSpy.mapParticipantsRoles.and.returnValue(partyList); participantServiceSpy.mapParticipantHearingRoles.and.returnValue(mappedHearingRoles); bookingServiceSpy = jasmine.createSpyObj(['getParticipantEmail', 'isEditMode', 'setEditMode', 'resetEditMode']); bookingServiceSpy.isEditMode.and.returnValue(true); @@ -1496,7 +1284,6 @@ describe('AddParticipantComponent edit mode no participants added', () => { component.ngOnInit(); role = component.form.controls['role']; - party = component.form.controls['party']; title = component.form.controls['title']; firstName = component.form.controls['firstName']; lastName = component.form.controls['lastName']; @@ -1568,7 +1355,6 @@ describe('AddParticipantComponent edit mode no participants added', () => { participant.hearing_role_name = HearingRoles.INTERPRETER; component.isRoleSelected = true; component.form.setValue({ - party: 'Applicant', role: 'Representative', title: 'Ms', firstName: participant.first_name, @@ -1632,26 +1418,6 @@ describe('AddParticipantComponent edit mode no participants added', () => { component.getParticipant(participant); expect(component.existingParticipant).toBeTruthy(); }); - it('should reset hearing roles drop down if participant case role changed', () => { - spyOn(component, 'setupHearingRoles'); - participant.id = undefined; - participant.case_role_name = 'Applicant'; - component.participantDetails = participant; - - component.resetPartyAndRole(); - - expect(component.setupHearingRoles).toHaveBeenCalled(); - }); - it('should set case role value from the input field', () => { - participant.id = undefined; - participant.case_role_name = undefined; - component.isPartySelected = true; - component.participantDetails = participant; - - component.resetPartyAndRole(); - expect(component.participantDetails.case_role_name).toBeTruthy(); - expect(component.participantDetails.case_role_name).toEqual(Constants.PleaseSelect); - }); it('should set hearing role value from the input field', () => { participant.id = undefined; participant.hearing_role_name = undefined; @@ -1750,10 +1516,8 @@ describe('AddParticipantComponent edit mode no participants added', () => { describe('AddParticipantComponent set representer', () => { beforeEach(waitForAsync(() => { const hearing = initExistHearingRequest(); - videoHearingsServiceSpy.getParticipantRoles.and.returnValue(Promise.resolve(roleList)); videoHearingsServiceSpy.getCurrentRequest.and.returnValue(hearing); videoHearingsServiceSpy.getHearingRoles.and.returnValue(Promise.resolve(flatRoleList)); - participantServiceSpy.mapParticipantsRoles.and.returnValue(partyList); participantServiceSpy.mapParticipantHearingRoles.and.returnValue(mappedHearingRoles); bookingServiceSpy.isEditMode.and.returnValue(true); bookingServiceSpy.getParticipantEmail.and.returnValue(''); @@ -1775,7 +1539,6 @@ describe('AddParticipantComponent set representer', () => { component.ngOnInit(); role = component.form.controls['role']; - party = component.form.controls['party']; title = component.form.controls['title']; firstName = component.form.controls['firstName']; lastName = component.form.controls['lastName']; @@ -1790,8 +1553,6 @@ describe('AddParticipantComponent set representer', () => { })); it('should show company and name of representing person', () => { - component.caseAndHearingRoles = partyList; - component.form.get('party').setValue('Applicant'); component.form.get('role').setValue('Representative'); component.roleSelected(); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.ts index e29db5286..877e92c96 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/add-participant/add-participant.component.ts @@ -7,7 +7,7 @@ import { SanitizeInputText } from '../../common/formatters/sanitize-input-text'; import { IDropDownModel } from '../../common/model/drop-down.model'; import { ParticipantModel } from '../../common/model/participant.model'; import { BookingService } from '../../services/booking.service'; -import { CaseAndHearingRolesResponse, HearingRoleResponse } from '../../services/clients/api-client'; +import { HearingRoleResponse } from '../../services/clients/api-client'; import { Logger } from '../../services/logger'; import { SearchService } from '../../services/search.service'; import { VideoHearingsService } from '../../services/video-hearings.service'; @@ -16,7 +16,6 @@ import { ParticipantService } from '../services/participant.service'; import { ParticipantListComponent } from '../participant'; import { HearingRoles } from '../../common/model/hearing-roles.model'; import { LinkedParticipantModel, LinkedParticipantType } from 'src/app/common/model/linked-participant.model'; -import { Validators } from '@angular/forms'; import { takeUntil } from 'rxjs/operators'; import { FeatureFlags, LaunchDarklyService } from 'src/app/services/launch-darkly.service'; import { InterpreterSelectedDto } from '../interpreter-form/interpreter-selected.model'; @@ -131,7 +130,6 @@ export class AddParticipantComponent extends AddParticipantBaseDirective impleme .getHearingRoles() .then((data: HearingRoleResponse[]) => { self.setupRolesWithoutCaseRole(data); - self.removePartyValidators(); self.handleRoleSetupForEditMode(self); }) .catch(error => this.logger.error(`${this.loggerPrefix} Error getting hearing roles.`, error)); @@ -184,7 +182,6 @@ export class AddParticipantComponent extends AddParticipantBaseDirective impleme initialiseForm() { super.initialiseForm(); - this.party.setValidators([Validators.required, Validators.pattern(this.constants.PleaseSelectPattern)]); const self = this; this.$subscriptions.push( @@ -196,7 +193,6 @@ export class AddParticipantComponent extends AddParticipantBaseDirective impleme if ( self.showDetails && self.role.value === self.constants.PleaseSelect && - self.party.value === self.constants.PleaseSelect && self.title.value === self.constants.PleaseSelect && self.firstName.value === '' && self.lastName.value === '' && @@ -204,11 +200,7 @@ export class AddParticipantComponent extends AddParticipantBaseDirective impleme self.displayName.value === '' ) { self.displayNext(); - } else if ( - !self.showDetails && - self.role.value === self.constants.PleaseSelect && - self.party.value === self.constants.PleaseSelect - ) { + } else if (!self.showDetails && self.role.value === self.constants.PleaseSelect) { self.displayNext(); } else if (self.showDetails && self.form.valid && self.searchEmail?.validateEmail()) { if (self.localEditMode) { @@ -224,11 +216,6 @@ export class AddParticipantComponent extends AddParticipantBaseDirective impleme ); } - private removePartyValidators() { - this.party.clearValidators(); - this.party.updateValueAndValidity(); - } - private repopulateParticipantToEdit() { const selectedParticipant = this.hearing.participants.find(s => s.email === this.selectedParticipantEmail); if (selectedParticipant) { @@ -255,15 +242,6 @@ export class AddParticipantComponent extends AddParticipantBaseDirective impleme } } - setupRoles(data: CaseAndHearingRolesResponse[]) { - this.caseAndHearingRoles = this.participantService.mapParticipantsRoles(data); - this.roleList = this.caseAndHearingRoles.filter(x => x.name !== 'Judge' && x.name !== 'Staff Member').map(x => x.name); - this.roleList.unshift(this.constants.PleaseSelect); - this.caseAndHearingRoles.forEach(x => { - this.setupHearingRoles(x.name); - }); - } - setupRolesWithoutCaseRole(data: HearingRoleResponse[]) { this.hearingRoles = this.participantService .mapParticipantHearingRoles(data) @@ -305,11 +283,6 @@ export class AddParticipantComponent extends AddParticipantBaseDirective impleme this.displayUpdateButton = false; } - partySelected() { - this.isPartySelected = this.party.value !== this.constants.PleaseSelect; - this.setupHearingRoles(this.party.value); - } - onRoleSelected($event) { $event.stopImmediatePropagation(); this.roleSelected(); @@ -479,8 +452,6 @@ export class AddParticipantComponent extends AddParticipantBaseDirective impleme newParticipant.last_name = this.lastName.value; newParticipant.phone = this.phone.value; newParticipant.title = this.title.value === this.constants.PleaseSelect ? null : this.title.value; - newParticipant.case_role_name = this.party.value; - newParticipant.case_role_name = null; newParticipant.hearing_role_name = this.role.value; newParticipant.hearing_role_code = this.hearingRoles.find(h => h.name === this.role.value)?.code; @@ -617,7 +588,6 @@ export class AddParticipantComponent extends AddParticipantBaseDirective impleme this.enableFields(); this.form.setValue({ role: this.constants.PleaseSelect, - party: this.constants.PleaseSelect, title: this.constants.PleaseSelect, firstName: '', lastName: '', diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/assign-judge/assign-judge.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/assign-judge/assign-judge.component.spec.ts index 9a6587039..9241b9819 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/assign-judge/assign-judge.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/assign-judge/assign-judge.component.spec.ts @@ -573,7 +573,6 @@ describe('AssignJudgeComponent', () => { expect(component.courtAccountJudgeEmail).toEqual(judge.username); expect(component.judgeDisplayNameFld.value).toEqual(judge.display_name); expect(updatedJudges[0]).toBe(judge); - expect(updatedJudges[0].case_role_name).toBeNull(); expect(updatedJudges[0].hearing_role_code).toBe(Constants.HearingRoleCodes.Judge); expect(component.canNavigate).toBe(true); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/assign-judge/assign-judge.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/assign-judge/assign-judge.component.ts index c36afcb37..e23a1ff92 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/assign-judge/assign-judge.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/assign-judge/assign-judge.component.ts @@ -348,7 +348,6 @@ export class AssignJudgeComponent extends BookingBaseComponent implements OnInit if (!this.isExistingJudge(judge)) { if (this.hearingService.canAddJudge(judge.username)) { judge.is_judge = true; - judge.case_role_name = null; judge.hearing_role_code = Constants.HearingRoleCodes.Judge; judge.hearing_role_name = 'Judge'; this.hearing.participants = this.hearing.participants.filter(x => !x.is_judge); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/create-hearing/create-hearing.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/create-hearing/create-hearing.component.ts index e86461003..3a1283dae 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/create-hearing/create-hearing.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/create-hearing/create-hearing.component.ts @@ -30,7 +30,7 @@ export class CreateHearingComponent extends BookingBaseComponent implements OnIn availableHearingTypes: HearingTypeResponse[]; availableCaseTypes: string[]; selectedCaseType: string; - filteredHearingTypes: HearingTypeResponse[] = []; + selectedCaseTypeServiceId: string; hasSaved: boolean; isExistingHearing: boolean; destroyed$ = new Subject(); @@ -102,6 +102,7 @@ export class CreateHearingComponent extends BookingBaseComponent implements OnIn this.logger.debug(`${this.loggerPrefix} Checking for existing hearing.`); this.selectedCaseType = this.hearing.case_type; + this.selectedCaseTypeServiceId = this.hearing.case_type_service_id; if (this.hearing.case_type) { this.selectedCaseType = this.hearing.case_type; return; @@ -120,12 +121,6 @@ export class CreateHearingComponent extends BookingBaseComponent implements OnIn } } - private setHearingTypeForExistingHearing() { - if (this.hasSaved && this.filteredHearingTypes.length > 0) { - this.form.get('hearingType').setValue(this.hearing.hearing_type_id); - } - } - private initForm() { let firstCase = this.hearing.cases[0]; if (!firstCase) { @@ -137,12 +132,11 @@ export class CreateHearingComponent extends BookingBaseComponent implements OnIn firstCase.number, [Validators.required, Validators.pattern(Constants.TextInputPattern), Validators.maxLength(255)] ], - caseType: [this.selectedCaseType, [Validators.required, Validators.pattern('^((?!Please select).)*$')]], - hearingType: [this.hearing.hearing_type_id, []] + caseType: [this.selectedCaseType, [Validators.required, Validators.pattern('^((?!Please select).)*$')]] }); if (this.isExistingHearingOrParticipantsAdded()) { - ['caseType', 'hearingType'].forEach(k => { + ['caseType'].forEach(k => { this.form.get(k).disable(); }); } @@ -161,9 +155,6 @@ export class CreateHearingComponent extends BookingBaseComponent implements OnIn get caseType() { return this.form.get('caseType'); } - get hearingType() { - return this.form.get('hearingType'); - } get caseNameInvalid() { return this.caseName.invalid && (this.caseName.dirty || this.caseName.touched || this.failedSubmission); @@ -177,10 +168,6 @@ export class CreateHearingComponent extends BookingBaseComponent implements OnIn return this.caseType.invalid && (this.caseType.dirty || this.caseType.touched || this.failedSubmission); } - get hearingTypeInvalid() { - return this.hearingType.invalid && (this.hearingType.dirty || this.hearingType.touched || this.failedSubmission); - } - get canEditCaseName() { if (this.hearing.isMultiDayEdit) { return false; @@ -264,14 +251,7 @@ export class CreateHearingComponent extends BookingBaseComponent implements OnIn hearingCase.number = this.form.value.caseNumber; this.hearing.cases[0] = hearingCase; this.hearing.case_type_id = this.isExistingHearing ? this.hearing.case_type_id : this.form.getRawValue().caseType; - this.hearing.hearing_type_id = this.isExistingHearing ? this.hearing.hearing_type_id : this.form.getRawValue().hearingType; - const hearingType = this.availableHearingTypes.find(c => c.id === this.hearing.hearing_type_id); - // hearing type will be null if editing an expired hearing type - this.hearing.hearing_type_name = hearingType?.name ?? this.hearing.hearing_type_name; - this.hearing.hearing_type_code = hearingType?.code ?? this.hearing.hearing_type_code; - const hearingTypeGroup = this.availableHearingTypes.find(c => c.group === this.hearing.case_type); - // hearing type group will be null if editing an expired case type - this.hearing.case_type_service_id = hearingTypeGroup?.service_id ?? this.hearing.case_type_service_id; + this.hearing.case_type_service_id = this.selectedCaseTypeServiceId; this.hearing.supplier = this.form.getRawValue().supplier ?? this.retrieveDefaultSupplier(); this.hearingService.updateHearingRequest(this.hearing); this.logger.debug(`${this.loggerPrefix} Updated hearing request details`, { hearing: this.hearing }); @@ -282,8 +262,6 @@ export class CreateHearingComponent extends BookingBaseComponent implements OnIn this.hearingService.getHearingTypes().subscribe({ next: (data: HearingTypeResponse[]) => { this.setupCaseTypeAndHearingTypes(data); - this.filterHearingTypes(); - this.setHearingTypeForExistingHearing(); }, error: error => this.errorService.handleError(error) }); @@ -299,11 +277,10 @@ export class CreateHearingComponent extends BookingBaseComponent implements OnIn this.logger.debug(`${this.loggerPrefix} Updating selected case type`, { caseType: this.selectedCaseType }); - const serviceId = hearingTypes.find(h => h.group === this.selectedCaseType)?.service_id; - if (this.supportedSupplierOverrides.serviceIds.includes(serviceId)) { + this.selectedCaseTypeServiceId = hearingTypes.find(h => h.group === this.selectedCaseType)?.service_id; + if (this.supportedSupplierOverrides.serviceIds.includes(this.selectedCaseTypeServiceId)) { this.displayOverrideSupplier = true; } - this.filterHearingTypes(); this.displaySupplierOverrideIfSupported(); }); @@ -337,22 +314,6 @@ export class CreateHearingComponent extends BookingBaseComponent implements OnIn } } - private filterHearingTypes() { - this.filteredHearingTypes = []; - if (this.selectedCaseType) { - this.filteredHearingTypes = this.availableHearingTypes.filter(h => h.group === this.selectedCaseType); - } - this.logger.debug(`${this.loggerPrefix} Filtering hearing types for case type`, { - caseType: this.selectedCaseType, - hearingTypes: this.filteredHearingTypes.length - }); - const pleaseSelect = new HearingTypeResponse(); - pleaseSelect.name = Constants.PleaseSelect; - pleaseSelect.id = null; - this.filteredHearingTypes.unshift(pleaseSelect); - this.hearingType.setValue(null); - } - private cancelBookingInCreateMode() { if (this.form.dirty || this.form.touched) { this.logger.debug(`${this.loggerPrefix} New booking. Changes found. Confirm if changes should be discarded.`); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.spec.ts index 89a9c0e83..7d8fba464 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/endpoints/endpoints.component.spec.ts @@ -16,7 +16,6 @@ import { FeatureFlagDirective } from 'src/app/src/app/shared/feature-flag.direct function initHearingRequest(): HearingModel { const newHearing = new HearingModel(); - newHearing.hearing_type_id = -1; newHearing.hearing_venue_id = -1; newHearing.scheduled_duration = 0; newHearing.participants = [ diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.html b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.html index 57b452051..78c305e14 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.html +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.html @@ -69,9 +69,6 @@
{{ participant.representee }}
-
- {{ participant.case_role_name }} -
@@ -81,9 +78,6 @@ {{ participant.interpretee_name }} -
- {{ participant.case_role_name }} -
@@ -95,17 +89,11 @@ {{ participant.interpretee_name }} -
- {{ participant.case_role_name }} -
{{ participant.hearing_role_name }}
-
- {{ participant.case_role_name }} -
diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.spec.ts index f6acee6dd..c3532de09 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.spec.ts @@ -165,18 +165,6 @@ describe('ParticipantItemComponent', () => { expect(component.isStaffMember).toBeFalsy(); }); - it('should return false if participant`s case role is None', () => { - component.participant = { - case_role_name: 'None', - is_judge: true, - is_exist_person: false, - isJudiciaryMember: false, - interpretation_language: undefined - }; - fixture.detectChanges(); - expect(component.hasCaseRole).toBeFalsy(); - }); - it('should return true if participant is an observer', () => { component.participant = { hearing_role_name: 'Observer', @@ -200,23 +188,9 @@ describe('ParticipantItemComponent', () => { fixture.detectChanges(); expect(component.isObserverOrPanelMember).toBeTruthy(); }); - - it('should return true if participant has a case role and is not a Panel Member', () => { - component.participant = { - hearing_role_name: 'Judge', - case_role_name: 'Judge', - is_judge: true, - is_exist_person: false, - isJudiciaryMember: false, - interpretation_language: undefined - }; - fixture.detectChanges(); - expect(component.displayCaseRole).toBeTruthy(); - }); it('should get judge email', () => { component.participant = { hearing_role_name: 'Judge', - case_role_name: 'Judge', is_judge: true, is_exist_person: false, isJudiciaryMember: false, @@ -228,7 +202,6 @@ describe('ParticipantItemComponent', () => { it('should get judge phone', () => { component.participant = { hearing_role_name: 'Judge', - case_role_name: 'Judge', is_judge: true, is_exist_person: false, isJudiciaryMember: false, diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.ts index 141a14b54..6d4dc0708 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/item/participant-item.component.ts @@ -103,10 +103,6 @@ export class ParticipantItemComponent implements OnInit { return this.participant?.hearing_role_name === Constants.HearingRoles.StaffMember; } - get hasCaseRole() { - return this.participant?.case_role_name !== 'None'; - } - get isObserverOrPanelMember() { return ( ['Observer', 'Panel Member'].includes(this.participant?.hearing_role_name) || @@ -114,10 +110,6 @@ export class ParticipantItemComponent implements OnInit { ); } - get displayCaseRole() { - return this.hasCaseRole && !this.isObserverOrPanelMember; - } - get isInterpreter() { return this.participant.hearing_role_name === 'Interpreter' || this.participant.hearing_role_code === HearingRoleCodes.Interpreter; } diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.spec.ts index d7090aacd..001340667 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.spec.ts @@ -400,47 +400,41 @@ describe('ParticipantListComponent-SortParticipants', () => { it('should produce a sorted list with specific hierarchy and grouping', () => { const participantsArr = [ - { is_judge: true, case_role_name: null, hearing_role_name: 'Judge', first_name: 'L' }, - { is_judge: false, case_role_name: 'Winger', hearing_role_name: 'None', first_name: 'K' }, - { is_judge: false, case_role_name: 'None', hearing_role_name: 'Winger', first_name: 'J' }, - { is_judge: false, case_role_name: null, hearing_role_name: 'Staff Member', first_name: 'I' }, - { is_judge: false, case_role_name: 'None', hearing_role_name: 'Panel Member', first_name: 'H' }, - { is_judge: false, case_role_name: 'None', hearing_role_name: 'Observer', first_name: 'G' }, + { is_judge: true, hearing_role_name: 'Judge', first_name: 'L' }, + { is_judge: false, hearing_role_name: 'None', first_name: 'K' }, + { is_judge: false, hearing_role_name: 'Winger', first_name: 'J' }, + { is_judge: false, hearing_role_name: 'Staff Member', first_name: 'I' }, + { is_judge: false, hearing_role_name: 'Panel Member', first_name: 'H' }, + { is_judge: false, hearing_role_name: 'Observer', first_name: 'G' }, { is_judge: false, - case_role_name: 'Appellant', hearing_role_name: 'Litigant in Person', first_name: 'F' }, - { is_judge: false, case_role_name: 'None', hearing_role_name: 'Litigant in Person', first_name: 'E' }, + { is_judge: false, hearing_role_name: 'Litigant in Person', first_name: 'E' }, { is_judge: false, - case_role_name: 'Appellant', hearing_role_name: 'Litigant in Person', first_name: 'D' }, { is_judge: false, - case_role_name: 'Appellant', email: 'interpretees@email.co.uk', hearing_role_name: 'Litigant in Person', first_name: 'C' }, - { is_judge: false, case_role_name: 'None', hearing_role_name: 'Litigant in Person', first_name: 'B' }, + { is_judge: false, hearing_role_name: 'Litigant in Person', first_name: 'B' }, { is_judge: false, - case_role_name: 'Appellant', hearing_role_name: 'Litigant in Person', first_name: 'A' }, { is_judge: false, - case_role_name: 'None', hearing_role_name: 'Interpreter', first_name: 'A', interpreterFor: 'interpretees@email.co.uk' - }, - { is_judge: false, case_role_name: 'Observer', hearing_role_name: 'new observer type', first_name: 'M' } + } ]; if (!component.hearing.participants) { @@ -451,7 +445,6 @@ describe('ParticipantListComponent-SortParticipants', () => { is_judge: p.is_judge, hearing_role_name: p.hearing_role_name, first_name: p.first_name, - case_role_name: p.case_role_name, email: p.email, interpreterFor: p.interpreterFor, interpretation_language: undefined @@ -463,7 +456,6 @@ describe('ParticipantListComponent-SortParticipants', () => { const expectedResult: ParticipantModel[] = []; expectedResult.push({ is_judge: true, - case_role_name: null, email: undefined, hearing_role_name: 'Judge', first_name: 'L', @@ -472,7 +464,6 @@ describe('ParticipantListComponent-SortParticipants', () => { }); expectedResult.push({ is_judge: false, - case_role_name: 'None', email: undefined, hearing_role_name: 'Panel Member', first_name: 'H', @@ -481,43 +472,42 @@ describe('ParticipantListComponent-SortParticipants', () => { }); expectedResult.push({ is_judge: false, - case_role_name: 'None', email: undefined, hearing_role_name: 'Winger', first_name: 'J', interpreterFor: undefined, interpretation_language: undefined }); + expectedResult.push({ is_judge: false, - case_role_name: 'Winger', email: undefined, - hearing_role_name: 'None', - first_name: 'K', + hearing_role_name: 'Staff Member', + first_name: 'I', interpreterFor: undefined, interpretation_language: undefined }); + expectedResult.push({ is_judge: false, - case_role_name: null, email: undefined, - hearing_role_name: 'Staff Member', - first_name: 'I', + hearing_role_name: 'Litigant in Person', + first_name: 'A', interpreterFor: undefined, interpretation_language: undefined }); + expectedResult.push({ is_judge: false, - case_role_name: 'Appellant', email: undefined, hearing_role_name: 'Litigant in Person', - first_name: 'A', + first_name: 'B', interpreterFor: undefined, interpretation_language: undefined }); + expectedResult.push({ is_judge: false, - case_role_name: 'Appellant', email: 'interpretees@email.co.uk', hearing_role_name: 'Litigant in Person', first_name: 'C', @@ -527,7 +517,6 @@ describe('ParticipantListComponent-SortParticipants', () => { }); expectedResult.push({ is_judge: false, - case_role_name: 'None', email: undefined, hearing_role_name: 'Interpreter', first_name: 'A', @@ -535,60 +524,48 @@ describe('ParticipantListComponent-SortParticipants', () => { interpretee_name: undefined, interpretation_language: undefined }); + expectedResult.push({ is_judge: false, - case_role_name: 'Appellant', email: undefined, hearing_role_name: 'Litigant in Person', first_name: 'D', interpreterFor: undefined, interpretation_language: undefined }); + expectedResult.push({ is_judge: false, - case_role_name: 'Appellant', email: undefined, hearing_role_name: 'Litigant in Person', - first_name: 'F', + first_name: 'E', interpreterFor: undefined, interpretation_language: undefined }); expectedResult.push({ is_judge: false, - case_role_name: 'None', email: undefined, hearing_role_name: 'Litigant in Person', - first_name: 'B', + first_name: 'F', interpreterFor: undefined, interpretation_language: undefined }); expectedResult.push({ is_judge: false, - case_role_name: 'None', email: undefined, - hearing_role_name: 'Litigant in Person', - first_name: 'E', + hearing_role_name: 'None', + first_name: 'K', interpreterFor: undefined, interpretation_language: undefined }); expectedResult.push({ is_judge: false, - case_role_name: 'None', email: undefined, hearing_role_name: 'Observer', first_name: 'G', interpreterFor: undefined, interpretation_language: undefined }); - expectedResult.push({ - is_judge: false, - case_role_name: 'Observer', - email: undefined, - hearing_role_name: 'new observer type', - first_name: 'M', - interpreterFor: undefined, - interpretation_language: undefined - }); for (let i = 0; i < expectedResult.length; i++) { expect(component.sortedParticipants[i]).toEqual(expectedResult[i]); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.ts index 25061581f..f573170b9 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/participant/list/participant-list.component.ts @@ -155,15 +155,15 @@ export class ParticipantListComponent implements OnInit, OnChanges, DoCheck, OnD }; } - private compareByPartyThenByFirstName() { + private compareByHearingRoleThenByFirstName() { return (a: ParticipantModel, b: ParticipantModel) => { const swapIndices = a > b ? 1 : 0; - const partyA = a.case_role_name === Constants.None ? a.hearing_role_name ?? a.hearing_role_code : a.case_role_name; - const partyB = b.case_role_name === Constants.None ? b.hearing_role_name ?? b.hearing_role_code : b.case_role_name; - if (partyA === partyB) { + const hearingRoleCodeA = a.hearing_role_code; + const hearingRoleCodeB = b.hearing_role_code; + if (hearingRoleCodeA === hearingRoleCodeB) { return a.first_name < b.first_name ? -1 : swapIndices; } - return partyA < partyB ? -1 : swapIndices; + return hearingRoleCodeA < hearingRoleCodeB ? -1 : swapIndices; }; } @@ -189,17 +189,13 @@ export class ParticipantListComponent implements OnInit, OnChanges, DoCheck, OnD (!participant.hearing_role_name || participant.hearing_role_name !== Constants.HearingRoles.Interpreter) && (!participant.hearing_role_code || participant.hearing_role_code !== HearingRoleCodes.Interpreter) ) - .sort(this.compareByPartyThenByFirstName()); + .sort(this.compareByHearingRoleThenByFirstName()); } private getObservers() { return this.hearing.participants - .filter( - participant => - Constants.HearingRoles.Observer === - (participant.case_role_name === Constants.None ? participant.hearing_role_name : participant.case_role_name) - ) - .sort(this.compareByPartyThenByFirstName()); + .filter(participant => Constants.HearingRoles.Observer === participant.hearing_role_name) + .sort(this.compareByHearingRoleThenByFirstName()); } private getJudicialPanelMembers(): ParticipantModel[] { @@ -213,22 +209,18 @@ export class ParticipantListComponent implements OnInit, OnChanges, DoCheck, OnD private getPanelMembers() { return this.hearing.participants - .filter(participant => - Constants.JudiciaryRoles.includes( - participant.case_role_name === Constants.None ? participant.hearing_role_name : participant.case_role_name - ) - ) - .sort(this.compareByPartyThenByFirstName()); + .filter(participant => Constants.JudiciaryRoles.includes(participant.hearing_role_name)) + .sort(this.compareByHearingRoleThenByFirstName()); } private getStaffMembers() { return this.hearing.participants .filter(participant => participant.hearing_role_name === Constants.HearingRoles.StaffMember) - .sort(this.compareByPartyThenByFirstName()); + .sort(this.compareByHearingRoleThenByFirstName()); } private getJudges() { - return this.hearing.participants.filter(participant => participant.is_judge).sort(this.compareByPartyThenByFirstName()); + return this.hearing.participants.filter(participant => participant.is_judge).sort(this.compareByHearingRoleThenByFirstName()); } private insertInterpreters(sortedList: ParticipantModel[]) { diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/search-email/search-email.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/search-email/search-email.component.spec.ts index 475c38366..ed98b60a8 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/search-email/search-email.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/search-email/search-email.component.spec.ts @@ -40,7 +40,6 @@ describe('SearchEmailComponent', () => { participantModel.first_name = 'Ann'; participantModel.last_name = 'Smith'; participantModel.title = 'Mrs'; - participantModel.case_role_name = 'Respondent'; participantModel.hearing_role_name = 'Litigant in person'; participantModel.phone = '12345678'; participantModel.display_name = 'Ann'; @@ -185,7 +184,6 @@ describe('SearchEmailComponent', () => { participant.first_name = 'citizen'; participant.last_name = 'one'; participantModel.title = 'Mr.'; - participantModel.case_role_name = 'Respondent'; participantModel.hearing_role_name = 'Litigant in person'; participantModel.phone = '12345678'; participantModel.display_name = 'Citizen One'; diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/search-email/search-email.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/search-email/search-email.component.ts index 74324a729..5b0ecdf76 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/search-email/search-email.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/search-email/search-email.component.ts @@ -37,8 +37,6 @@ export class SearchEmailComponent implements OnInit, OnDestroy { @Input() disabled = true; - @Input() caseRole = ''; - @Input() hearingRoleParticipant = ''; @Input() initialValue = ''; diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/services/participant.service.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/services/participant.service.spec.ts index 9dce15775..1d1ea6ae5 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/services/participant.service.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/services/participant.service.spec.ts @@ -1,7 +1,7 @@ import { TestBed, inject } from '@angular/core/testing'; import { ParticipantService } from './participant.service'; import { HttpClientModule } from '@angular/common/http'; -import { CaseAndHearingRolesResponse, HearingRole, HearingRoleResponse } from '../../services/clients/api-client'; +import { HearingRoleResponse } from '../../services/clients/api-client'; import { ParticipantModel } from '../../common/model/participant.model'; import { HearingModel } from '../../common/model/hearing.model'; import { Logger } from '../../services/logger'; @@ -20,26 +20,6 @@ describe('ParticipantService', () => { it('should be created', inject([ParticipantService], (service: ParticipantService) => { expect(service).toBeTruthy(); })); - it('should map roles to party model array', inject([ParticipantService], (service: ParticipantService) => { - const response = new CaseAndHearingRolesResponse(); - response.name = 'Respondent'; - response.hearing_roles = [new HearingRole({ name: 'Litigant in person', user_role: 'Individual' })]; - const responses: CaseAndHearingRolesResponse[] = []; - responses.push(response); - - const models = service.mapParticipantsRoles(responses); - expect(models).toBeTruthy(); - expect(models.length).toBe(1); - expect(models[0].name).toBe('Respondent'); - expect(models[0].hearingRoles.length).toBe(1); - expect(models[0].hearingRoles[0].name).toBe('Litigant in person'); - })); - it('should return empty party model array', inject([ParticipantService], (service: ParticipantService) => { - const responses: CaseAndHearingRolesResponse[] = []; - const models = service.mapParticipantsRoles(responses); - expect(models).toBeTruthy(); - expect(models.length).toBe(0); - })); it('should map roles to hearing role array', inject([ParticipantService], (service: ParticipantService) => { const responses: HearingRoleResponse[] = [ new HearingRoleResponse({ diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/services/participant.service.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/services/participant.service.ts index 4a20f31b3..13d8aa3da 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/services/participant.service.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/services/participant.service.ts @@ -1,8 +1,7 @@ import { Injectable } from '@angular/core'; import { HearingModel } from '../../common/model/hearing.model'; import { ParticipantModel } from '../../common/model/participant.model'; -import { PartyModel } from '../../common/model/party.model'; -import { CaseAndHearingRolesResponse, HearingRoleResponse } from '../../services/clients/api-client'; +import { HearingRoleResponse } from '../../services/clients/api-client'; import { Logger } from '../../services/logger'; import { HearingRoleModel } from '../../common/model/hearing-role.model'; @@ -13,18 +12,8 @@ export class ParticipantService { private readonly loggerPrefix = '[ParticipantService] -'; constructor(private readonly logger: Logger) {} - mapParticipantsRoles(caseRoles: CaseAndHearingRolesResponse[]) { - const participantRoles = caseRoles.map(s => { - const item = new PartyModel(s.name); - item.hearingRoles = s.hearing_roles.map(x => new HearingRoleModel(x.name, x.user_role)); - return item; - }); - return participantRoles; - } - mapParticipantHearingRoles(hearingRoles: HearingRoleResponse[]) { - const participantRoles = hearingRoles.map(x => new HearingRoleModel(x.name, x.user_role, x.code)); - return participantRoles; + return hearingRoles.map(x => new HearingRoleModel(x.name, x.user_role, x.code)); } public checkDuplication(email: string, participants: ParticipantModel[]): boolean { diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.html b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.html index ae713e7a0..6d332c80f 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.html +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.html @@ -32,7 +32,6 @@

{{ caseType }}
-
{{ caseHearingType }}
diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.spec.ts index 08fb80aa1..b00394abf 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.spec.ts @@ -54,7 +54,6 @@ function initExistingHearingRequest(): HearingModel { newCaseRequest.number = 'TX/12345/2018'; const existingRequest = new HearingModel(); - existingRequest.hearing_type_id = 2; existingRequest.cases.push(newCaseRequest); existingRequest.hearing_venue_id = 2; existingRequest.scheduled_date_time = today; @@ -62,8 +61,6 @@ function initExistingHearingRequest(): HearingModel { existingRequest.other_information = '|OtherInformation|some notes'; existingRequest.audio_recording_required = true; existingRequest.court_room = '123W'; - const hearingTypeName = MockValues.HearingTypesList.find(c => c.id === existingRequest.hearing_type_id).name; - existingRequest.hearing_type_name = hearingTypeName; const courtString = MockValues.Courts.find(c => c.id === existingRequest.hearing_venue_id).name; existingRequest.court_name = courtString; existingRequest.isMultiDayEdit = false; @@ -89,7 +86,6 @@ function initBadHearingRequest(): HearingModel { newCaseRequest.number = 'TX/12345/2018'; const existingRequest = new HearingModel(); - existingRequest.hearing_type_id = 2; existingRequest.cases.push(newCaseRequest); existingRequest.hearing_venue_id = 2; existingRequest.scheduled_date_time = today; @@ -277,8 +273,6 @@ describe('SummaryComponent with valid request', () => { expect(component.otherInformation.OtherInformation).toEqual( stringifier.decode(existingRequest.other_information).OtherInformation ); - const hearingstring = MockValues.HearingTypesList.find(c => c.id === existingRequest.hearing_type_id).name; - expect(component.caseHearingType).toEqual(hearingstring); expect(component.hearingDate).toEqual(existingRequest.scheduled_date_time); const courtString = MockValues.Courts.find(c => c.id === existingRequest.hearing_venue_id); expect(component.courtRoomAddress).toEqual(`${courtString.name}, 123W`); @@ -378,7 +372,6 @@ describe('SummaryComponent with valid request', () => { participant.first_name = 'firstname'; participant.last_name = 'lastname'; participant.email = 'firstname.lastname@email.com'; - participant.case_role_name = 'Claimant'; participant.hearing_role_name = 'Litigant in person'; participants.push(participant); @@ -386,7 +379,6 @@ describe('SummaryComponent with valid request', () => { participant.first_name = 'firstname1'; participant.last_name = 'lastname1'; participant.email = 'firstname1.lastname1@email.com'; - participant.case_role_name = 'Claimant'; participant.hearing_role_name = 'Interpreter'; participant.interpreterFor = 'firstname.lastname@email.com'; participants.push(participant); @@ -414,7 +406,6 @@ describe('SummaryComponent with valid request', () => { participant.first_name = 'firstname'; participant.last_name = 'lastname'; participant.email = 'firstname.lastname@email.com'; - participant.case_role_name = 'Claimant'; participant.hearing_role_name = 'Litigant in person'; participants.push(participant); @@ -422,7 +413,6 @@ describe('SummaryComponent with valid request', () => { participant.first_name = 'firstname1'; participant.last_name = 'lastname1'; participant.email = 'firstname1.lastname1@email.com'; - participant.case_role_name = 'Claimant'; participant.hearing_role_name = 'Interpreter'; participant.interpreterFor = 'firstname.lastname@email.com'; participants.push(participant); @@ -758,7 +748,6 @@ describe('SummaryComponent with existing request', () => { fixture.detectChanges(); expect(component.caseNumber).toBe('TX/12345/2018'); expect(component.caseName).toBe('Mr. Test User vs HMRC'); - expect(component.caseHearingType).toBe('Automated Test'); expect(component.courtRoomAddress).toBeTruthy(); expect(component.hearingDuration).toBe('listed for 1 hour 20 minutes'); }); @@ -888,7 +877,6 @@ describe('SummaryComponent with existing request', () => { participant.first_name = 'firstname'; participant.last_name = 'lastname'; participant.email = 'firstname.lastname@email.com'; - participant.case_role_name = 'Claimant'; participant.hearing_role_name = 'Litigant in person'; participant.id = '100'; participant.linked_participants = linkedParticipants; @@ -903,7 +891,6 @@ describe('SummaryComponent with existing request', () => { participant.first_name = 'firstname1'; participant.last_name = 'lastname1'; participant.email = 'firstname1.lastname1@email.com'; - participant.case_role_name = 'Claimant'; participant.hearing_role_name = 'Interpreter'; participant.interpreterFor = ''; participant.id = '200'; @@ -986,7 +973,6 @@ describe('SummaryComponent with multi days request', () => { participant.first_name = 'firstname'; participant.last_name = 'lastname'; participant.email = 'firstname.lastname@email.com'; - participant.case_role_name = 'Claimant'; participant.hearing_role_name = 'Litigant in person'; participant.id = '100'; participant.linked_participants = linkedParticipants; @@ -1001,7 +987,6 @@ describe('SummaryComponent with multi days request', () => { participant.first_name = 'firstname1'; participant.last_name = 'lastname1'; participant.email = 'firstname1.lastname1@email.com'; - participant.case_role_name = 'Claimant'; participant.hearing_role_name = 'Interpreter'; participant.interpreterFor = ''; participant.id = '200'; diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts index b6ec257ca..08836d97b 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/booking/summary/summary.component.ts @@ -43,7 +43,6 @@ export class SummaryComponent implements OnInit, OnDestroy { bookingsSaving = false; caseNumber: string; caseName: string; - caseHearingType: string; hearingDate: Date; courtRoomAddress: string; hearingDuration: string; @@ -222,7 +221,6 @@ export class SummaryComponent implements OnInit, OnDestroy { private retrieveHearingSummary() { this.caseNumber = this.hearing.cases.length > 0 ? this.hearing.cases[0].number : ''; this.caseName = this.hearing.cases.length > 0 ? this.hearing.cases[0].name : ''; - this.caseHearingType = this.hearing.hearing_type_name; this.hearingDate = this.hearing.scheduled_date_time; this.hearingDuration = `listed for ${FormatShortDuration(this.hearing.scheduled_duration)}`; this.courtRoomAddress = this.formatCourtRoom(this.hearing.court_name, this.hearing.court_room); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-details/booking-details.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-details/booking-details.component.spec.ts index dfbc80408..1abf05474 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-details/booking-details.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-details/booking-details.component.spec.ts @@ -41,7 +41,6 @@ export class BookingDetailsTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', '', '33A', 'Coronation Street', @@ -73,7 +72,6 @@ export class BookingDetailsTestData { 'Judge', 'email.p1@hmcts.net', 'email1@hmcts.net', - 'Applicant', 'Representative', HearingRoleCodes.Representative, 'Alan Brake', @@ -94,7 +92,6 @@ export class BookingDetailsTestData { 'Citizen', 'email.p2@hmcts.net', 'email2@hmcts.net', - 'Applicant', 'Litigant in person', HearingRoleCodes.Applicant, 'Roy Bark', @@ -115,7 +112,6 @@ export class BookingDetailsTestData { 'Professional', 'email.p3@hmcts.net', 'email3@hmcts.net', - 'Respondent', 'Litigant in person', HearingRoleCodes.Respondent, 'Fill', diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-participant-list/booking-participant-list.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-participant-list/booking-participant-list.component.spec.ts index ee2936c89..90f99d688 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-participant-list/booking-participant-list.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-participant-list/booking-participant-list.component.spec.ts @@ -42,7 +42,6 @@ describe('BookingParticipantListComponent', () => { 'Citizen', 'email.p1@hmcts.net', 'email1@hmcts.net', - 'Respondent', 'Litigant in person', HearingRoleCodes.Respondent, 'Alan Brake', @@ -81,7 +80,6 @@ describe('BookingParticipantListComponent', () => { 'email.p1@hmcts.net', 'email1@hmcts.net', 'Judge', - 'Judge', null, 'Alan Brake', '', @@ -118,7 +116,6 @@ describe('BookingParticipantListComponent', () => { isJudge: p.isJudge ?? false, HearingRoleCode: p.HearingRoleCode, HearingRoleName: p.HearingRoleName, - CaseRoleName: p.CaseRoleName, LinkedParticipants: p.LinkedParticipants ?? null, ParticipantId: `${i + 1}`, Company: '', @@ -150,9 +147,6 @@ describe('BookingParticipantListComponent', () => { get isRepresenting(): boolean { return undefined; }, - showCaseRole(): boolean { - return false; - }, InterpretationLanguage: null, Screening: null }); @@ -172,48 +166,44 @@ describe('BookingParticipantListComponent', () => { const participantsInputArray = [ { - CaseRoleName: 'Appellant', HearingRoleName: 'Litigant in Person', FirstName: 'C', LinkedParticipants: linked_participantList1, Interpretee: 'interpretee' }, - { CaseRoleName: 'None', HearingRoleName: 'Interpreter', FirstName: 'A', LinkedParticipants: linked_participantList2 }, - { isJudge: true, CaseRoleName: null, HearingRoleName: 'Judge', FirstName: 'L' }, - { CaseRoleName: 'Winger', HearingRoleName: 'None', FirstName: 'K' }, - { CaseRoleName: 'None', HearingRoleName: 'Winger', FirstName: 'J' }, - { CaseRoleName: null, HearingRoleName: 'Staff Member', FirstName: 'I' }, - { CaseRoleName: 'None', HearingRoleName: 'Panel Member', FirstName: 'H' }, - { CaseRoleName: 'None', HearingRoleName: 'Observer', FirstName: 'G' }, - { CaseRoleName: 'Appellant', HearingRoleName: 'Litigant in Person', FirstName: 'F' }, - { CaseRoleName: 'None', HearingRoleName: 'Litigant in Person', FirstName: 'E' }, - { CaseRoleName: 'Appellant', HearingRoleName: 'Litigant in Person', FirstName: 'D' }, - { CaseRoleName: 'None', HearingRoleName: 'Litigant in Person', FirstName: 'B' }, - { CaseRoleName: 'Appellant', HearingRoleName: 'Litigant in Person', FirstName: 'A' }, - { CaseRoleName: 'Observer', HearingRoleName: 'new observer type', FirstName: 'M' } + { HearingRoleName: 'Interpreter', FirstName: 'A', LinkedParticipants: linked_participantList2 }, + { isJudge: true, HearingRoleName: 'Judge', FirstName: 'L' }, + { HearingRoleName: 'Winger', FirstName: 'J' }, + { HearingRoleName: 'Staff Member', FirstName: 'I' }, + { HearingRoleName: 'Panel Member', FirstName: 'H' }, + { HearingRoleName: 'Observer', FirstName: 'G' }, + { HearingRoleName: 'Litigant in Person', FirstName: 'F' }, + { HearingRoleName: 'Litigant in Person', FirstName: 'E' }, + { HearingRoleName: 'Litigant in Person', FirstName: 'D' }, + { HearingRoleName: 'Litigant in Person', FirstName: 'B' }, + { HearingRoleName: 'Litigant in Person', FirstName: 'A' }, + { HearingRoleName: 'Other role', FirstName: 'M' } ]; component.participants = parseTestInput(participantsInputArray); // expected output const expectedOutput = [ - { CaseRoleName: null, HearingRoleName: 'Judge', FirstName: 'L' }, - { CaseRoleName: 'None', HearingRoleName: 'Panel Member', FirstName: 'H' }, - { CaseRoleName: 'None', HearingRoleName: 'Winger', FirstName: 'J' }, - { CaseRoleName: 'Winger', HearingRoleName: 'None', FirstName: 'K' }, - { CaseRoleName: null, HearingRoleName: 'Staff Member', FirstName: 'I' }, - { CaseRoleName: 'Appellant', HearingRoleName: 'Litigant in Person', FirstName: 'A' }, - { CaseRoleName: 'Appellant', HearingRoleName: 'Litigant in Person', FirstName: 'C' }, - { CaseRoleName: 'None', HearingRoleName: 'Interpreter', FirstName: 'A' }, - { CaseRoleName: 'Appellant', HearingRoleName: 'Litigant in Person', FirstName: 'D' }, - { CaseRoleName: 'Appellant', HearingRoleName: 'Litigant in Person', FirstName: 'F' }, - { CaseRoleName: 'None', HearingRoleName: 'Litigant in Person', FirstName: 'B' }, - { CaseRoleName: 'None', HearingRoleName: 'Litigant in Person', FirstName: 'E' }, - { CaseRoleName: 'None', HearingRoleName: 'Observer', FirstName: 'G' }, - { CaseRoleName: 'Observer', HearingRoleName: 'new observer type', FirstName: 'M' } + { HearingRoleName: 'Judge', FirstName: 'L' }, + { HearingRoleName: 'Panel Member', FirstName: 'H' }, + { HearingRoleName: 'Winger', FirstName: 'J' }, + { HearingRoleName: 'Staff Member', FirstName: 'I' }, + { HearingRoleName: 'Litigant in Person', FirstName: 'A' }, + { HearingRoleName: 'Litigant in Person', FirstName: 'B' }, + { HearingRoleName: 'Litigant in Person', FirstName: 'C' }, + { HearingRoleName: 'Interpreter', FirstName: 'A' }, + { HearingRoleName: 'Litigant in Person', FirstName: 'D' }, + { HearingRoleName: 'Litigant in Person', FirstName: 'E' }, + { HearingRoleName: 'Litigant in Person', FirstName: 'F' }, + { HearingRoleName: 'Other role', FirstName: 'M' }, + { HearingRoleName: 'Observer', FirstName: 'G' } ]; for (let i = 0; i < expectedOutput.length; i++) { expect(component.sortedParticipants[i].FirstName).toEqual(expectedOutput[i].FirstName); - expect(component.sortedParticipants[i].CaseRoleName).toEqual(expectedOutput[i].CaseRoleName); expect(component.sortedParticipants[i].HearingRoleName).toEqual(expectedOutput[i].HearingRoleName); } done(); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-participant-list/booking-participant-list.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-participant-list/booking-participant-list.component.ts index ea49de937..1c914eb93 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-participant-list/booking-participant-list.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/booking-participant-list/booking-participant-list.component.ts @@ -3,7 +3,6 @@ import { ParticipantDetailsModel } from '../../common/model/participant-details. import { JudiciaryParticipantDetailsModel } from 'src/app/common/model/judiciary-participant-details.model'; import { BookingsDetailsModel } from '../../common/model/bookings-list.model'; import { Constants } from '../../common/constants'; -import {} from 'src/app/common/model/participant.model'; @Component({ selector: 'app-booking-participant-list', @@ -45,30 +44,22 @@ export class BookingParticipantListComponent { } private sortParticipants() { - const compareByPartyThenByFirstName = () => (a, b) => { + const compareByHearingRoleThenByFirstName = () => (a: ParticipantDetailsModel, b: ParticipantDetailsModel) => { const swapIndices = a > b ? 1 : 0; - const partyA = a.CaseRoleName === Constants.None ? a.HearingRoleName : a.CaseRoleName; - const partyB = b.CaseRoleName === Constants.None ? b.HearingRoleName : b.CaseRoleName; - if (partyA === partyB) { + const hearingRoleA = a.HearingRoleName; + const hearingRoleB = b.HearingRoleName; + if (hearingRoleA === hearingRoleB) { return a.FirstName < b.FirstName ? -1 : swapIndices; } - return partyA < partyB ? -1 : swapIndices; + return hearingRoleA < hearingRoleB ? -1 : swapIndices; }; const judges = this.participants.filter(participant => participant.HearingRoleName === Constants.Judge); const staffMember = this.participants.filter(participant => participant.HearingRoleName === Constants.HearingRoles.StaffMember); const panelMembersAndWingers = this.participants - .filter(participant => - Constants.JudiciaryRoles.includes( - participant.CaseRoleName === Constants.None ? participant.HearingRoleName : participant.CaseRoleName - ) - ) - .sort(compareByPartyThenByFirstName()); + .filter(participant => Constants.JudiciaryRoles.includes(participant.HearingRoleName)) + .sort(compareByHearingRoleThenByFirstName()); const interpreters = this.participants.filter(participant => participant.isInterpreter); - const observers = this.participants.filter( - participant => - Constants.HearingRoles.Observer === - (participant.CaseRoleName === Constants.None ? participant.HearingRoleName : participant.CaseRoleName) - ); + const observers = this.participants.filter(participant => Constants.HearingRoles.Observer === participant.HearingRoleName); const others = this.participants .filter( participant => @@ -78,7 +69,7 @@ export class BookingParticipantListComponent { !interpreters.includes(participant) && !observers.includes(participant) ) - .sort(compareByPartyThenByFirstName()); + .sort(compareByHearingRoleThenByFirstName()); const sorted = [...judges, ...panelMembersAndWingers, ...staffMember, ...others, ...observers]; this.insertInterpreters(interpreters, sorted); this.sortedParticipants = sorted; diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/bookings-list/bookings-list.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/bookings-list/bookings-list.component.spec.ts index 8670c90e0..d2961b7e8 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/bookings-list/bookings-list.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/bookings-list/bookings-list.component.spec.ts @@ -134,7 +134,6 @@ export class BookingslistTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JudgeGreen', '33A', 'Coronation Street', @@ -158,7 +157,6 @@ export class BookingslistTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JudgeGreen', '33A', 'Coronation Street', @@ -181,7 +179,7 @@ export class BookingslistTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -217,7 +215,7 @@ export class BookingslistTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -240,7 +238,7 @@ export class BookingslistTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -263,7 +261,7 @@ export class BookingslistTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -302,7 +300,7 @@ export class ArrayBookingslistModelTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -325,7 +323,7 @@ export class ArrayBookingslistModelTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -348,7 +346,7 @@ export class ArrayBookingslistModelTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -380,7 +378,7 @@ export class ArrayBookingslistModelTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -403,7 +401,7 @@ export class ArrayBookingslistModelTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -426,7 +424,7 @@ export class ArrayBookingslistModelTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -544,7 +542,7 @@ export class BookingPersistServiceSpy { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -1079,7 +1077,7 @@ describe('BookingsListComponent', () => { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', @@ -1109,7 +1107,7 @@ describe('BookingsListComponent', () => { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JudgeGreen', '33A', 'Coronation Street', diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/hearing-details/hearing-details.component.html b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/hearing-details/hearing-details.component.html index 78bca7062..f8444835e 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/hearing-details/hearing-details.component.html +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/hearing-details/hearing-details.component.html @@ -74,9 +74,6 @@

Hearing details

{{ hearing?.CaseType }}
-
-
{{ hearing?.HearingType }}
-
diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/hearing-details/hearing-details.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/hearing-details/hearing-details.component.spec.ts index a3bae46a1..6a38e277e 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/hearing-details/hearing-details.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/hearing-details/hearing-details.component.spec.ts @@ -30,7 +30,6 @@ describe('HearingDetailsComponent', () => { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JadgeGreen', '33A', 'Coronation Street', @@ -96,7 +95,6 @@ describe('HearingDetailsComponent', () => { 'user_role_name', 'username', 'contact_email', - 'case_role_name', 'hearing_role_name', 'hearing_role_code', 'display_name', @@ -124,7 +122,6 @@ describe('HearingDetailsComponent', () => { 'user_role_name', 'username', 'contact_email', - 'case_role_name', 'hearing_role_name', 'hearing_role_code', 'display_name', diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/participant-details/participant-details.component.html b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/participant-details/participant-details.component.html index 1bd3290a8..50a269bbf 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/participant-details/participant-details.component.html +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/participant-details/participant-details.component.html @@ -51,10 +51,6 @@
-
- {{ participant?.CaseRoleName }} -
-
{{ diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/participant-details/participant-details.component.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/participant-details/participant-details.component.spec.ts index 3f07ae9ce..ba3bb8037 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/participant-details/participant-details.component.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/bookings-list/participant-details/participant-details.component.spec.ts @@ -27,7 +27,6 @@ describe('ParticipantDetailsComponent', () => { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JadgeGreen', '33A', 'Coronation Street', @@ -59,7 +58,6 @@ describe('ParticipantDetailsComponent', () => { 'Citizen', 'email.p1@hmcts.net', 'email@hmcts.net', - 'Respondent', 'Respondent LIP', HearingRoleCodes.Respondent, 'Alan Brake', @@ -106,7 +104,6 @@ describe('ParticipantDetailsComponent', () => { 'Judge', 'judge@hmcts.net', 'email@hmcts.net', - 'Respondent', 'Judge', null, 'Judge', diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/booking-list.model.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/booking-list.model.spec.ts index ac9fbb71c..b04b58a02 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/booking-list.model.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/booking-list.model.spec.ts @@ -12,7 +12,6 @@ describe('BookingsDetailsModel', () => { '', '', '', - '', new Date(), '', new Date(), @@ -38,7 +37,6 @@ describe('BookingsDetailsModel', () => { '', '', '', - '', new Date(), '', new Date(), @@ -71,7 +69,6 @@ describe('BookingsDetailsModel', () => { '', '', '', - '', new Date(), '', new Date(), diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/bookings-list.model.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/bookings-list.model.ts index b288d3c2e..26311522a 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/bookings-list.model.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/bookings-list.model.ts @@ -18,7 +18,6 @@ export class BookingsDetailsModel { duration: number, hearingCaseNumber: string, hearingCaseName: string, - hearingType: string, judgeName: string, courtRoom: string, courtAddress: string, @@ -43,7 +42,6 @@ export class BookingsDetailsModel { this.Duration = duration; this.HearingCaseName = hearingCaseName; this.HearingCaseNumber = hearingCaseNumber; - this.HearingType = hearingType; this.JudgeName = judgeName; this.CourtRoom = courtRoom; this.CourtAddress = courtAddress; @@ -71,7 +69,6 @@ export class BookingsDetailsModel { Duration: number; HearingCaseNumber: string; HearingCaseName: string; - HearingType: string; JudgeName: string; CourtRoom: string; CourtAddress: string; diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/hearing.model.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/hearing.model.ts index 46a261ece..e8ab7439a 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/hearing.model.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/hearing.model.ts @@ -19,7 +19,6 @@ export class HearingModel { hearing_id?: string; scheduled_date_time?: Date; scheduled_duration?: number; - hearing_type_id?: number; cases?: CaseModel[]; participants?: ParticipantModel[]; judiciaryParticipants?: JudicialMemberDto[]; @@ -30,8 +29,6 @@ export class HearingModel { court_room?: string; hearing_venue_id?: number; case_type_id?: number; - hearing_type_name?: string; - hearing_type_code?: string; court_id?: number; court_name?: string; court_code?: string; diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-details.model.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-details.model.spec.ts index 6597a2656..3333e6d5f 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-details.model.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-details.model.spec.ts @@ -13,7 +13,7 @@ describe('participant details model', () => { 'user_role_name', 'username', 'contact_email', - 'case_role_name', + 'hearing_role_name', 'hearings_role_code', 'display_name', @@ -39,7 +39,7 @@ describe('participant details model', () => { 'user_role_name', 'username', 'contact_email', - 'case_role_name', + 'hearing_role_name', 'hearings_role_code', 'display_name', @@ -65,7 +65,7 @@ describe('participant details model', () => { 'user_role_name', 'username', 'contact_email', - 'case_role_name', + 'hearing_role_name', 'hearings_role_code', 'display_name', @@ -91,7 +91,7 @@ describe('participant details model', () => { 'user_role_name', 'username', 'contact_email', - 'case_role_name', + 'hearing_role_name', 'hearings_role_code', 'display_name', @@ -115,7 +115,7 @@ describe('participant details model', () => { 'user_role_name', 'username', 'Judiciaryemail', - 'case_role_name', + 'hearing_role_name', 'hearings_role_code', 'display_name', @@ -139,7 +139,7 @@ describe('participant details model', () => { 'Representative', 'username', 'contact_email', - 'case_role_name', + 'Representative', HearingRoleCodes.Representative, 'display_name', @@ -165,7 +165,7 @@ describe('participant details model', () => { 'user_role_name', 'username', 'contact_email', - 'case_role_name', + 'Individual', HearingRoleCodes.Applicant, 'display_name', @@ -180,102 +180,7 @@ describe('participant details model', () => { expect(model.isRepresenting).toBeFalsy(); }); - it('should return false when case role is none', () => { - const model = new ParticipantDetailsModel( - 'id', - 'externalRefId', - 'title', - 'first_name', - 'last_name', - 'user_role_name', - 'username', - 'contact_email', - 'none', - 'Individual', - HearingRoleCodes.Applicant, - 'display_name', - 'middle_names', - 'organisation', - 'representee', - '007867678678', - 'interpretee', - false, - null - ); - expect(model.showCaseRole()).toBeFalsy(); - }); - it('should return false when case role is staff member', () => { - const model = new ParticipantDetailsModel( - 'id', - 'externalRefId', - 'title', - 'first_name', - 'last_name', - 'user_role_name', - 'username', - 'contact_email', - 'Staff Member', - 'Individual', - HearingRoleCodes.StaffMember, - 'display_name', - 'middle_names', - 'organisation', - 'representee', - '007867678678', - 'staffmember', - false, - null - ); - expect(model.showCaseRole()).toBeFalsy(); - }); - it('should return false when case role is observer', () => { - const model = new ParticipantDetailsModel( - 'id', - 'externalRefId', - 'title', - 'first_name', - 'last_name', - 'user_role_name', - 'username', - 'contact_email', - 'observer', - 'Individual', - HearingRoleCodes.Observer, - 'display_name', - 'middle_names', - 'organisation', - 'representee', - '007867678678', - 'interpretee', - false, - null - ); - expect(model.showCaseRole()).toBeFalsy(); - }); - it('should return true when case role is representative', () => { - const model = new ParticipantDetailsModel( - 'id', - 'externalRefId', - 'title', - 'first_name', - 'last_name', - 'user_role_name', - 'username', - 'contact_email', - 'Representative', - 'Individual', - HearingRoleCodes.Representative, - 'display_name', - 'middle_names', - 'organisation', - 'representee', - '007867678678', - 'interpretee', - false, - null - ); - expect(model.showCaseRole()).toBeTruthy(); - }); + it('should return true when hearing role is interpreter', () => { const model = new ParticipantDetailsModel( 'id', @@ -286,7 +191,6 @@ describe('participant details model', () => { 'user_role_name', 'username', 'contact_email', - 'Citizen', 'Interpreter', HearingRoleCodes.Interpreter, 'display_name', @@ -310,7 +214,6 @@ describe('participant details model', () => { 'user_role_name', 'username', 'contact_email', - 'Citizen', 'Interpreter', HearingRoleCodes.Interpreter, 'display_name', @@ -324,28 +227,4 @@ describe('participant details model', () => { ); expect(model.isRepOrInterpreter).toBeTruthy(); }); - it('should not show case role when case role name is null', () => { - const model = new ParticipantDetailsModel( - 'id', - 'externalRefId', - 'title', - 'first_name', - 'last_name', - 'user_role_name', - 'username', - 'contact_email', - null, - 'Interpreter', - HearingRoleCodes.Interpreter, - 'display_name', - 'middle_names', - 'organisation', - 'representee', - '007867678678', - 'interpretee', - false, - null - ); - expect(model.showCaseRole()).toBeFalsy(); - }); }); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-details.model.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-details.model.ts index 7f8cbb1df..56e4025b6 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-details.model.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-details.model.ts @@ -1,4 +1,3 @@ -import { CaseRoles } from './case-roles'; import { HearingRoleCodes, HearingRoles } from './hearing-roles.model'; import { LinkedParticipant } from '../../services/clients/api-client'; import { InterpreterSelectedDto } from 'src/app/booking/interpreter-form/interpreter-selected.model'; @@ -14,7 +13,6 @@ export class ParticipantDetailsModel { role: string, userName: string, email: string, - caseRoleName: string, hearingRoleName: string, hearingRoleCode: string, displayName: string, @@ -35,7 +33,6 @@ export class ParticipantDetailsModel { this.UserName = userName; this.Flag = false; this.Email = email; - this.CaseRoleName = caseRoleName; this.HearingRoleName = hearingRoleName; this.HearingRoleCode = hearingRoleCode; this.DisplayName = displayName; @@ -56,7 +53,6 @@ export class ParticipantDetailsModel { UserRoleName: string; UserName: string; Email: string; - CaseRoleName: string; HearingRoleName: string; HearingRoleCode: string; DisplayName: string; @@ -87,19 +83,6 @@ export class ParticipantDetailsModel { return this.UserRoleName && this.UserRoleName.indexOf('Representative') > -1 && !!this.Representee; } - showCaseRole(): boolean { - if (!this.CaseRoleName) { - return false; - } - - return !( - this.CaseRoleName.toLowerCase() === CaseRoles.NONE.toLowerCase() || - this.CaseRoleName.toLowerCase() === CaseRoles.OBSERVER.toLowerCase() || - this.CaseRoleName.toLowerCase() === CaseRoles.PANEL_MEMBER.toLowerCase() || - this.CaseRoleName.toLowerCase() === CaseRoles.STAFF_MEMBER.toLowerCase() - ); - } - get isInterpreter(): boolean { return ( (this.HearingRoleName && this.HearingRoleName.toLowerCase().trim() === HearingRoles.INTERPRETER) || diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-model.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-model.spec.ts index 24238437d..dd46987ad 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-model.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant-model.spec.ts @@ -1,4 +1,4 @@ -import { JudgeAccountType, JudgeResponse, PersonResponse } from 'src/app/services/clients/api-client'; +import { JudgeAccountType, JudgeResponse, PersonResponseV2 } from 'src/app/services/clients/api-client'; import { ParticipantModel } from './participant.model'; describe('ParticipantModel', () => { @@ -12,8 +12,8 @@ describe('ParticipantModel', () => { expect(participant).toBeTruthy(); }); - it('should map PersonResponse to ParticipantModel', () => { - const person = new PersonResponse({ + it('should map PersonResponseV2 to ParticipantModel', () => { + const person = new PersonResponseV2({ contact_email: 'aa@hmcts.net', first_name: 'Sam', last_name: 'Green', @@ -35,7 +35,7 @@ describe('ParticipantModel', () => { expect(participant.username).toEqual(person.username); expect(participant.company).toEqual(person.organisation); }); - it('should mapping return empty ParticipantModel if PersonResponse is null', () => { + it('should mapping return empty ParticipantModel if PersonResponseV2 is null', () => { const person = null; participant = ParticipantModel.fromPersonResponse(person); expect(participant).toBeNull(); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant.model.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant.model.ts index fa11189fe..61c41a940 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant.model.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/participant.model.ts @@ -1,4 +1,4 @@ -import { JudgeAccountType, JudgeResponse, PersonResponse } from 'src/app/services/clients/api-client'; +import { JudgeAccountType, JudgeResponse, PersonResponseV2 } from 'src/app/services/clients/api-client'; import { LinkedParticipantModel } from './linked-participant.model'; import { JudicialMemberDto } from 'src/app/booking/judicial-office-holders/models/add-judicial-member.model'; import { InterpreterSelectedDto } from 'src/app/booking/interpreter-form/interpreter-selected.model'; @@ -15,7 +15,6 @@ export class ParticipantModel { display_name?: string; username?: string; email?: string; - case_role_name?: string; hearing_role_name?: string; hearing_role_code?: string; phone?: string; @@ -43,7 +42,7 @@ export class ParticipantModel { } } - static fromPersonResponse(person: PersonResponse): ParticipantModel { + static fromPersonResponse(person: PersonResponseV2): ParticipantModel { return person ? { ...person, diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/party.model.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/party.model.ts deleted file mode 100644 index d040a961c..000000000 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/common/model/party.model.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { HearingRoleModel } from './hearing-role.model'; - -// represents case role for a given hearing case type. -export class PartyModel { - constructor(name: string) { - this.name = name; - this.hearingRoles = []; - } - - name: string; - hearingRoles: Array; -} diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/booking-details.service.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/booking-details.service.spec.ts index 38ecfdd8a..a01f15716 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/booking-details.service.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/booking-details.service.spec.ts @@ -17,13 +17,9 @@ export class ResponseTestData { caseHearing.number = 'XX3456234565'; response.cases = []; response.cases.push(caseHearing); - response.hearing_type_name = 'Tax'; response.id = '1'; response.scheduled_date_time = new Date('2019-10-22 13:58:40.3730067'); response.scheduled_duration = 125; - response.hearing_venue_name = 'Coronation Street'; - response.case_type_name = 'Generic'; - response.hearing_type_name = 'Automated Test'; response.other_information = 'some note'; response.hearing_room_name = '777'; response.created_date = new Date('2019-10-22 13:58:40.3730067'); @@ -98,11 +94,9 @@ describe('booking details service', () => { expect(model).toBeTruthy(); expect(model.HearingId).toBe('1'); expect(model.Duration).toBe(125); - expect(model.CourtAddress).toBe('Coronation Street'); expect(model.CourtRoom).toBe('777'); expect(model.HearingCaseName).toBe('Smith vs Donner'); expect(model.HearingCaseNumber).toBe('XX3456234565'); - expect(model.HearingType).toBe('Automated Test'); expect(model.StartTime).toEqual(new Date('2019-10-22 13:58:40.3730067')); expect(model.CreatedBy).toBe('stub.response@hmcts.net'); expect(model.LastEditBy).toBe('stub.response@hmcts.net'); @@ -157,13 +151,9 @@ describe('booking details service', () => { caseHearing.number = 'XX3456234565'; response.cases = []; response.cases.push(caseHearing); - response.hearing_type_name = 'Tax'; response.id = '1'; response.scheduled_date_time = new Date('2019-10-22 13:58:40.3730067'); response.scheduled_duration = 125; - response.hearing_venue_name = 'Coronation Street'; - response.case_type_name = 'Civil Money Claims'; - response.hearing_type_name = 'Application to Set Judgment Aside'; response.other_information = 'some note'; response.hearing_room_name = '777'; response.created_date = new Date('2019-10-22 13:58:40.3730067'); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/booking-details.service.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/booking-details.service.ts index 4e286967c..61817a460 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/booking-details.service.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/booking-details.service.ts @@ -22,10 +22,9 @@ export class BookingDetailsService { hearingResponse.scheduled_duration, hearingResponse.cases && hearingResponse.cases.length > 0 ? hearingResponse.cases[0].number : '', hearingResponse.cases && hearingResponse.cases.length > 0 ? hearingResponse.cases[0].name : '', - hearingResponse.hearing_type_name, '', hearingResponse.hearing_room_name, - hearingResponse.hearing_venue_name, + hearingResponse.hearing_venue_code, hearingResponse.created_by, hearingResponse.created_date, hearingResponse.updated_by, @@ -35,7 +34,7 @@ export class BookingDetailsService { hearingResponse.status, hearingResponse.audio_recording_required, hearingResponse.cancel_reason, - hearingResponse.case_type_name, + hearingResponse.service_id, '', '', '', @@ -81,7 +80,6 @@ export class BookingDetailsService { p.user_role_name, p.username, p.contact_email, - p.case_role_name, p.hearing_role_name, p.hearing_role_code, p.display_name, diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.spec.ts index 296276a3a..6be0b46c0 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.spec.ts @@ -17,7 +17,7 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JadgeGreen', '33A', 'Coronation Street', @@ -40,7 +40,7 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JadgeGreen', '33A', 'Coronation Street', @@ -63,7 +63,7 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JadgeGreen', '33A', 'Coronation Street', @@ -100,7 +100,7 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JadgeGreen', '33A', 'Coronation Street', @@ -123,7 +123,7 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JadgeGreen', '33A', 'Coronation Street', @@ -146,7 +146,7 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JadgeGreen', '33A', 'Coronation Street', @@ -177,7 +177,7 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JadgeGreen', '33A', 'Coronation Street', @@ -200,7 +200,7 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JadgeGreen', '33A', 'Coronation Street', @@ -223,7 +223,7 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JadgeGreen', '33A', 'Coronation Street', @@ -271,7 +271,6 @@ export class ResponseTestData { bhr.court_room = '12A'; bhr.hearing_name = 'A vs B'; bhr.hearing_number = '123A'; - bhr.hearing_type_name = 'Tax'; bhr.judge_name = 'Judge'; bhr.scheduled_duration = 45; bhr.created_by = 'Roy'; @@ -288,7 +287,6 @@ export class ResponseTestData { bhr1.court_room = '12A'; bhr1.hearing_name = 'A vs B'; bhr1.hearing_number = '123A'; - bhr1.hearing_type_name = 'Tax'; bhr1.judge_name = 'Judge'; bhr1.scheduled_duration = 45; bhr1.created_by = 'Roy'; @@ -346,7 +344,6 @@ describe('bookings list service', () => { expect(model.Hearings[0].BookingsDetails[0].CourtAddress).toBe('court address'); expect(model.Hearings[0].BookingsDetails[0].HearingCaseName).toBe('A vs B'); expect(model.Hearings[0].BookingsDetails[0].HearingCaseNumber).toBe('123A'); - expect(model.Hearings[0].BookingsDetails[0].HearingType).toBe('Tax'); expect(model.Hearings[0].BookingsDetails[0].AudioRecordingRequired).toBe(true); expect(model.Hearings[0].BookingsDetails[0].GroupId).toBe('123'); }); @@ -402,7 +399,7 @@ describe('Booking list service functionality', () => { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JadgeGreen', '33A', 'Coronation Street', @@ -439,7 +436,7 @@ describe('Booking list service functionality', () => { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', + 'JadgeGreen', '33A', 'Coronation Street', diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.ts index 5d90f3df4..bd72187de 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.ts @@ -169,7 +169,6 @@ export class BookingsListService { hearing.scheduled_duration, hearing.hearing_number, hearing.hearing_name, - hearing.hearing_type_name, hearing.judge_name, hearing.court_room, hearing.court_address, diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-persist.service.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-persist.service.spec.ts index ab6c51c0b..53802d9e5 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-persist.service.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-persist.service.spec.ts @@ -20,7 +20,6 @@ function MockBookedHearing(): BookingsDetailsModel { 45, 'CaseNo', 'CaseName', - 'Financial Remedy', 'Judge Dredd', 'Manchester Room 1', 'Manchester Civil Court', diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/clients/api-client.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/clients/api-client.ts index bda2113d2..7c4415085 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/clients/api-client.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/clients/api-client.ts @@ -2182,22 +2182,17 @@ export class BHClient extends ApiClientBase { } /** - * Find judges and court rooms accounts list by email search term. - * @param body (optional) The email address search term. + * Gets a list hearing types * @return OK */ - postJudgesBySearchTerm(body: string | undefined): Observable { - let url_ = this.baseUrl + '/api/judiciary/judges'; + getHearingTypes(): Observable { + let url_ = this.baseUrl + '/api/reference/types'; url_ = url_.replace(/[?&]$/, ''); - const content_ = JSON.stringify(body); - let options_: any = { - body: content_, observe: 'response', responseType: 'blob', headers: new HttpHeaders({ - 'Content-Type': 'application/json-patch+json', Accept: 'application/json' }) }; @@ -2205,28 +2200,28 @@ export class BHClient extends ApiClientBase { return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('post', url_, transformedOptions_); + return this.http.request('get', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processPostJudgesBySearchTerm(response_); + return this.processGetHearingTypes(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processPostJudgesBySearchTerm(response_ as any); + return this.processGetHearingTypes(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processPostJudgesBySearchTerm(response: HttpResponseBase): Observable { + protected processGetHearingTypes(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -2257,20 +2252,20 @@ export class BHClient extends ApiClientBase { let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); if (Array.isArray(resultData200)) { result200 = [] as any; - for (let item of resultData200) result200!.push(JudgeResponse.fromJS(item)); + for (let item of resultData200) result200!.push(HearingTypeResponse.fromJS(item)); } else { result200 = null; } return _observableOf(result200); }) ); - } else if (status === 400) { + } else if (status === 404) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { - let result400: any = null; - let resultData400 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result400 = ProblemDetails.fromJS(resultData400); - return throwException('Bad Request', status, _responseText, _headers, result400); + let result404: any = null; + let resultData404 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + result404 = ProblemDetails.fromJS(resultData404); + return throwException('Not Found', status, _responseText, _headers, result404); }) ); } else if (status === 401) { @@ -2290,22 +2285,17 @@ export class BHClient extends ApiClientBase { } /** - * Find judiciary person list by email search term. - * @param body (optional) The email address search term. + * Get available courts * @return OK */ - searchForJudiciaryPerson(body: string | undefined): Observable { - let url_ = this.baseUrl + '/api/judiciary/search'; + getCourts(): Observable { + let url_ = this.baseUrl + '/api/reference/courts'; url_ = url_.replace(/[?&]$/, ''); - const content_ = JSON.stringify(body); - let options_: any = { - body: content_, observe: 'response', responseType: 'blob', headers: new HttpHeaders({ - 'Content-Type': 'application/json-patch+json', Accept: 'application/json' }) }; @@ -2313,28 +2303,28 @@ export class BHClient extends ApiClientBase { return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('post', url_, transformedOptions_); + return this.http.request('get', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processSearchForJudiciaryPerson(response_); + return this.processGetCourts(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processSearchForJudiciaryPerson(response_ as any); + return this.processGetCourts(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processSearchForJudiciaryPerson(response: HttpResponseBase): Observable { + protected processGetCourts(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -2365,20 +2355,20 @@ export class BHClient extends ApiClientBase { let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); if (Array.isArray(resultData200)) { result200 = [] as any; - for (let item of resultData200) result200!.push(JudiciaryPerson.fromJS(item)); + for (let item of resultData200) result200!.push(HearingVenueResponse.fromJS(item)); } else { result200 = null; } return _observableOf(result200); }) ); - } else if (status === 400) { + } else if (status === 404) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { - let result400: any = null; - let resultData400 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result400 = ProblemDetails.fromJS(resultData400); - return throwException('Bad Request', status, _responseText, _headers, result400); + let result404: any = null; + let resultData404 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + result404 = ProblemDetails.fromJS(resultData404); + return throwException('Not Found', status, _responseText, _headers, result404); }) ); } else if (status === 401) { @@ -2398,22 +2388,17 @@ export class BHClient extends ApiClientBase { } /** - * Add a new justice user - * @param body (optional) - * @return Created + * Get available languages for interpreters + * @return OK */ - addNewJusticeUser(body: AddNewJusticeUserRequest | undefined): Observable { - let url_ = this.baseUrl + '/api/justice-users'; + getAvailableLanguages(): Observable { + let url_ = this.baseUrl + '/api/reference/available-languages'; url_ = url_.replace(/[?&]$/, ''); - const content_ = JSON.stringify(body); - let options_: any = { - body: content_, observe: 'response', responseType: 'blob', headers: new HttpHeaders({ - 'Content-Type': 'application/json', Accept: 'application/json' }) }; @@ -2421,28 +2406,28 @@ export class BHClient extends ApiClientBase { return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('post', url_, transformedOptions_); + return this.http.request('get', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processAddNewJusticeUser(response_); + return this.processGetAvailableLanguages(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processAddNewJusticeUser(response_ as any); + return this.processGetAvailableLanguages(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processAddNewJusticeUser(response: HttpResponseBase): Observable { + protected processGetAvailableLanguages(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -2466,32 +2451,18 @@ export class BHClient extends ApiClientBase { return throwException('Internal Server Error', status, _responseText, _headers, result500); }) ); - } else if (status === 201) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - let result201: any = null; - let resultData201 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result201 = JusticeUserResponse.fromJS(resultData201); - return _observableOf(result201); - }) - ); - } else if (status === 400) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - let result400: any = null; - let resultData400 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result400 = ValidationProblemDetails.fromJS(resultData400); - return throwException('Bad Request', status, _responseText, _headers, result400); - }) - ); - } else if (status === 409) { + } else if (status === 200) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { - let result409: any = null; - let resultData409 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result409 = resultData409 !== undefined ? resultData409 : null; - - return throwException('Conflict', status, _responseText, _headers, result409); + let result200: any = null; + let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + if (Array.isArray(resultData200)) { + result200 = [] as any; + for (let item of resultData200) result200!.push(AvailableLanguageResponse.fromJS(item)); + } else { + result200 = null; + } + return _observableOf(result200); }) ); } else if (status === 401) { @@ -2511,11 +2482,12 @@ export class BHClient extends ApiClientBase { } /** - * @param body (optional) + * Find judges and court rooms accounts list by email search term. + * @param body (optional) The email address search term. * @return OK */ - editJusticeUser(body: EditJusticeUserRequest | undefined): Observable { - let url_ = this.baseUrl + '/api/justice-users'; + postJudgesBySearchTerm(body: string | undefined): Observable { + let url_ = this.baseUrl + '/api/judiciary/judges'; url_ = url_.replace(/[?&]$/, ''); const content_ = JSON.stringify(body); @@ -2525,7 +2497,7 @@ export class BHClient extends ApiClientBase { observe: 'response', responseType: 'blob', headers: new HttpHeaders({ - 'Content-Type': 'application/json', + 'Content-Type': 'application/json-patch+json', Accept: 'application/json' }) }; @@ -2533,28 +2505,28 @@ export class BHClient extends ApiClientBase { return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('patch', url_, transformedOptions_); + return this.http.request('post', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processEditJusticeUser(response_); + return this.processPostJudgesBySearchTerm(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processEditJusticeUser(response_ as any); + return this.processPostJudgesBySearchTerm(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processEditJusticeUser(response: HttpResponseBase): Observable { + protected processPostJudgesBySearchTerm(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -2583,7 +2555,12 @@ export class BHClient extends ApiClientBase { _observableMergeMap((_responseText: string) => { let result200: any = null; let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result200 = JusticeUserResponse.fromJS(resultData200); + if (Array.isArray(resultData200)) { + result200 = [] as any; + for (let item of resultData200) result200!.push(JudgeResponse.fromJS(item)); + } else { + result200 = null; + } return _observableOf(result200); }) ); @@ -2592,20 +2569,10 @@ export class BHClient extends ApiClientBase { _observableMergeMap((_responseText: string) => { let result400: any = null; let resultData400 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result400 = ValidationProblemDetails.fromJS(resultData400); + result400 = ProblemDetails.fromJS(resultData400); return throwException('Bad Request', status, _responseText, _headers, result400); }) ); - } else if (status === 404) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - let result404: any = null; - let resultData404 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result404 = resultData404 !== undefined ? resultData404 : null; - - return throwException('Not Found', status, _responseText, _headers, result404); - }) - ); } else if (status === 401) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { @@ -2623,20 +2590,22 @@ export class BHClient extends ApiClientBase { } /** - * Delete a justice user - * @param id The justice user id - * @return No Content + * Find judiciary person list by email search term. + * @param body (optional) The email address search term. + * @return OK */ - deleteJusticeUser(id: string): Observable { - let url_ = this.baseUrl + '/api/justice-users/{id}'; - if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); - url_ = url_.replace('{id}', encodeURIComponent('' + id)); + searchForJudiciaryPerson(body: string | undefined): Observable { + let url_ = this.baseUrl + '/api/judiciary/search'; url_ = url_.replace(/[?&]$/, ''); + const content_ = JSON.stringify(body); + let options_: any = { + body: content_, observe: 'response', responseType: 'blob', headers: new HttpHeaders({ + 'Content-Type': 'application/json-patch+json', Accept: 'application/json' }) }; @@ -2644,28 +2613,28 @@ export class BHClient extends ApiClientBase { return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('delete', url_, transformedOptions_); + return this.http.request('post', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processDeleteJusticeUser(response_); + return this.processSearchForJudiciaryPerson(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processDeleteJusticeUser(response_ as any); + return this.processSearchForJudiciaryPerson(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processDeleteJusticeUser(response: HttpResponseBase): Observable { + protected processSearchForJudiciaryPerson(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -2689,24 +2658,18 @@ export class BHClient extends ApiClientBase { return throwException('Internal Server Error', status, _responseText, _headers, result500); }) ); - } else if (status === 204) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - let result204: any = null; - let resultData204 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result204 = resultData204 !== undefined ? resultData204 : null; - - return _observableOf(result204); - }) - ); - } else if (status === 404) { + } else if (status === 200) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { - let result404: any = null; - let resultData404 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result404 = resultData404 !== undefined ? resultData404 : null; - - return throwException('Not Found', status, _responseText, _headers, result404); + let result200: any = null; + let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + if (Array.isArray(resultData200)) { + result200 = [] as any; + for (let item of resultData200) result200!.push(JudiciaryPerson.fromJS(item)); + } else { + result200 = null; + } + return _observableOf(result200); }) ); } else if (status === 400) { @@ -2714,7 +2677,7 @@ export class BHClient extends ApiClientBase { _observableMergeMap((_responseText: string) => { let result400: any = null; let resultData400 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result400 = ValidationProblemDetails.fromJS(resultData400); + result400 = ProblemDetails.fromJS(resultData400); return throwException('Bad Request', status, _responseText, _headers, result400); }) ); @@ -2735,11 +2698,12 @@ export class BHClient extends ApiClientBase { } /** + * Add a new justice user * @param body (optional) - * @return OK + * @return Created */ - restoreJusticeUser(body: RestoreJusticeUserRequest | undefined): Observable { - let url_ = this.baseUrl + '/api/justice-users/restore'; + addNewJusticeUser(body: AddNewJusticeUserRequest | undefined): Observable { + let url_ = this.baseUrl + '/api/justice-users'; url_ = url_.replace(/[?&]$/, ''); const content_ = JSON.stringify(body); @@ -2757,19 +2721,19 @@ export class BHClient extends ApiClientBase { return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('patch', url_, transformedOptions_); + return this.http.request('post', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processRestoreJusticeUser(response_); + return this.processAddNewJusticeUser(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processRestoreJusticeUser(response_ as any); + return this.processAddNewJusticeUser(response_ as any); } catch (e) { return _observableThrow(e) as any as Observable; } @@ -2778,7 +2742,7 @@ export class BHClient extends ApiClientBase { ); } - protected processRestoreJusticeUser(response: HttpResponseBase): Observable { + protected processAddNewJusticeUser(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -2802,13 +2766,13 @@ export class BHClient extends ApiClientBase { return throwException('Internal Server Error', status, _responseText, _headers, result500); }) ); - } else if (status === 200) { + } else if (status === 201) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { - let result200: any = null; - let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result200 = JusticeUserResponse.fromJS(resultData200); - return _observableOf(result200); + let result201: any = null; + let resultData201 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + result201 = JusticeUserResponse.fromJS(resultData201); + return _observableOf(result201); }) ); } else if (status === 400) { @@ -2820,14 +2784,14 @@ export class BHClient extends ApiClientBase { return throwException('Bad Request', status, _responseText, _headers, result400); }) ); - } else if (status === 404) { + } else if (status === 409) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { - let result404: any = null; - let resultData404 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result404 = resultData404 !== undefined ? resultData404 : null; + let result409: any = null; + let resultData409 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + result409 = resultData409 !== undefined ? resultData409 : null; - return throwException('Not Found', status, _responseText, _headers, result404); + return throwException('Conflict', status, _responseText, _headers, result409); }) ); } else if (status === 401) { @@ -2847,12 +2811,11 @@ export class BHClient extends ApiClientBase { } /** - * Find person list by email search term. - * @param body (optional) The email address search term. + * @param body (optional) * @return OK */ - postPersonBySearchTerm(body: string | undefined): Observable { - let url_ = this.baseUrl + '/api/persons'; + editJusticeUser(body: EditJusticeUserRequest | undefined): Observable { + let url_ = this.baseUrl + '/api/justice-users'; url_ = url_.replace(/[?&]$/, ''); const content_ = JSON.stringify(body); @@ -2862,7 +2825,7 @@ export class BHClient extends ApiClientBase { observe: 'response', responseType: 'blob', headers: new HttpHeaders({ - 'Content-Type': 'application/json-patch+json', + 'Content-Type': 'application/json', Accept: 'application/json' }) }; @@ -2870,28 +2833,28 @@ export class BHClient extends ApiClientBase { return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('post', url_, transformedOptions_); + return this.http.request('patch', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processPostPersonBySearchTerm(response_); + return this.processEditJusticeUser(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processPostPersonBySearchTerm(response_ as any); + return this.processEditJusticeUser(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processPostPersonBySearchTerm(response: HttpResponseBase): Observable { + protected processEditJusticeUser(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -2920,12 +2883,7 @@ export class BHClient extends ApiClientBase { _observableMergeMap((_responseText: string) => { let result200: any = null; let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - if (Array.isArray(resultData200)) { - result200 = [] as any; - for (let item of resultData200) result200!.push(PersonResponse.fromJS(item)); - } else { - result200 = null; - } + result200 = JusticeUserResponse.fromJS(resultData200); return _observableOf(result200); }) ); @@ -2934,10 +2892,20 @@ export class BHClient extends ApiClientBase { _observableMergeMap((_responseText: string) => { let result400: any = null; let resultData400 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result400 = ProblemDetails.fromJS(resultData400); + result400 = ValidationProblemDetails.fromJS(resultData400); return throwException('Bad Request', status, _responseText, _headers, result400); }) ); + } else if (status === 404) { + return blobToText(responseBlob).pipe( + _observableMergeMap((_responseText: string) => { + let result404: any = null; + let resultData404 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + result404 = resultData404 !== undefined ? resultData404 : null; + + return throwException('Not Found', status, _responseText, _headers, result404); + }) + ); } else if (status === 401) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { @@ -2955,14 +2923,14 @@ export class BHClient extends ApiClientBase { } /** - * Search for non judge persons by contact email - * @param contactEmail (optional) - * @return OK + * Delete a justice user + * @param id The justice user id + * @return No Content */ - getPersonForUpdateByContactEmail(contactEmail: string | undefined): Observable { - let url_ = this.baseUrl + '/api/persons?'; - if (contactEmail === null) throw new Error("The parameter 'contactEmail' cannot be null."); - else if (contactEmail !== undefined) url_ += 'contactEmail=' + encodeURIComponent('' + contactEmail) + '&'; + deleteJusticeUser(id: string): Observable { + let url_ = this.baseUrl + '/api/justice-users/{id}'; + if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); + url_ = url_.replace('{id}', encodeURIComponent('' + id)); url_ = url_.replace(/[?&]$/, ''); let options_: any = { @@ -2976,28 +2944,28 @@ export class BHClient extends ApiClientBase { return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('get', url_, transformedOptions_); + return this.http.request('delete', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processGetPersonForUpdateByContactEmail(response_); + return this.processDeleteJusticeUser(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processGetPersonForUpdateByContactEmail(response_ as any); + return this.processDeleteJusticeUser(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processGetPersonForUpdateByContactEmail(response: HttpResponseBase): Observable { + protected processDeleteJusticeUser(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -3021,13 +2989,14 @@ export class BHClient extends ApiClientBase { return throwException('Internal Server Error', status, _responseText, _headers, result500); }) ); - } else if (status === 200) { + } else if (status === 204) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { - let result200: any = null; - let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result200 = PersonResponse.fromJS(resultData200); - return _observableOf(result200); + let result204: any = null; + let resultData204 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + result204 = resultData204 !== undefined ? resultData204 : null; + + return _observableOf(result204); }) ); } else if (status === 404) { @@ -3035,10 +3004,20 @@ export class BHClient extends ApiClientBase { _observableMergeMap((_responseText: string) => { let result404: any = null; let resultData404 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result404 = ProblemDetails.fromJS(resultData404); + result404 = resultData404 !== undefined ? resultData404 : null; + return throwException('Not Found', status, _responseText, _headers, result404); }) ); + } else if (status === 400) { + return blobToText(responseBlob).pipe( + _observableMergeMap((_responseText: string) => { + let result400: any = null; + let resultData400 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + result400 = ValidationProblemDetails.fromJS(resultData400); + return throwException('Bad Request', status, _responseText, _headers, result400); + }) + ); } else if (status === 401) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { @@ -3056,20 +3035,21 @@ export class BHClient extends ApiClientBase { } /** - * Get all hearings for a person by username - * @param username (optional) + * @param body (optional) * @return OK */ - getHearingsByUsernameForDeletion(username: string | undefined): Observable { - let url_ = this.baseUrl + '/api/persons/username/hearings?'; - if (username === null) throw new Error("The parameter 'username' cannot be null."); - else if (username !== undefined) url_ += 'username=' + encodeURIComponent('' + username) + '&'; + restoreJusticeUser(body: RestoreJusticeUserRequest | undefined): Observable { + let url_ = this.baseUrl + '/api/justice-users/restore'; url_ = url_.replace(/[?&]$/, ''); + const content_ = JSON.stringify(body); + let options_: any = { + body: content_, observe: 'response', responseType: 'blob', headers: new HttpHeaders({ + 'Content-Type': 'application/json', Accept: 'application/json' }) }; @@ -3077,28 +3057,28 @@ export class BHClient extends ApiClientBase { return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('get', url_, transformedOptions_); + return this.http.request('patch', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processGetHearingsByUsernameForDeletion(response_); + return this.processRestoreJusticeUser(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processGetHearingsByUsernameForDeletion(response_ as any); + return this.processRestoreJusticeUser(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processGetHearingsByUsernameForDeletion(response: HttpResponseBase): Observable { + protected processRestoreJusticeUser(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -3127,109 +3107,17 @@ export class BHClient extends ApiClientBase { _observableMergeMap((_responseText: string) => { let result200: any = null; let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - if (Array.isArray(resultData200)) { - result200 = [] as any; - for (let item of resultData200) result200!.push(HearingsByUsernameForDeletionResponse.fromJS(item)); - } else { - result200 = null; - } + result200 = JusticeUserResponse.fromJS(resultData200); return _observableOf(result200); }) ); - } else if (status === 404) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - let result404: any = null; - let resultData404 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result404 = ProblemDetails.fromJS(resultData404); - return throwException('Not Found', status, _responseText, _headers, result404); - }) - ); - } else if (status === 401) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - return throwException('Unauthorized', status, _responseText, _headers); - }) - ); - } else if (status !== 200 && status !== 204) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - return throwException('An unexpected server error occurred.', status, _responseText, _headers); - }) - ); - } - return _observableOf(null as any); - } - - /** - * Delete a user account and anonymise a person in bookings - * @param username username of person - * @return No Content - */ - deletePersonWithUsername(username: string): Observable { - let url_ = this.baseUrl + '/api/persons/username/{username}'; - if (username === undefined || username === null) throw new Error("The parameter 'username' must be defined."); - url_ = url_.replace('{username}', encodeURIComponent('' + username)); - url_ = url_.replace(/[?&]$/, ''); - - let options_: any = { - observe: 'response', - responseType: 'blob', - headers: new HttpHeaders({}) - }; - - return _observableFrom(this.transformOptions(options_)) - .pipe( - _observableMergeMap(transformedOptions_ => { - return this.http.request('delete', url_, transformedOptions_); - }) - ) - .pipe( - _observableMergeMap((response_: any) => { - return this.processDeletePersonWithUsername(response_); - }) - ) - .pipe( - _observableCatch((response_: any) => { - if (response_ instanceof HttpResponseBase) { - try { - return this.processDeletePersonWithUsername(response_ as any); - } catch (e) { - return _observableThrow(e) as any as Observable; - } - } else return _observableThrow(response_) as any as Observable; - }) - ); - } - - protected processDeletePersonWithUsername(response: HttpResponseBase): Observable { - const status = response.status; - const responseBlob = - response instanceof HttpResponse - ? response.body - : (response as any).error instanceof Blob - ? (response as any).error - : undefined; - - let _headers: any = {}; - if (response.headers) { - for (let key of response.headers.keys()) { - _headers[key] = response.headers.get(key); - } - } - if (status === 500) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - let result500: any = null; - let resultData500 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result500 = UnexpectedErrorResponse.fromJS(resultData500); - return throwException('Internal Server Error', status, _responseText, _headers, result500); - }) - ); - } else if (status === 204) { + } else if (status === 400) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { - return _observableOf(null as any); + let result400: any = null; + let resultData400 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + result400 = ValidationProblemDetails.fromJS(resultData400); + return throwException('Bad Request', status, _responseText, _headers, result400); }) ); } else if (status === 404) { @@ -3237,7 +3125,8 @@ export class BHClient extends ApiClientBase { _observableMergeMap((_responseText: string) => { let result404: any = null; let resultData404 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result404 = ProblemDetails.fromJS(resultData404); + result404 = resultData404 !== undefined ? resultData404 : null; + return throwException('Not Found', status, _responseText, _headers, result404); }) ); @@ -3258,15 +3147,12 @@ export class BHClient extends ApiClientBase { } /** - * Update the personal details - * @param personId The id of the person to update - * @param body (optional) Updated details of the person - * @return Accepted + * Find person list by email search term. + * @param body (optional) The email address search term. + * @return OK */ - updatePersonDetails(personId: string, body: UpdateAccountDetailsRequest | undefined): Observable { - let url_ = this.baseUrl + '/api/persons/{personId}'; - if (personId === undefined || personId === null) throw new Error("The parameter 'personId' must be defined."); - url_ = url_.replace('{personId}', encodeURIComponent('' + personId)); + postPersonBySearchTerm(body: string | undefined): Observable { + let url_ = this.baseUrl + '/api/persons'; url_ = url_.replace(/[?&]$/, ''); const content_ = JSON.stringify(body); @@ -3276,35 +3162,36 @@ export class BHClient extends ApiClientBase { observe: 'response', responseType: 'blob', headers: new HttpHeaders({ - 'Content-Type': 'application/json-patch+json' + 'Content-Type': 'application/json-patch+json', + Accept: 'application/json' }) }; return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('put', url_, transformedOptions_); + return this.http.request('post', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processUpdatePersonDetails(response_); + return this.processPostPersonBySearchTerm(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processUpdatePersonDetails(response_ as any); + return this.processPostPersonBySearchTerm(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processUpdatePersonDetails(response: HttpResponseBase): Observable { + protected processPostPersonBySearchTerm(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -3328,19 +3215,18 @@ export class BHClient extends ApiClientBase { return throwException('Internal Server Error', status, _responseText, _headers, result500); }) ); - } else if (status === 202) { - return blobToText(responseBlob).pipe( - _observableMergeMap((_responseText: string) => { - return _observableOf(null as any); - }) - ); - } else if (status === 404) { + } else if (status === 200) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { - let result404: any = null; - let resultData404 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - result404 = ProblemDetails.fromJS(resultData404); - return throwException('Not Found', status, _responseText, _headers, result404); + let result200: any = null; + let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + if (Array.isArray(resultData200)) { + result200 = [] as any; + for (let item of resultData200) result200!.push(PersonResponseV2.fromJS(item)); + } else { + result200 = null; + } + return _observableOf(result200); }) ); } else if (status === 400) { @@ -3369,14 +3255,14 @@ export class BHClient extends ApiClientBase { } /** - * Gets a list hearing types - * @param includeDeleted (optional) + * Search for non judge persons by contact email + * @param contactEmail (optional) * @return OK */ - getHearingTypes(includeDeleted: boolean | undefined): Observable { - let url_ = this.baseUrl + '/api/reference/types?'; - if (includeDeleted === null) throw new Error("The parameter 'includeDeleted' cannot be null."); - else if (includeDeleted !== undefined) url_ += 'includeDeleted=' + encodeURIComponent('' + includeDeleted) + '&'; + getPersonForUpdateByContactEmail(contactEmail: string | undefined): Observable { + let url_ = this.baseUrl + '/api/persons?'; + if (contactEmail === null) throw new Error("The parameter 'contactEmail' cannot be null."); + else if (contactEmail !== undefined) url_ += 'contactEmail=' + encodeURIComponent('' + contactEmail) + '&'; url_ = url_.replace(/[?&]$/, ''); let options_: any = { @@ -3395,23 +3281,23 @@ export class BHClient extends ApiClientBase { ) .pipe( _observableMergeMap((response_: any) => { - return this.processGetHearingTypes(response_); + return this.processGetPersonForUpdateByContactEmail(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processGetHearingTypes(response_ as any); + return this.processGetPersonForUpdateByContactEmail(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processGetHearingTypes(response: HttpResponseBase): Observable { + protected processGetPersonForUpdateByContactEmail(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -3440,12 +3326,7 @@ export class BHClient extends ApiClientBase { _observableMergeMap((_responseText: string) => { let result200: any = null; let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - if (Array.isArray(resultData200)) { - result200 = [] as any; - for (let item of resultData200) result200!.push(HearingTypeResponse.fromJS(item)); - } else { - result200 = null; - } + result200 = PersonResponseV2.fromJS(resultData200); return _observableOf(result200); }) ); @@ -3475,14 +3356,14 @@ export class BHClient extends ApiClientBase { } /** - * Get available participant roles - * @param caseTypeParameter (optional) + * Get all hearings for a person by username + * @param username (optional) * @return OK */ - getParticipantRoles(caseTypeParameter: string | undefined): Observable { - let url_ = this.baseUrl + '/api/reference/participantroles?'; - if (caseTypeParameter === null) throw new Error("The parameter 'caseTypeParameter' cannot be null."); - else if (caseTypeParameter !== undefined) url_ += 'caseTypeParameter=' + encodeURIComponent('' + caseTypeParameter) + '&'; + getHearingsByUsernameForDeletion(username: string | undefined): Observable { + let url_ = this.baseUrl + '/api/persons/username/hearings?'; + if (username === null) throw new Error("The parameter 'username' cannot be null."); + else if (username !== undefined) url_ += 'username=' + encodeURIComponent('' + username) + '&'; url_ = url_.replace(/[?&]$/, ''); let options_: any = { @@ -3501,23 +3382,23 @@ export class BHClient extends ApiClientBase { ) .pipe( _observableMergeMap((response_: any) => { - return this.processGetParticipantRoles(response_); + return this.processGetHearingsByUsernameForDeletion(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processGetParticipantRoles(response_ as any); + return this.processGetHearingsByUsernameForDeletion(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processGetParticipantRoles(response: HttpResponseBase): Observable { + protected processGetHearingsByUsernameForDeletion(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -3548,7 +3429,7 @@ export class BHClient extends ApiClientBase { let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); if (Array.isArray(resultData200)) { result200 = [] as any; - for (let item of resultData200) result200!.push(CaseAndHearingRolesResponse.fromJS(item)); + for (let item of resultData200) result200!.push(HearingsByUsernameForDeletionResponse.fromJS(item)); } else { result200 = null; } @@ -3581,46 +3462,47 @@ export class BHClient extends ApiClientBase { } /** - * Get available courts - * @return OK + * Delete a user account and anonymise a person in bookings + * @param username username of person + * @return No Content */ - getCourts(): Observable { - let url_ = this.baseUrl + '/api/reference/courts'; + deletePersonWithUsername(username: string): Observable { + let url_ = this.baseUrl + '/api/persons/username/{username}'; + if (username === undefined || username === null) throw new Error("The parameter 'username' must be defined."); + url_ = url_.replace('{username}', encodeURIComponent('' + username)); url_ = url_.replace(/[?&]$/, ''); let options_: any = { observe: 'response', responseType: 'blob', - headers: new HttpHeaders({ - Accept: 'application/json' - }) + headers: new HttpHeaders({}) }; return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('get', url_, transformedOptions_); + return this.http.request('delete', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processGetCourts(response_); + return this.processDeletePersonWithUsername(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processGetCourts(response_ as any); + return this.processDeletePersonWithUsername(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processGetCourts(response: HttpResponseBase): Observable { + protected processDeletePersonWithUsername(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -3644,18 +3526,10 @@ export class BHClient extends ApiClientBase { return throwException('Internal Server Error', status, _responseText, _headers, result500); }) ); - } else if (status === 200) { + } else if (status === 204) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { - let result200: any = null; - let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - if (Array.isArray(resultData200)) { - result200 = [] as any; - for (let item of resultData200) result200!.push(HearingVenueResponse.fromJS(item)); - } else { - result200 = null; - } - return _observableOf(result200); + return _observableOf(null as any); }) ); } else if (status === 404) { @@ -3684,46 +3558,53 @@ export class BHClient extends ApiClientBase { } /** - * Get available languages for interpreters - * @return OK + * Update the personal details + * @param personId The id of the person to update + * @param body (optional) Updated details of the person + * @return Accepted */ - getAvailableLanguages(): Observable { - let url_ = this.baseUrl + '/api/reference/available-languages'; + updatePersonDetails(personId: string, body: UpdateAccountDetailsRequest | undefined): Observable { + let url_ = this.baseUrl + '/api/persons/{personId}'; + if (personId === undefined || personId === null) throw new Error("The parameter 'personId' must be defined."); + url_ = url_.replace('{personId}', encodeURIComponent('' + personId)); url_ = url_.replace(/[?&]$/, ''); + const content_ = JSON.stringify(body); + let options_: any = { + body: content_, observe: 'response', responseType: 'blob', headers: new HttpHeaders({ - Accept: 'application/json' + 'Content-Type': 'application/json-patch+json' }) }; return _observableFrom(this.transformOptions(options_)) .pipe( _observableMergeMap(transformedOptions_ => { - return this.http.request('get', url_, transformedOptions_); + return this.http.request('put', url_, transformedOptions_); }) ) .pipe( _observableMergeMap((response_: any) => { - return this.processGetAvailableLanguages(response_); + return this.processUpdatePersonDetails(response_); }) ) .pipe( _observableCatch((response_: any) => { if (response_ instanceof HttpResponseBase) { try { - return this.processGetAvailableLanguages(response_ as any); + return this.processUpdatePersonDetails(response_ as any); } catch (e) { - return _observableThrow(e) as any as Observable; + return _observableThrow(e) as any as Observable; } - } else return _observableThrow(response_) as any as Observable; + } else return _observableThrow(response_) as any as Observable; }) ); } - protected processGetAvailableLanguages(response: HttpResponseBase): Observable { + protected processUpdatePersonDetails(response: HttpResponseBase): Observable { const status = response.status; const responseBlob = response instanceof HttpResponse @@ -3747,18 +3628,28 @@ export class BHClient extends ApiClientBase { return throwException('Internal Server Error', status, _responseText, _headers, result500); }) ); - } else if (status === 200) { + } else if (status === 202) { return blobToText(responseBlob).pipe( _observableMergeMap((_responseText: string) => { - let result200: any = null; - let resultData200 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); - if (Array.isArray(resultData200)) { - result200 = [] as any; - for (let item of resultData200) result200!.push(AvailableLanguageResponse.fromJS(item)); - } else { - result200 = null; - } - return _observableOf(result200); + return _observableOf(null as any); + }) + ); + } else if (status === 404) { + return blobToText(responseBlob).pipe( + _observableMergeMap((_responseText: string) => { + let result404: any = null; + let resultData404 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + result404 = ProblemDetails.fromJS(resultData404); + return throwException('Not Found', status, _responseText, _headers, result404); + }) + ); + } else if (status === 400) { + return blobToText(responseBlob).pipe( + _observableMergeMap((_responseText: string) => { + let result400: any = null; + let resultData400 = _responseText === '' ? null : JSON.parse(_responseText, this.jsonParseReviver); + result400 = ProblemDetails.fromJS(resultData400); + return throwException('Bad Request', status, _responseText, _headers, result400); }) ); } else if (status === 401) { @@ -5250,7 +5141,6 @@ export class BookingDetailsRequest implements IBookingDetailsRequest { scheduled_date_time?: Date; scheduled_duration?: number; hearing_venue_code?: string | undefined; - case_type_name?: string | undefined; case_type_service_id?: string | undefined; cases?: CaseRequest[] | undefined; participants?: ParticipantRequest[] | undefined; @@ -5280,7 +5170,6 @@ export class BookingDetailsRequest implements IBookingDetailsRequest { this.scheduled_date_time = _data['scheduled_date_time'] ? new Date(_data['scheduled_date_time'].toString()) : undefined; this.scheduled_duration = _data['scheduled_duration']; this.hearing_venue_code = _data['hearing_venue_code']; - this.case_type_name = _data['case_type_name']; this.case_type_service_id = _data['case_type_service_id']; if (Array.isArray(_data['cases'])) { this.cases = [] as any; @@ -5324,7 +5213,6 @@ export class BookingDetailsRequest implements IBookingDetailsRequest { data['scheduled_date_time'] = this.scheduled_date_time ? this.scheduled_date_time.toISOString() : undefined; data['scheduled_duration'] = this.scheduled_duration; data['hearing_venue_code'] = this.hearing_venue_code; - data['case_type_name'] = this.case_type_name; data['case_type_service_id'] = this.case_type_service_id; if (Array.isArray(this.cases)) { data['cases'] = []; @@ -5360,7 +5248,6 @@ export interface IBookingDetailsRequest { scheduled_date_time?: Date; scheduled_duration?: number; hearing_venue_code?: string | undefined; - case_type_name?: string | undefined; case_type_service_id?: string | undefined; cases?: CaseRequest[] | undefined; participants?: ParticipantRequest[] | undefined; @@ -5843,8 +5730,6 @@ export class ParticipantRequest implements IParticipantRequest { telephone_number?: string | undefined; username?: string | undefined; display_name?: string | undefined; - case_role_name?: string | undefined; - hearing_role_name?: string | undefined; hearing_role_code?: string | undefined; representee?: string | undefined; organisation_name?: string | undefined; @@ -5870,8 +5755,6 @@ export class ParticipantRequest implements IParticipantRequest { this.telephone_number = _data['telephone_number']; this.username = _data['username']; this.display_name = _data['display_name']; - this.case_role_name = _data['case_role_name']; - this.hearing_role_name = _data['hearing_role_name']; this.hearing_role_code = _data['hearing_role_code']; this.representee = _data['representee']; this.organisation_name = _data['organisation_name']; @@ -5900,8 +5783,6 @@ export class ParticipantRequest implements IParticipantRequest { data['telephone_number'] = this.telephone_number; data['username'] = this.username; data['display_name'] = this.display_name; - data['case_role_name'] = this.case_role_name; - data['hearing_role_name'] = this.hearing_role_name; data['hearing_role_code'] = this.hearing_role_code; data['representee'] = this.representee; data['organisation_name'] = this.organisation_name; @@ -5921,8 +5802,6 @@ export interface IParticipantRequest { telephone_number?: string | undefined; username?: string | undefined; display_name?: string | undefined; - case_role_name?: string | undefined; - hearing_role_name?: string | undefined; hearing_role_code?: string | undefined; representee?: string | undefined; organisation_name?: string | undefined; @@ -6349,7 +6228,6 @@ export class BookingsHearingResponse implements IBookingsHearingResponse { scheduled_date_time?: Date; scheduled_duration?: number; case_type_name?: string | undefined; - hearing_type_name?: string | undefined; court_room?: string | undefined; court_address?: string | undefined; judge_name?: string | undefined; @@ -6384,7 +6262,6 @@ export class BookingsHearingResponse implements IBookingsHearingResponse { this.scheduled_date_time = _data['scheduled_date_time'] ? new Date(_data['scheduled_date_time'].toString()) : undefined; this.scheduled_duration = _data['scheduled_duration']; this.case_type_name = _data['case_type_name']; - this.hearing_type_name = _data['hearing_type_name']; this.court_room = _data['court_room']; this.court_address = _data['court_address']; this.judge_name = _data['judge_name']; @@ -6420,7 +6297,6 @@ export class BookingsHearingResponse implements IBookingsHearingResponse { data['scheduled_date_time'] = this.scheduled_date_time ? this.scheduled_date_time.toISOString() : undefined; data['scheduled_duration'] = this.scheduled_duration; data['case_type_name'] = this.case_type_name; - data['hearing_type_name'] = this.hearing_type_name; data['court_room'] = this.court_room; data['court_address'] = this.court_address; data['judge_name'] = this.judge_name; @@ -6449,7 +6325,6 @@ export interface IBookingsHearingResponse { scheduled_date_time?: Date; scheduled_duration?: number; case_type_name?: string | undefined; - hearing_type_name?: string | undefined; court_room?: string | undefined; court_address?: string | undefined; judge_name?: string | undefined; @@ -6798,22 +6673,14 @@ export class HearingDetailsResponse implements IHearingDetailsResponse { id?: string; scheduled_date_time?: Date; scheduled_duration?: number; - /** V1 only */ - hearing_venue_name?: string | undefined; /** V2 only */ hearing_venue_code?: string | undefined; - /** V1 only */ - case_type_name?: string | undefined; /** V2 only */ service_id?: string | undefined; - /** V1 only */ - hearing_type_name?: string | undefined; /** V2 only */ hearing_type_code?: string | undefined; cases?: CaseResponse[] | undefined; participants?: ParticipantResponse[] | undefined; - /** V1 only */ - telephone_participants?: TelephoneParticipantResponse[] | undefined; judiciary_participants?: JudiciaryParticipantResponse[] | undefined; hearing_room_name?: string | undefined; other_information?: string | undefined; @@ -6848,11 +6715,8 @@ export class HearingDetailsResponse implements IHearingDetailsResponse { this.id = _data['id']; this.scheduled_date_time = _data['scheduled_date_time'] ? new Date(_data['scheduled_date_time'].toString()) : undefined; this.scheduled_duration = _data['scheduled_duration']; - this.hearing_venue_name = _data['hearing_venue_name']; this.hearing_venue_code = _data['hearing_venue_code']; - this.case_type_name = _data['case_type_name']; this.service_id = _data['service_id']; - this.hearing_type_name = _data['hearing_type_name']; this.hearing_type_code = _data['hearing_type_code']; if (Array.isArray(_data['cases'])) { this.cases = [] as any; @@ -6862,11 +6726,6 @@ export class HearingDetailsResponse implements IHearingDetailsResponse { this.participants = [] as any; for (let item of _data['participants']) this.participants!.push(ParticipantResponse.fromJS(item)); } - if (Array.isArray(_data['telephone_participants'])) { - this.telephone_participants = [] as any; - for (let item of _data['telephone_participants']) - this.telephone_participants!.push(TelephoneParticipantResponse.fromJS(item)); - } if (Array.isArray(_data['judiciary_participants'])) { this.judiciary_participants = [] as any; for (let item of _data['judiciary_participants']) @@ -6912,11 +6771,8 @@ export class HearingDetailsResponse implements IHearingDetailsResponse { data['id'] = this.id; data['scheduled_date_time'] = this.scheduled_date_time ? this.scheduled_date_time.toISOString() : undefined; data['scheduled_duration'] = this.scheduled_duration; - data['hearing_venue_name'] = this.hearing_venue_name; data['hearing_venue_code'] = this.hearing_venue_code; - data['case_type_name'] = this.case_type_name; data['service_id'] = this.service_id; - data['hearing_type_name'] = this.hearing_type_name; data['hearing_type_code'] = this.hearing_type_code; if (Array.isArray(this.cases)) { data['cases'] = []; @@ -6926,10 +6782,6 @@ export class HearingDetailsResponse implements IHearingDetailsResponse { data['participants'] = []; for (let item of this.participants) data['participants'].push(item.toJSON()); } - if (Array.isArray(this.telephone_participants)) { - data['telephone_participants'] = []; - for (let item of this.telephone_participants) data['telephone_participants'].push(item.toJSON()); - } if (Array.isArray(this.judiciary_participants)) { data['judiciary_participants'] = []; for (let item of this.judiciary_participants) data['judiciary_participants'].push(item.toJSON()); @@ -6967,22 +6819,14 @@ export interface IHearingDetailsResponse { id?: string; scheduled_date_time?: Date; scheduled_duration?: number; - /** V1 only */ - hearing_venue_name?: string | undefined; /** V2 only */ hearing_venue_code?: string | undefined; - /** V1 only */ - case_type_name?: string | undefined; /** V2 only */ service_id?: string | undefined; - /** V1 only */ - hearing_type_name?: string | undefined; /** V2 only */ hearing_type_code?: string | undefined; cases?: CaseResponse[] | undefined; participants?: ParticipantResponse[] | undefined; - /** V1 only */ - telephone_participants?: TelephoneParticipantResponse[] | undefined; judiciary_participants?: JudiciaryParticipantResponse[] | undefined; hearing_room_name?: string | undefined; other_information?: string | undefined; @@ -7050,14 +6894,10 @@ export interface IHearingRoleResponse { /** Defines a type of hearing based on case */ export class HearingTypeResponse implements IHearingTypeResponse { - /** The short code for the type */ - code?: string | undefined; /** Which case type it belongs to */ group?: string | undefined; /** Unique identifier for this type of hearing */ id?: number | undefined; - /** Hearing type display name */ - name?: string | undefined; /** The service id for the type */ service_id?: string | undefined; @@ -7071,10 +6911,8 @@ export class HearingTypeResponse implements IHearingTypeResponse { init(_data?: any) { if (_data) { - this.code = _data['code']; this.group = _data['group']; this.id = _data['id']; - this.name = _data['name']; this.service_id = _data['service_id']; } } @@ -7088,10 +6926,8 @@ export class HearingTypeResponse implements IHearingTypeResponse { toJSON(data?: any) { data = typeof data === 'object' ? data : {}; - data['code'] = this.code; data['group'] = this.group; data['id'] = this.id; - data['name'] = this.name; data['service_id'] = this.service_id; return data; } @@ -7099,14 +6935,10 @@ export class HearingTypeResponse implements IHearingTypeResponse { /** Defines a type of hearing based on case */ export interface IHearingTypeResponse { - /** The short code for the type */ - code?: string | undefined; /** Which case type it belongs to */ group?: string | undefined; /** Unique identifier for this type of hearing */ id?: number | undefined; - /** Hearing type display name */ - name?: string | undefined; /** The service id for the type */ service_id?: string | undefined; } @@ -7410,7 +7242,6 @@ export class ParticipantResponse implements IParticipantResponse { external_reference_id?: string | undefined; measures_external_id?: string | undefined; display_name?: string | undefined; - case_role_name?: string | undefined; hearing_role_name?: string | undefined; hearing_role_code?: string | undefined; user_role_name?: string | undefined; @@ -7441,7 +7272,6 @@ export class ParticipantResponse implements IParticipantResponse { this.external_reference_id = _data['external_reference_id']; this.measures_external_id = _data['measures_external_id']; this.display_name = _data['display_name']; - this.case_role_name = _data['case_role_name']; this.hearing_role_name = _data['hearing_role_name']; this.hearing_role_code = _data['hearing_role_code']; this.user_role_name = _data['user_role_name']; @@ -7480,7 +7310,6 @@ export class ParticipantResponse implements IParticipantResponse { data['external_reference_id'] = this.external_reference_id; data['measures_external_id'] = this.measures_external_id; data['display_name'] = this.display_name; - data['case_role_name'] = this.case_role_name; data['hearing_role_name'] = this.hearing_role_name; data['hearing_role_code'] = this.hearing_role_code; data['user_role_name'] = this.user_role_name; @@ -7508,7 +7337,6 @@ export interface IParticipantResponse { external_reference_id?: string | undefined; measures_external_id?: string | undefined; display_name?: string | undefined; - case_role_name?: string | undefined; hearing_role_name?: string | undefined; hearing_role_code?: string | undefined; user_role_name?: string | undefined; @@ -7527,65 +7355,11 @@ export interface IParticipantResponse { } export class ScreeningResponse implements IScreeningResponse { - type?: ScreeningType; - /** A list of participant/endpoint external ref ids to be protected from */ - protect_from?: string[] | undefined; - - constructor(data?: IScreeningResponse) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - this.type = _data['type']; - if (Array.isArray(_data['protect_from'])) { - this.protect_from = [] as any; - for (let item of _data['protect_from']) this.protect_from!.push(item); - } - } - } - - static fromJS(data: any): ScreeningResponse { - data = typeof data === 'object' ? data : {}; - let result = new ScreeningResponse(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - data['type'] = this.type; - if (Array.isArray(this.protect_from)) { - data['protect_from'] = []; - for (let item of this.protect_from) data['protect_from'].push(item); - } - return data; - } -} - -export interface IScreeningResponse { - type?: ScreeningType; - /** A list of participant/endpoint external ref ids to be protected from */ - protect_from?: string[] | undefined; -} - -export class TelephoneParticipantResponse implements ITelephoneParticipantResponse { - id?: string; - case_role_name?: string | undefined; - hearing_role_name?: string | undefined; - first_name?: string | undefined; - last_name?: string | undefined; - contact_email?: string | undefined; - telephone_number?: string | undefined; - mobile_number?: string | undefined; - representee?: string | undefined; - linked_participants?: LinkedParticipantResponse[] | undefined; + type?: ScreeningType; + /** A list of participant/endpoint external ref ids to be protected from */ + protect_from?: string[] | undefined; - constructor(data?: ITelephoneParticipantResponse) { + constructor(data?: IScreeningResponse) { if (data) { for (var property in data) { if (data.hasOwnProperty(property)) (this)[property] = (data)[property]; @@ -7595,59 +7369,36 @@ export class TelephoneParticipantResponse implements ITelephoneParticipantRespon init(_data?: any) { if (_data) { - this.id = _data['id']; - this.case_role_name = _data['case_role_name']; - this.hearing_role_name = _data['hearing_role_name']; - this.first_name = _data['first_name']; - this.last_name = _data['last_name']; - this.contact_email = _data['contact_email']; - this.telephone_number = _data['telephone_number']; - this.mobile_number = _data['mobile_number']; - this.representee = _data['representee']; - if (Array.isArray(_data['linked_participants'])) { - this.linked_participants = [] as any; - for (let item of _data['linked_participants']) this.linked_participants!.push(LinkedParticipantResponse.fromJS(item)); + this.type = _data['type']; + if (Array.isArray(_data['protect_from'])) { + this.protect_from = [] as any; + for (let item of _data['protect_from']) this.protect_from!.push(item); } } } - static fromJS(data: any): TelephoneParticipantResponse { + static fromJS(data: any): ScreeningResponse { data = typeof data === 'object' ? data : {}; - let result = new TelephoneParticipantResponse(); + let result = new ScreeningResponse(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; - data['id'] = this.id; - data['case_role_name'] = this.case_role_name; - data['hearing_role_name'] = this.hearing_role_name; - data['first_name'] = this.first_name; - data['last_name'] = this.last_name; - data['contact_email'] = this.contact_email; - data['telephone_number'] = this.telephone_number; - data['mobile_number'] = this.mobile_number; - data['representee'] = this.representee; - if (Array.isArray(this.linked_participants)) { - data['linked_participants'] = []; - for (let item of this.linked_participants) data['linked_participants'].push(item.toJSON()); + data['type'] = this.type; + if (Array.isArray(this.protect_from)) { + data['protect_from'] = []; + for (let item of this.protect_from) data['protect_from'].push(item); } return data; } } -export interface ITelephoneParticipantResponse { - id?: string; - case_role_name?: string | undefined; - hearing_role_name?: string | undefined; - first_name?: string | undefined; - last_name?: string | undefined; - contact_email?: string | undefined; - telephone_number?: string | undefined; - mobile_number?: string | undefined; - representee?: string | undefined; - linked_participants?: LinkedParticipantResponse[] | undefined; +export interface IScreeningResponse { + type?: ScreeningType; + /** A list of participant/endpoint external ref ids to be protected from */ + protect_from?: string[] | undefined; } export class UnallocatedHearingsForVhoResponse implements IUnallocatedHearingsForVhoResponse { @@ -7775,51 +7526,6 @@ export interface IUserProfileResponse { is_case_administrator?: boolean; } -export class CaseAndHearingRolesResponse implements ICaseAndHearingRolesResponse { - name?: string | undefined; - hearing_roles?: HearingRole[] | undefined; - - constructor(data?: ICaseAndHearingRolesResponse) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - this.name = _data['name']; - if (Array.isArray(_data['hearing_roles'])) { - this.hearing_roles = [] as any; - for (let item of _data['hearing_roles']) this.hearing_roles!.push(HearingRole.fromJS(item)); - } - } - } - - static fromJS(data: any): CaseAndHearingRolesResponse { - data = typeof data === 'object' ? data : {}; - let result = new CaseAndHearingRolesResponse(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - data['name'] = this.name; - if (Array.isArray(this.hearing_roles)) { - data['hearing_roles'] = []; - for (let item of this.hearing_roles) data['hearing_roles'].push(item.toJSON()); - } - return data; - } -} - -export interface ICaseAndHearingRolesResponse { - name?: string | undefined; - hearing_roles?: HearingRole[] | undefined; -} - export class CvpForAudioFileResponse implements ICvpForAudioFileResponse { file_name?: string | undefined; sas_token_uri?: string | undefined; @@ -7862,9 +7568,9 @@ export interface ICvpForAudioFileResponse { /** Case request */ export class EditCaseRequest implements IEditCaseRequest { /** The case number */ - number!: string; + number?: string | undefined; /** The case name */ - name!: string; + name?: string | undefined; constructor(data?: IEditCaseRequest) { if (data) { @@ -7899,9 +7605,9 @@ export class EditCaseRequest implements IEditCaseRequest { /** Case request */ export interface IEditCaseRequest { /** The case number */ - number: string; + number?: string | undefined; /** The case name */ - name: string; + name?: string | undefined; } export class EditEndpointRequest implements IEditEndpointRequest { @@ -7983,9 +7689,9 @@ export class EditHearingRequest implements IEditHearingRequest { hearing_venue_code?: string | undefined; /** The hearing room name at the hearing venue */ hearing_room_name?: string | undefined; - case!: EditCaseRequest; + case?: EditCaseRequest; /** List of participants in hearing */ - participants!: EditParticipantRequest[] | undefined; + participants?: EditParticipantRequest[] | undefined; /** List of judiciary participants in hearing */ judiciary_participants?: JudiciaryParticipantRequest[] | undefined; /** Any other information about the hearing */ @@ -8001,9 +7707,6 @@ export class EditHearingRequest implements IEditHearingRequest { if (data.hasOwnProperty(property)) (this)[property] = (data)[property]; } } - if (!data) { - this.case = new EditCaseRequest(); - } } init(_data?: any) { @@ -8013,7 +7716,7 @@ export class EditHearingRequest implements IEditHearingRequest { this.hearing_venue_name = _data['hearing_venue_name']; this.hearing_venue_code = _data['hearing_venue_code']; this.hearing_room_name = _data['hearing_room_name']; - this.case = _data['case'] ? EditCaseRequest.fromJS(_data['case']) : new EditCaseRequest(); + this.case = _data['case'] ? EditCaseRequest.fromJS(_data['case']) : undefined; if (Array.isArray(_data['participants'])) { this.participants = [] as any; for (let item of _data['participants']) this.participants!.push(EditParticipantRequest.fromJS(item)); @@ -8077,9 +7780,9 @@ export interface IEditHearingRequest { hearing_venue_code?: string | undefined; /** The hearing room name at the hearing venue */ hearing_room_name?: string | undefined; - case: EditCaseRequest; + case?: EditCaseRequest; /** List of participants in hearing */ - participants: EditParticipantRequest[] | undefined; + participants?: EditParticipantRequest[] | undefined; /** List of judiciary participants in hearing */ judiciary_participants?: JudiciaryParticipantRequest[] | undefined; /** Any other information about the hearing */ @@ -8099,19 +7802,17 @@ export class EditParticipantRequest implements IEditParticipantRequest { /** Participant Title. */ title?: string | undefined; /** Participant first name. */ - first_name!: string; + first_name?: string | undefined; /** Participant middle name. */ middle_names?: string | undefined; /** Participant last name. */ - last_name!: string; + last_name?: string | undefined; /** Participant Contact Email */ - contact_email!: string; + contact_email?: string | undefined; /** Participant Telephone number */ telephone_number?: string | undefined; /** Participant Display Name */ - display_name!: string; - /** The name of the participant's case role */ - case_role_name?: string | undefined; + display_name?: string | undefined; /** The name of the participant's hearing role */ hearing_role_name?: string | undefined; /** The code of the participant's hearing role */ @@ -8145,7 +7846,6 @@ export class EditParticipantRequest implements IEditParticipantRequest { this.contact_email = _data['contact_email']; this.telephone_number = _data['telephone_number']; this.display_name = _data['display_name']; - this.case_role_name = _data['case_role_name']; this.hearing_role_name = _data['hearing_role_name']; this.hearing_role_code = _data['hearing_role_code']; this.representee = _data['representee']; @@ -8179,7 +7879,6 @@ export class EditParticipantRequest implements IEditParticipantRequest { data['contact_email'] = this.contact_email; data['telephone_number'] = this.telephone_number; data['display_name'] = this.display_name; - data['case_role_name'] = this.case_role_name; data['hearing_role_name'] = this.hearing_role_name; data['hearing_role_code'] = this.hearing_role_code; data['representee'] = this.representee; @@ -8203,19 +7902,17 @@ export interface IEditParticipantRequest { /** Participant Title. */ title?: string | undefined; /** Participant first name. */ - first_name: string; + first_name?: string | undefined; /** Participant middle name. */ middle_names?: string | undefined; /** Participant last name. */ - last_name: string; + last_name?: string | undefined; /** Participant Contact Email */ - contact_email: string; + contact_email?: string | undefined; /** Participant Telephone number */ telephone_number?: string | undefined; /** Participant Display Name */ - display_name: string; - /** The name of the participant's case role */ - case_role_name?: string | undefined; + display_name?: string | undefined; /** The name of the participant's hearing role */ hearing_role_name?: string | undefined; /** The code of the participant's hearing role */ @@ -8272,45 +7969,6 @@ export interface IHearingAudioRecordingResponse { audio_file_links?: string[] | undefined; } -export class HearingRole implements IHearingRole { - name?: string | undefined; - user_role?: string | undefined; - - constructor(data?: IHearingRole) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - this.name = _data['name']; - this.user_role = _data['user_role']; - } - } - - static fromJS(data: any): HearingRole { - data = typeof data === 'object' ? data : {}; - let result = new HearingRole(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - data['name'] = this.name; - data['user_role'] = this.user_role; - return data; - } -} - -export interface IHearingRole { - name?: string | undefined; - user_role?: string | undefined; -} - export class HearingsForAudioFileSearchResponse implements IHearingsForAudioFileSearchResponse { /** Hearing Id */ id?: string; @@ -9006,6 +8664,8 @@ export class WorkingHours implements IWorkingHours { end_time_minutes?: number | undefined; start_time_hour?: number | undefined; start_time_minutes?: number | undefined; + readonly start_time?: string | undefined; + readonly end_time?: string | undefined; constructor(data?: IWorkingHours) { if (data) { @@ -9022,6 +8682,8 @@ export class WorkingHours implements IWorkingHours { this.end_time_minutes = _data['end_time_minutes']; this.start_time_hour = _data['start_time_hour']; this.start_time_minutes = _data['start_time_minutes']; + (this).start_time = _data['start_time']; + (this).end_time = _data['end_time']; } } @@ -9039,6 +8701,8 @@ export class WorkingHours implements IWorkingHours { data['end_time_minutes'] = this.end_time_minutes; data['start_time_hour'] = this.start_time_hour; data['start_time_minutes'] = this.start_time_minutes; + data['start_time'] = this.start_time; + data['end_time'] = this.end_time; return data; } } @@ -9049,6 +8713,8 @@ export interface IWorkingHours { end_time_minutes?: number | undefined; start_time_hour?: number | undefined; start_time_minutes?: number | undefined; + start_time?: string | undefined; + end_time?: string | undefined; } export class HearingVenueResponse implements IHearingVenueResponse { @@ -9226,73 +8892,6 @@ export interface IJusticeUserResponse { deleted?: boolean; } -export class PersonResponse implements IPersonResponse { - id?: string; - title?: string | undefined; - first_name?: string | undefined; - middle_names?: string | undefined; - last_name?: string | undefined; - contact_email?: string | undefined; - telephone_number?: string | undefined; - username?: string | undefined; - organisation?: string | undefined; - - constructor(data?: IPersonResponse) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - this.id = _data['id']; - this.title = _data['title']; - this.first_name = _data['first_name']; - this.middle_names = _data['middle_names']; - this.last_name = _data['last_name']; - this.contact_email = _data['contact_email']; - this.telephone_number = _data['telephone_number']; - this.username = _data['username']; - this.organisation = _data['organisation']; - } - } - - static fromJS(data: any): PersonResponse { - data = typeof data === 'object' ? data : {}; - let result = new PersonResponse(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - data['id'] = this.id; - data['title'] = this.title; - data['first_name'] = this.first_name; - data['middle_names'] = this.middle_names; - data['last_name'] = this.last_name; - data['contact_email'] = this.contact_email; - data['telephone_number'] = this.telephone_number; - data['username'] = this.username; - data['organisation'] = this.organisation; - return data; - } -} - -export interface IPersonResponse { - id?: string; - title?: string | undefined; - first_name?: string | undefined; - middle_names?: string | undefined; - last_name?: string | undefined; - contact_email?: string | undefined; - telephone_number?: string | undefined; - username?: string | undefined; - organisation?: string | undefined; -} - export class VhoNonAvailabilityWorkHoursResponse implements IVhoNonAvailabilityWorkHoursResponse { id?: number; end_time?: Date; @@ -9383,6 +8982,73 @@ export interface IVhoWorkHoursResponse { end_time?: string | undefined; } +export class PersonResponseV2 implements IPersonResponseV2 { + id?: string; + title?: string | undefined; + first_name?: string | undefined; + middle_names?: string | undefined; + last_name?: string | undefined; + contact_email?: string | undefined; + telephone_number?: string | undefined; + username?: string | undefined; + organisation?: string | undefined; + + constructor(data?: IPersonResponseV2) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) (this)[property] = (data)[property]; + } + } + } + + init(_data?: any) { + if (_data) { + this.id = _data['id']; + this.title = _data['title']; + this.first_name = _data['first_name']; + this.middle_names = _data['middle_names']; + this.last_name = _data['last_name']; + this.contact_email = _data['contact_email']; + this.telephone_number = _data['telephone_number']; + this.username = _data['username']; + this.organisation = _data['organisation']; + } + } + + static fromJS(data: any): PersonResponseV2 { + data = typeof data === 'object' ? data : {}; + let result = new PersonResponseV2(); + result.init(data); + return result; + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {}; + data['id'] = this.id; + data['title'] = this.title; + data['first_name'] = this.first_name; + data['middle_names'] = this.middle_names; + data['last_name'] = this.last_name; + data['contact_email'] = this.contact_email; + data['telephone_number'] = this.telephone_number; + data['username'] = this.username; + data['organisation'] = this.organisation; + return data; + } +} + +export interface IPersonResponseV2 { + id?: string; + title?: string | undefined; + first_name?: string | undefined; + middle_names?: string | undefined; + last_name?: string | undefined; + contact_email?: string | undefined; + telephone_number?: string | undefined; + username?: string | undefined; + organisation?: string | undefined; +} + export class ProblemDetails implements IProblemDetails { type?: string | undefined; title?: string | undefined; diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/participant-edit-service.service.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/participant-edit-service.service.spec.ts index 290a871bb..2f09953d7 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/participant-edit-service.service.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/participant-edit-service.service.spec.ts @@ -1,6 +1,6 @@ import { of } from 'rxjs'; import { MockLogger } from '../shared/testing/mock-logger'; -import { BHClient, BookHearingException, PersonResponse } from './clients/api-client'; +import { BHClient, BookHearingException, PersonResponseV2 } from './clients/api-client'; import { ParticipantEditService } from './participant-edit-service.service'; describe('ParticipantDeleteServiceService', () => { @@ -33,7 +33,7 @@ describe('ParticipantDeleteServiceService', () => { }); it('should return person', async () => { - const existingPerson = new PersonResponse({ + const existingPerson = new PersonResponseV2({ id: 'id', first_name: 'John', last_name: 'Doe', diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/search.service.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/search.service.spec.ts index af90991d6..745f07e65 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/search.service.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/search.service.spec.ts @@ -2,7 +2,7 @@ import { SearchService } from './search.service'; import { TestBed } from '@angular/core/testing'; import { HttpClientModule } from '@angular/common/http'; import { of } from 'rxjs'; -import { BHClient, JudgeAccountType, JudgeResponse, PersonResponse } from './clients/api-client'; +import { BHClient, JudgeAccountType, JudgeResponse, PersonResponseV2 } from './clients/api-client'; import { ParticipantModel } from '../common/model/participant.model'; import { Constants } from '../common/constants'; import { LaunchDarklyService } from './launch-darkly.service'; @@ -15,7 +15,7 @@ const roleJudge = 'Judge'; const validSearchTerms = 'abc'; const invalidSearchTerms = 'ab'; -const personList: PersonResponse[] = JSON.parse( +const personList: PersonResponseV2[] = JSON.parse( ` [ { diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/search.service.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/search.service.ts index 610e4a84d..cf860d6a7 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/search.service.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/search.service.ts @@ -3,7 +3,7 @@ import { Observable, of } from 'rxjs'; import { map } from 'rxjs/operators'; import { IDropDownModel } from '../common/model/drop-down.model'; import { ParticipantModel } from '../common/model/participant.model'; -import { BHClient, JudgeResponse, PersonResponse } from '../services/clients/api-client'; +import { BHClient, JudgeResponse, PersonResponseV2 } from './clients/api-client'; import { Constants } from '../common/constants'; @Injectable({ @@ -76,7 +76,7 @@ export class SearchService { } } - searchEntries(term): Observable> { + searchEntries(term): Observable> { return this.bhClient.postPersonBySearchTerm(term); } diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/video-hearings.service.spec.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/video-hearings.service.spec.ts index 4aad66272..2f6785210 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/video-hearings.service.spec.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/video-hearings.service.spec.ts @@ -4,13 +4,11 @@ import { BHClient, BookingStatus, CancelMultiDayHearingRequest, - CaseAndHearingRolesResponse, CaseResponse, ClientSettingsResponse, EditMultiDayHearingRequest, EndpointResponse, HearingDetailsResponse, - HearingRole, JudiciaryParticipantResponse, LinkedParticipantResponse, MultiHearingRequest, @@ -37,7 +35,6 @@ describe('Video hearing service', () => { beforeEach(() => { clientApiSpy = jasmine.createSpyObj([ 'getHearingTypes', - 'getParticipantRoles', 'bookNewHearing', 'cloneHearing', 'getTelephoneConferenceIdById', @@ -112,26 +109,6 @@ describe('Video hearing service', () => { expect(service.getCurrentRequest().hearing_id).toBe('hearingId'); }); - it('should cache participant roles', async () => { - // given the api responds with - const serverResponse = new CaseAndHearingRolesResponse({ - name: 'Respondent', - hearing_roles: [ - new HearingRole({ name: 'Representative', user_role: 'Representative' }), - new HearingRole({ name: 'Litigant in person', user_role: 'Individual' }) - ] - }); - clientApiSpy.getParticipantRoles.and.returnValue(of([serverResponse])); - - // we get the response the first time - const response = await service.getParticipantRoles('Respondent'); - expect(response).toEqual([serverResponse]); - - // second time we get a cached value - await service.getParticipantRoles('Respondent'); - expect(clientApiSpy.getParticipantRoles).toHaveBeenCalledTimes(1); - }); - it('should remove currently cached hearing when cancelling', () => { const model = new HearingModel(); model.hearing_id = 'hearingId'; @@ -180,7 +157,6 @@ describe('Video hearing service', () => { model.supplier = VideoSupplier.Vodafone; const request = service.mapHearing(model); - expect(request.case_type_name).toBe('Tax'); expect(request.hearing_room_name).toBe('room 09'); expect(request.other_information).toBe('note'); expect(request.cases).toBeTruthy(); @@ -198,9 +174,7 @@ describe('Video hearing service', () => { const request = service.mapHearingDetailsResponseToHearingModel(model); expect(request.hearing_id).toEqual(model.id); - expect(request.case_type).toBe('Tax'); expect(request.court_room).toBe('room 09'); - expect(request.court_name).toBe('court address'); expect(request.other_information).toBe('note'); expect(request.cases).toBeTruthy(); expect(request.cases[0].name).toBe('case1'); @@ -243,11 +217,8 @@ describe('Video hearing service', () => { caseModel.number = 'Number 1'; const model = new HearingDetailsResponse(); model.id = '232423423jsn'; - model.case_type_name = 'Tax'; - model.hearing_type_name = 'hearing type'; model.scheduled_date_time = new Date(date); model.scheduled_duration = 30; - model.hearing_venue_name = 'court address'; model.hearing_room_name = 'room 09'; model.other_information = 'note'; model.cases = [caseModel]; @@ -268,7 +239,6 @@ describe('Video hearing service', () => { model.audio_recording_required = true; model.group_id = null; model.multi_day_hearing_last_day_scheduled_date_time = new Date(date); - return model; } }); @@ -284,7 +254,6 @@ describe('Video hearing service', () => { participant.display_name = 'Dan Smith'; participant.contact_email = 'dan@hmcts.net'; participant.telephone_number = '123123123'; - participant.case_role_name = 'Respondent'; participant.hearing_role_name = 'Litigant in person'; participant.user_role_name = 'Individual'; participant.interpreter_language = null; @@ -299,7 +268,6 @@ describe('Video hearing service', () => { judgeParticipant.display_name = 'Judge Test'; judgeParticipant.contact_email = 'judge@hmcts.net'; judgeParticipant.telephone_number = '123123123'; - judgeParticipant.case_role_name = null; judgeParticipant.hearing_role_name = null; judgeParticipant.user_role_name = 'Judge'; judgeParticipant.interpreter_language = null; @@ -315,7 +283,6 @@ describe('Video hearing service', () => { expect(model[0].display_name).toEqual(participant.display_name); expect(model[0].email).toEqual(participant.contact_email); expect(model[0].phone).toEqual(participant.telephone_number); - expect(model[0].case_role_name).toEqual(participant.case_role_name); expect(model[0].hearing_role_name).toEqual(participant.hearing_role_name); expect(model[0].is_judge).toBeFalse(); expect(model[0].interpretation_language).toBeNull(); @@ -328,7 +295,6 @@ describe('Video hearing service', () => { expect(model[1].display_name).toEqual(judgeParticipant.display_name); expect(model[1].email).toEqual(judgeParticipant.contact_email); expect(model[1].phone).toEqual(judgeParticipant.telephone_number); - expect(model[1].case_role_name).toEqual(judgeParticipant.case_role_name); expect(model[1].hearing_role_name).toEqual(judgeParticipant.hearing_role_name); expect(model[1].is_judge).toBeTrue(); expect(model[1].interpretation_language).toBeNull(); @@ -345,7 +311,6 @@ describe('Video hearing service', () => { participant.display_name = 'Dan Smith'; participant.email = 'dan@hmcts.net'; participant.phone = '123123123'; - participant.case_role_name = 'Respondent'; participant.hearing_role_name = 'Litigant in person'; participants.push(participant); @@ -359,8 +324,6 @@ describe('Video hearing service', () => { expect(model[0].display_name).toEqual(participant.display_name); expect(model[0].contact_email).toEqual(participant.email); expect(model[0].telephone_number).toEqual(participant.phone); - expect(model[0].case_role_name).toEqual(participant.case_role_name); - expect(model[0].hearing_role_name).toEqual(participant.hearing_role_name); }); it('should map Existing hearing', () => { @@ -374,7 +337,6 @@ describe('Video hearing service', () => { participant.display_name = 'Dan Smith'; participant.email = 'dan@hmcts.net'; participant.phone = '123123123'; - participant.case_role_name = 'Respondent'; participant.hearing_role_name = 'Litigant in person'; const interpretationLanguage: InterpreterSelectedDto = { signLanguageCode: null, @@ -430,7 +392,6 @@ describe('Video hearing service', () => { expect(actualParticipant.last_name).toEqual(expectedParticipant.last_name); expect(actualParticipant.middle_names).toEqual(expectedParticipant.middle_names); expect(actualParticipant.hearing_role_name).toEqual(expectedParticipant.hearing_role_name); - expect(actualParticipant.case_role_name).toEqual(expectedParticipant.case_role_name); expect(actualCase.name).toEqual(expectedCase.name); expect(actualCase.number).toEqual(expectedCase.number); expect(actualEndpoint).toEqual(expectedEndpoint); @@ -450,7 +411,6 @@ describe('Video hearing service', () => { participant.display_name = 'Dan Smith'; participant.email = 'dan@hmcts.net'; participant.phone = '123123123'; - participant.case_role_name = 'Respondent'; participant.hearing_role_name = 'Litigant in person'; const linkedParticipants: LinkedParticipantModel[] = []; const linkedParticipantModel = new LinkedParticipantModel(); @@ -491,7 +451,6 @@ describe('Video hearing service', () => { expect(editHearingRequest.participants[0].last_name).toEqual(hearingModel.participants[0].last_name); expect(editHearingRequest.participants[0].middle_names).toEqual(hearingModel.participants[0].middle_names); expect(editHearingRequest.participants[0].hearing_role_name).toEqual(hearingModel.participants[0].hearing_role_name); - expect(editHearingRequest.participants[0].case_role_name).toEqual(hearingModel.participants[0].case_role_name); expect(editHearingRequest.case.name).toEqual(hearingModel.cases[0].name); expect(editHearingRequest.case.number).toEqual(hearingModel.cases[0].number); expect(editHearingRequest.audio_recording_required).toEqual(hearingModel.audio_recording_required); diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/video-hearings.service.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/video-hearings.service.ts index 2b99361e9..f6cfe9a94 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/video-hearings.service.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/video-hearings.service.ts @@ -6,7 +6,6 @@ import { BookingDetailsRequest, BookingStatus, CancelMultiDayHearingRequest, - CaseAndHearingRolesResponse, CaseRequest, CaseResponse, EditCaseRequest, @@ -55,7 +54,6 @@ export class VideoHearingsService { private readonly totalHearingsCountThreshold: number = 40; private modelHearing: HearingModel; - private readonly participantRoles = new Map(); private readonly judiciaryRoles = Constants.JudiciaryRoles; constructor(private readonly bhClient: BHClient) { @@ -116,8 +114,8 @@ export class VideoHearingsService { sessionStorage.removeItem(this.vhoNonAvailabiltiesHaveChangesKey); } - getHearingTypes(includeDeleted: boolean = false): Observable { - return this.bhClient.getHearingTypes(includeDeleted); + getHearingTypes(): Observable { + return this.bhClient.getHearingTypes(); } getCurrentRequest(): HearingModel { @@ -141,15 +139,6 @@ export class VideoHearingsService { sessionStorage.setItem(this.newRequestKey, localRequest); } - async getParticipantRoles(caseTypeName: string): Promise { - if (this.participantRoles.has(caseTypeName)) { - return this.participantRoles.get(caseTypeName); - } - const roles = await firstValueFrom(this.bhClient.getParticipantRoles(caseTypeName)); - this.participantRoles.set(caseTypeName, roles); - return roles; - } - async getHearingRoles(): Promise { const roles = await firstValueFrom(this.bhClient.getHearingRoles()); return roles; @@ -281,7 +270,6 @@ export class VideoHearingsService { const editParticipant = new EditParticipantRequest(); editParticipant.id = participant.id; editParticipant.external_reference_id = participant.externalReferenceId; - editParticipant.case_role_name = participant.case_role_name; editParticipant.contact_email = participant.email; editParticipant.display_name = participant.display_name; editParticipant.first_name = participant.first_name; @@ -330,7 +318,6 @@ export class VideoHearingsService { mapHearing(newRequest: HearingModel): BookingDetailsRequest { const newHearingRequest = new BookingDetailsRequest(); newHearingRequest.cases = this.mapCases(newRequest); - newHearingRequest.case_type_name = newRequest.case_type; newHearingRequest.case_type_service_id = newRequest.case_type_service_id; newHearingRequest.scheduled_date_time = new Date(newRequest.scheduled_date_time); newHearingRequest.scheduled_duration = newRequest.scheduled_duration; @@ -351,10 +338,8 @@ export class VideoHearingsService { const hearing = new HearingModel(); hearing.hearing_id = response.id; hearing.cases = this.mapCaseResponseToCaseModel(response.cases); - hearing.case_type = response.case_type_name; hearing.scheduled_date_time = new Date(response.scheduled_date_time); hearing.scheduled_duration = response.scheduled_duration; - hearing.court_name = response.hearing_venue_name; hearing.court_code = response.hearing_venue_code; hearing.court_room = response.hearing_room_name; hearing.participants = this.mapParticipantResponseToParticipantModel(response.participants); @@ -436,8 +421,6 @@ export class VideoHearingsService { participant.display_name = p.display_name; participant.contact_email = p.email; participant.telephone_number = p.phone; - participant.case_role_name = p.case_role_name; - participant.hearing_role_name = p.hearing_role_name; participant.hearing_role_code = p.hearing_role_code; participant.representee = p.representee; participant.organisation_name = p.company; @@ -494,7 +477,6 @@ export class VideoHearingsService { participant.display_name = p.display_name; participant.email = p.contact_email; participant.phone = p.telephone_number; - participant.case_role_name = p.case_role_name; participant.hearing_role_name = p.hearing_role_name; participant.hearing_role_code = p.hearing_role_code; participant.representee = p.representee; diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/shared/menus/case-types-menu/case-types-menu.component.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/shared/menus/case-types-menu/case-types-menu.component.ts index 58bf559d0..e36339ce2 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/shared/menus/case-types-menu/case-types-menu.component.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/shared/menus/case-types-menu/case-types-menu.component.ts @@ -34,7 +34,7 @@ export class CaseTypesMenuComponent extends MenuBase { loadItems(): void { const distinct = (value, index, array) => array.indexOf(value) === index; - this.videoHearingService.getHearingTypes(true).subscribe({ + this.videoHearingService.getHearingTypes().subscribe({ next: (data: HearingTypeResponse[]) => { this.caseTypes = this.items = [ ...Array.from( diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/testing/data/response-test-data.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/testing/data/response-test-data.ts index fd8ff7512..0e226487d 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/testing/data/response-test-data.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/testing/data/response-test-data.ts @@ -19,13 +19,9 @@ export class ResponseTestData { caseHearing.number = 'XX3456234565'; response.cases = []; response.cases.push(caseHearing); - response.hearing_type_name = 'Tax'; response.id = '1'; response.scheduled_date_time = new Date('2019-10-22 13:58:40.3730067'); response.scheduled_duration = 125; - response.hearing_venue_name = 'Coronation Street'; - response.case_type_name = 'Generic'; - response.hearing_type_name = 'Automated Test'; response.other_information = 'some note'; response.hearing_room_name = '777'; response.created_date = new Date('2019-10-22 13:58:40.3730067'); @@ -125,7 +121,6 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JadgeGreen', '33A', 'Coronation Street', @@ -148,7 +143,6 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JadgeGreen', '33A', 'Coronation Street', @@ -170,7 +164,6 @@ export class ResponseTestData { new Date('2019-12-22 13:58:40.3730067'), 120, 'XX3456234565', - 'Smith vs Donner', 'Tax', 'JadgeGreen', '33A', @@ -208,7 +201,6 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JadgeGreen', '33A', 'Coronation Street', @@ -231,7 +223,6 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JadgeGreen', '33A', 'Coronation Street', @@ -254,7 +245,6 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JadgeGreen', '33A', 'Coronation Street', @@ -285,7 +275,6 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JadgeGreen', '33A', 'Coronation Street', @@ -308,7 +297,6 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JadgeGreen', '33A', 'Coronation Street', @@ -331,7 +319,6 @@ export class ResponseTestData { 120, 'XX3456234565', 'Smith vs Donner', - 'Tax', 'JadgeGreen', '33A', 'Coronation Street', @@ -380,7 +367,6 @@ export class ResponseTestData { bhr.court_room = '12A'; bhr.hearing_name = 'A vs B'; bhr.hearing_number = '123A'; - bhr.hearing_type_name = 'Tax'; bhr.judge_name = 'Judge'; bhr.scheduled_duration = 45; bhr.created_by = 'Roy'; @@ -397,7 +383,6 @@ export class ResponseTestData { bhr1.court_room = '12A'; bhr1.hearing_name = 'A vs B'; bhr1.hearing_number = '123A'; - bhr1.hearing_type_name = 'Tax'; bhr1.judge_name = 'Judge'; bhr1.scheduled_duration = 45; bhr1.created_by = 'Roy'; diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/testing/stubs/service-service-stub.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/testing/stubs/service-service-stub.ts index 0ad118112..b8a32214d 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/testing/stubs/service-service-stub.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/testing/stubs/service-service-stub.ts @@ -1,8 +1,8 @@ import { IDropDownModel } from 'src/app/common/model/drop-down.model'; import { Observable, of } from 'rxjs'; -import { PersonResponse } from '../../services/clients/api-client'; +import { PersonResponseV2 } from '../../services/clients/api-client'; -const participantList: PersonResponse[] = JSON.parse( +const participantList: PersonResponseV2[] = JSON.parse( ` [ { diff --git a/AdminWebsite/AdminWebsite/Contracts/Requests/BookingDetailsRequest.cs b/AdminWebsite/AdminWebsite/Contracts/Requests/BookingDetailsRequest.cs index 968ed8690..9af81192f 100644 --- a/AdminWebsite/AdminWebsite/Contracts/Requests/BookingDetailsRequest.cs +++ b/AdminWebsite/AdminWebsite/Contracts/Requests/BookingDetailsRequest.cs @@ -15,7 +15,6 @@ public class BookingDetailsRequest public int ScheduledDuration { get; set; } public string HearingVenueCode { get; set; } - public string CaseTypeName { get; set; } public string CaseTypeServiceId { get; set; } public List Cases { get; set; } public List Participants { get; set; } diff --git a/AdminWebsite/AdminWebsite/Contracts/Requests/ParticipantRequest.cs b/AdminWebsite/AdminWebsite/Contracts/Requests/ParticipantRequest.cs index a5accf69d..4451704c8 100644 --- a/AdminWebsite/AdminWebsite/Contracts/Requests/ParticipantRequest.cs +++ b/AdminWebsite/AdminWebsite/Contracts/Requests/ParticipantRequest.cs @@ -16,8 +16,6 @@ public class ParticipantRequest [StringLength(255, ErrorMessage = "Display name max length is 255 characters")] [RegularExpression(@"^[\p{L}\p{N}\s',._-]+$")] public string DisplayName { get; set; } - public string CaseRoleName { get; set; } - public string HearingRoleName { get; set; } public string HearingRoleCode { get; set; } public string Representee { get; set; } public string OrganisationName { get; set; } diff --git a/AdminWebsite/AdminWebsite/Contracts/Responses/HearingDetailsResponse.cs b/AdminWebsite/AdminWebsite/Contracts/Responses/HearingDetailsResponse.cs index e0e5a5df9..a61e338c2 100644 --- a/AdminWebsite/AdminWebsite/Contracts/Responses/HearingDetailsResponse.cs +++ b/AdminWebsite/AdminWebsite/Contracts/Responses/HearingDetailsResponse.cs @@ -10,35 +10,19 @@ public class HearingDetailsResponse public DateTime ScheduledDateTime { get; set; } public int ScheduledDuration { get; set; } /// - /// V1 only - /// - public string HearingVenueName { get; set; } - /// /// V2 only /// public string HearingVenueCode { get; set; } /// - /// V1 only - /// - public string CaseTypeName { get; set; } - /// /// V2 only /// public string ServiceId { get; set; } /// - /// V1 only - /// - public string HearingTypeName { get; set; } - /// /// V2 only /// public string HearingTypeCode { get; set; } public List Cases { get; set; } public List Participants { get; set; } - /// - /// V1 only - /// - public List TelephoneParticipants { get; set; } public List JudiciaryParticipants { get; set; } diff --git a/AdminWebsite/AdminWebsite/Contracts/Responses/HearingTypeResponse.cs b/AdminWebsite/AdminWebsite/Contracts/Responses/HearingTypeResponse.cs new file mode 100644 index 000000000..b642b68eb --- /dev/null +++ b/AdminWebsite/AdminWebsite/Contracts/Responses/HearingTypeResponse.cs @@ -0,0 +1,23 @@ +namespace AdminWebsite.Contracts.Responses +{ + /// + /// Defines a type of hearing based on case + /// + public class HearingTypeResponse + { + /// + /// Which case type it belongs to + /// + public string Group { get; set; } + + /// + /// Unique identifier for this type of hearing + /// + public int? Id { get; set; } + + /// + /// The service id for the type + /// + public string ServiceId { get; set; } + } +} diff --git a/AdminWebsite/AdminWebsite/Controllers/HearingsController.cs b/AdminWebsite/AdminWebsite/Controllers/HearingsController.cs index 6efa8a9e6..9be83bd1d 100644 --- a/AdminWebsite/AdminWebsite/Controllers/HearingsController.cs +++ b/AdminWebsite/AdminWebsite/Controllers/HearingsController.cs @@ -6,7 +6,6 @@ using AdminWebsite.Attributes; using AdminWebsite.Contracts.Enums; using AdminWebsite.Contracts.Requests; -using AdminWebsite.Contracts.Responses; using AdminWebsite.Extensions; using AdminWebsite.Helper; using AdminWebsite.Mappers; @@ -21,7 +20,6 @@ using BookingsApi.Contract.V2.Enums; using BookingsApi.Contract.V2.Requests; using BookingsApi.Contract.V2.Responses; -using FluentValidation; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Newtonsoft.Json; @@ -45,7 +43,6 @@ namespace AdminWebsite.Controllers public class HearingsController : ControllerBase { private readonly IBookingsApiClient _bookingsApiClient; - private readonly IValidator _editHearingRequestValidator; private readonly IHearingsService _hearingsService; private readonly IConferenceDetailsService _conferenceDetailsService; private readonly ILogger _logger; @@ -57,14 +54,12 @@ public class HearingsController : ControllerBase #pragma warning disable S107 public HearingsController(IBookingsApiClient bookingsApiClient, IUserIdentity userIdentity, - IValidator editHearingRequestValidator, ILogger logger, IHearingsService hearingsService, IConferenceDetailsService conferenceDetailsService) { _bookingsApiClient = bookingsApiClient; _userIdentity = userIdentity; - _editHearingRequestValidator = editHearingRequestValidator; _logger = logger; _hearingsService = hearingsService; _conferenceDetailsService = conferenceDetailsService; @@ -250,14 +245,6 @@ public async Task> EditHearing(Guid hearing } _logger.LogDebug("Attempting to edit hearing {Hearing}", hearingId); - var result = await _editHearingRequestValidator.ValidateAsync(request); - if (!result.IsValid) - { - _logger.LogWarning("Failed edit hearing validation"); - ModelState.AddFluentValidationErrors(result.Errors); - return ValidationProblem(ModelState); - } - HearingDetailsResponse originalHearing; try { @@ -438,8 +425,8 @@ private async Task UpdateMultiDayHearing(EditMultiDayHearingRequest request, Gui hearingsToUpdate = hearingsToUpdate .Where(h => - h.Status != BookingsApi.Contract.V2.Enums.BookingStatusV2.Cancelled && - h.Status != BookingsApi.Contract.V2.Enums.BookingStatusV2.Failed) + h.Status != BookingStatusV2.Cancelled && + h.Status != BookingStatusV2.Failed) .ToList(); await UpdateMultiDayHearingV2(hearingsToUpdate, hearingId, groupId, request); diff --git a/AdminWebsite/AdminWebsite/Controllers/ReferenceData/HearingTypesController.cs b/AdminWebsite/AdminWebsite/Controllers/ReferenceData/HearingTypesController.cs new file mode 100644 index 000000000..2181092c7 --- /dev/null +++ b/AdminWebsite/AdminWebsite/Controllers/ReferenceData/HearingTypesController.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using AdminWebsite.Contracts.Responses; +using AdminWebsite.Services; +using Microsoft.AspNetCore.Mvc; + +namespace AdminWebsite.Controllers.ReferenceData; + +/// +/// Responsible for retrieving hearing types reference data when requesting a booking. +/// +public class HearingTypesController : ReferenceDataControllerBase +{ + private readonly IReferenceDataService _referenceDataService; + + /// + /// Instantiate the controller + /// + public HearingTypesController(IReferenceDataService referenceDataService) + { + _referenceDataService = referenceDataService; + } + + /// + /// Gets a list hearing types + /// + /// List of hearing types + [HttpGet("types", Name = "GetHearingTypes")] + [ProducesResponseType(typeof(IList), (int)HttpStatusCode.OK)] + [ProducesResponseType((int)HttpStatusCode.NotFound)] + public async Task>> GetHearingTypes() + { + var caseTypes = await _referenceDataService.GetNonDeletedCaseTypesAsync(); + var result = caseTypes.Select(caseType => new HearingTypeResponse + { + Group = caseType.Name, + Id = caseType.Id, + ServiceId = caseType.ServiceId + }).ToList(); + + return Ok(result); + } +} \ No newline at end of file diff --git a/AdminWebsite/AdminWebsite/Controllers/WorkAllocationController.cs b/AdminWebsite/AdminWebsite/Controllers/WorkAllocationController.cs index a832079cf..9b9bf4989 100644 --- a/AdminWebsite/AdminWebsite/Controllers/WorkAllocationController.cs +++ b/AdminWebsite/AdminWebsite/Controllers/WorkAllocationController.cs @@ -36,7 +36,7 @@ public WorkAllocationController(IBookingsApiClient bookingsApiClient) [ProducesResponseType(typeof(UnallocatedHearingsForVhoResponse), (int)HttpStatusCode.OK)] public async Task GetUnallocatedHearings() { - var unallocatedHearings = await _bookingsApiClient.GetUnallocatedHearingsAsync(); + var unallocatedHearings = await _bookingsApiClient.GetUnallocatedHearingsV2Async(); if (unallocatedHearings == null || unallocatedHearings.Count == 0) return Ok(UnallocatedHearingsForVhoMapper.MapFrom(new List(), DateTime.Today)); diff --git a/AdminWebsite/AdminWebsite/Mappers/HearingDetailsResponseMapper.cs b/AdminWebsite/AdminWebsite/Mappers/HearingDetailsResponseMapper.cs index a2fbcd16c..4d6d197aa 100644 --- a/AdminWebsite/AdminWebsite/Mappers/HearingDetailsResponseMapper.cs +++ b/AdminWebsite/AdminWebsite/Mappers/HearingDetailsResponseMapper.cs @@ -16,10 +16,8 @@ public static HearingDetailsResponse Map(this V2.HearingDetailsResponseV2 hearin Id = hearingDetails.Id, ScheduledDateTime = hearingDetails.ScheduledDateTime, ScheduledDuration = hearingDetails.ScheduledDuration, - HearingVenueName = hearingDetails.HearingVenueName, HearingVenueCode = hearingDetails.HearingVenueCode, ServiceId = hearingDetails.ServiceId, - CaseTypeName = hearingDetails.ServiceName, Cases = hearingDetails.Cases?.Select(e => new CaseResponse { IsLeadCase = e.IsLeadCase, diff --git a/AdminWebsite/AdminWebsite/packages.lock.json b/AdminWebsite/AdminWebsite/packages.lock.json index ae65e23a2..b10e83716 100644 --- a/AdminWebsite/AdminWebsite/packages.lock.json +++ b/AdminWebsite/AdminWebsite/packages.lock.json @@ -14,11 +14,11 @@ }, "BookingsApi.Client": { "type": "Direct", - "requested": "[3.1.2-pr-0919-0010, )", - "resolved": "3.1.2-pr-0919-0010", - "contentHash": "uTjHes/RCMLANtbDLm2sfQTdqSA/90fwUGb2KthKSsZWpjoYdZtJYDjLtTNFqeH7qAKQTV0herli/gAyAAP0hg==", + "requested": "[3.1.2-pr-0919-0013, )", + "resolved": "3.1.2-pr-0919-0013", + "contentHash": "obv+kZ7pXc1ijmIiFzwEmFca1sNIIodlRHwzoiX5fUaIGNwX4Zgm4UZYEx2aM3kn0z1CMVXiYSerD6TGiNf4MA==", "dependencies": { - "BookingsApi.Common.DotNet6": "3.1.2-pr-0919-0010", + "BookingsApi.Common.DotNet6": "3.1.2-pr-0919-0013", "Microsoft.AspNetCore.Mvc.Core": "2.2.5", "System.Text.Json": "8.0.5" } @@ -135,9 +135,9 @@ }, "Microsoft.Identity.Client": { "type": "Direct", - "requested": "[4.61.0, )", - "resolved": "4.61.0", - "contentHash": "3TDPEie+9t/NgBhoNifLFwM6nkypYUa8GUHfMnkYtovDDTQM8bsS2KEIP5tAh28BgfJZgof/KlCEKvGxz0H3Eg==", + "requested": "[4.61.3, )", + "resolved": "4.61.3", + "contentHash": "naJo/Qm35Caaoxp5utcw+R8eU8ZtLz2ALh8S+gkekOYQ1oazfCQMWVT4NJ/FnHzdIJlm8dMz0oMpMGCabx5odA==", "dependencies": { "Microsoft.IdentityModel.Abstractions": "6.35.0", "System.Diagnostics.DiagnosticSource": "6.0.1" @@ -271,8 +271,8 @@ }, "BookingsApi.Common.DotNet6": { "type": "Transitive", - "resolved": "3.1.2-pr-0919-0010", - "contentHash": "JBKWH0dvKUOBh9AnUV0C6ExjeV0Wem3bfmk7Gkxrqnc+Iz5cUvz6zyMMnGVX1mFlsEgrxVeJXj/DoTV0YCyN0Q==", + "resolved": "3.1.2-pr-0919-0013", + "contentHash": "BV8KrhMjIlCeRJajRCQ6X47VJSBAIql8O/1JSOgISVnnxTSNKiBc9htjyXgAsobkbAv6ylSTYVi6UENFp8BOiw==", "dependencies": { "System.Text.Json": "8.0.5" } diff --git a/AdminWebsite/nuget.config b/AdminWebsite/nuget.config index c08c54db9..b9a3fec90 100644 --- a/AdminWebsite/nuget.config +++ b/AdminWebsite/nuget.config @@ -20,6 +20,7 @@ +