Skip to content

Commit

Permalink
Capture Conference Room type and endpoint conference role and push to…
Browse files Browse the repository at this point in the history
… Video API
  • Loading branch information
Shaed Parkar committed Oct 11, 2024
1 parent a58210b commit ac495a2
Show file tree
Hide file tree
Showing 14 changed files with 130 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BookingsApi.Client" Version="2.3.1" />
<PackageReference Include="BookingsApi.Client" Version="2.3.9" />
<PackageReference Include="LaunchDarkly.ServerSdk" Version="7.0.3" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"net6.0": {
"BookingsApi.Client": {
"type": "Direct",
"requested": "[2.3.1, )",
"resolved": "2.3.1",
"contentHash": "fELMrU9fK/QaLJo9rw1BKPKDWiNIypCXicOC61lkXkdAraQfeEIOuyQtVsopIl+PpUkHmkdbeXBITP+zS55y5w==",
"requested": "[2.3.9, )",
"resolved": "2.3.9",
"contentHash": "Bzwufird9sw4QpyCuJBQpcNDuAZXmZWCjLMdoYyFUDdRlJm1xE9uMXaaOyYK2FFPE5WfLAftC/o0nYhhSgFeiQ==",
"dependencies": {
"Microsoft.AspNetCore.Mvc.Core": "2.2.5"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BookingsApi.Client" Version="2.3.1" />
<PackageReference Include="BookingsApi.Client" Version="2.3.9" />
<PackageReference Include="LaunchDarkly.ServerSdk" Version="7.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.9.0.77355">
Expand All @@ -23,11 +23,11 @@
</PackageReference>
<PackageReference Include="TimeZoneConverter" Version="3.3.0" />
<PackageReference Include="UserApi.Client" Version="2.1.1" />
<PackageReference Include="NotificationApi.Client" Version="2.1.3" />
<PackageReference Include="NotificationApi.Client" Version="2.3.4" />

<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.25.0" />

<PackageReference Include="VideoApi.Client" Version="2.2.11" />
<PackageReference Include="VideoApi.Client" Version="2.2.27-pr-0688-0005" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,28 @@ public Task<ICollection<HearingRoleResponseV2>> GetHearingRolesForCaseRoleV2Asyn
throw new NotImplementedException();
}

public Task<EndpointResponseV2> AddEndPointToHearingV2Async(Guid hearingId, EndpointRequestV2 addEndpointRequest)
{
throw new NotImplementedException();
}

public Task<EndpointResponseV2> AddEndPointToHearingV2Async(Guid hearingId, EndpointRequestV2 addEndpointRequest,
CancellationToken cancellationToken)
{
throw new NotImplementedException();
}

public Task UpdateEndpointV2Async(Guid hearingId, Guid endpointId, UpdateEndpointRequestV2 updateEndpointRequest)
{
throw new NotImplementedException();
}

public Task UpdateEndpointV2Async(Guid hearingId, Guid endpointId, UpdateEndpointRequestV2 updateEndpointRequest,
CancellationToken cancellationToken)
{
throw new NotImplementedException();
}

public Task<ICollection<HearingDetailsResponseV2>> GetHearingsForTodayByCsosV2Async(HearingsForTodayByAllocationRequestV2 request)
{
throw new NotImplementedException();
Expand All @@ -863,6 +885,17 @@ public Task<ICollection<HearingDetailsResponseV2>> GetHearingsForTodayByCsosV2As
throw new NotImplementedException();
}

public Task<ICollection<ParticipantResponseV2>> AddParticipantsToHearingV2Async(Guid hearingId, AddParticipantsToHearingRequestV2 request)
{
throw new NotImplementedException();
}

public Task<ICollection<ParticipantResponseV2>> AddParticipantsToHearingV2Async(Guid hearingId, AddParticipantsToHearingRequestV2 request,
CancellationToken cancellationToken)
{
throw new NotImplementedException();
}

public Task<ICollection<ParticipantResponseV2>> AddParticipantsToHearing2Async(Guid hearingId, AddParticipantsToHearingRequestV2 request)
{
throw new NotImplementedException();
Expand All @@ -885,6 +918,17 @@ public Task<ParticipantResponseV2> UpdateParticipantDetailsV2Async(Guid hearingI
throw new NotImplementedException();
}

public Task<ICollection<ParticipantResponseV2>> UpdateHearingParticipantsV2Async(Guid hearingId, UpdateHearingParticipantsRequestV2 request)
{
throw new NotImplementedException();
}

public Task<ICollection<ParticipantResponseV2>> UpdateHearingParticipantsV2Async(Guid hearingId, UpdateHearingParticipantsRequestV2 request,
CancellationToken cancellationToken)
{
throw new NotImplementedException();
}

public Task UpdateHearingParticipants2Async(Guid hearingId, UpdateHearingParticipantsRequestV2 request)
{
throw new NotImplementedException();
Expand Down Expand Up @@ -916,6 +960,16 @@ public Task<HearingDetailsResponseV2> GetHearingDetailsByIdV2Async(Guid hearingI
throw new NotImplementedException();
}

public Task<HearingDetailsResponseV2> UpdateHearingDetailsV2Async(Guid hearingId, UpdateHearingRequestV2 request)
{
throw new NotImplementedException();
}

public Task<HearingDetailsResponseV2> UpdateHearingDetailsV2Async(Guid hearingId, UpdateHearingRequestV2 request, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}

public Task<HearingDetailsResponseV2> UpdateHearingDetails2Async(Guid hearingId, UpdateHearingRequestV2 request)
{
throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using VideoApi.Contract.Enums;
using VideoApi.Contract.Requests;
using ConferenceRole = VideoApi.Contract.Enums.ConferenceRole;
using ConferenceRoomType = VideoApi.Contract.Enums.ConferenceRoomType;

namespace BookingQueueSubscriber.Services.Mappers
{
Expand Down Expand Up @@ -27,7 +29,7 @@ public static BookNewConferenceRequest MapToBookNewConferenceRequest(HearingDto
Endpoints = PopulateAddEndpointRequests(endpointDtos, participantDtos).ToList(),
CaseTypeServiceId = hearingDto.CaseTypeServiceId,
Supplier = (Supplier)hearingDto.VideoSupplier,
ConferenceRoomType = (VideoApi.Contract.Enums.ConferenceRoomType)hearingDto.ConferenceRoomType
ConferenceRoomType = (ConferenceRoomType)hearingDto.ConferenceRoomType
};

return request;
Expand All @@ -44,7 +46,7 @@ private static List<AddEndpointRequest> PopulateAddEndpointRequests(IEnumerable<
DisplayName = endpointDto.DisplayName,
Pin = endpointDto.Pin,
SipAddress = endpointDto.Sip,
Role = (VideoApi.Contract.Enums.ConferenceRole)endpointDto.Role
ConferenceRole = Enum.Parse<ConferenceRole>(endpointDto.Role.ToString())
});
}
return addEndpointRequests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using VideoApi.Contract.Requests;
using VideoApi.Contract.Responses;
using BookingQueueSubscriber.Services.VideoWeb;
using VideoApi.Contract.Enums;
using ConferenceRole = VideoApi.Contract.Enums.ConferenceRole;

namespace BookingQueueSubscriber.Services.MessageHandlers
{
Expand Down Expand Up @@ -32,7 +34,7 @@ public async Task HandleAsync(EndpointAddedIntegrationEvent eventMessage)
SipAddress = eventMessage.Endpoint.Sip,
Pin = eventMessage.Endpoint.Pin,
DefenceAdvocate = defenceAdvocate?.Username,
Role = eventMessage.Endpoint.Role
ConferenceRole = Enum.Parse<ConferenceRole>(eventMessage.Endpoint.Role.ToString())
});

var endpoints = await _videoApiService.GetEndpointsForConference(conference.Id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using VideoApi.Contract.Enums;
using VideoApi.Contract.Requests;
using VideoApi.Contract.Responses;
using ConferenceRole = VideoApi.Contract.Enums.ConferenceRole;

namespace BookingQueueSubscriber.Services.MessageHandlers
{
Expand Down Expand Up @@ -34,13 +35,12 @@ public async Task HandleAsync(EndpointUpdatedIntegrationEvent eventMessage)
else
{
var defenceAdvocate = await HandleEndpointDefenceAdvocateUpdate(conference, eventMessage);

await _videoApiService.UpdateEndpointInConference(conference.Id, eventMessage.Sip,
new UpdateEndpointRequest
{
DisplayName = eventMessage.DisplayName,
DefenceAdvocate = defenceAdvocate?.Username,
Role = (ConferenceRole) eventMessage.Role
ConferenceRole = Enum.Parse<ConferenceRole>(eventMessage.Role.ToString())
});

var endpoints = await _videoApiService.GetEndpointsForConference(conference.Id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"net6.0": {
"BookingsApi.Client": {
"type": "Direct",
"requested": "[2.3.1, )",
"resolved": "2.3.1",
"contentHash": "fELMrU9fK/QaLJo9rw1BKPKDWiNIypCXicOC61lkXkdAraQfeEIOuyQtVsopIl+PpUkHmkdbeXBITP+zS55y5w==",
"requested": "[2.3.9, )",
"resolved": "2.3.9",
"contentHash": "Bzwufird9sw4QpyCuJBQpcNDuAZXmZWCjLMdoYyFUDdRlJm1xE9uMXaaOyYK2FFPE5WfLAftC/o0nYhhSgFeiQ==",
"dependencies": {
"Microsoft.AspNetCore.Mvc.Core": "2.2.5"
}
Expand All @@ -33,9 +33,9 @@
},
"NotificationApi.Client": {
"type": "Direct",
"requested": "[2.1.3, )",
"resolved": "2.1.3",
"contentHash": "+7BiDpsJLK82OCoch76ighk8fQuq6wlO7i7leV3SsZtMmxWq1vQ9yjJkwsXwNVG6wH0T/lj2V8kywVcvG1pKSQ==",
"requested": "[2.3.4, )",
"resolved": "2.3.4",
"contentHash": "BwxsCI+DORSasyvqktvdWt2jUJIrxwTgLDVx/3sOBDJkqMKJsn+glINBsQ7/kgyldaZningYYuasa3+JIFSVKA==",
"dependencies": {
"Microsoft.AspNetCore.Mvc.Core": "2.2.5",
"Newtonsoft.Json": "13.0.3"
Expand Down Expand Up @@ -74,9 +74,9 @@
},
"VideoApi.Client": {
"type": "Direct",
"requested": "[2.2.11, )",
"resolved": "2.2.11",
"contentHash": "ciMnAm7RGQ+yFX+/YUHlzwcPwIVKfyv3kGmNlvBS9ewItIqOEhVXMXjmDVwMPixYFx+Yept0gmdivo8woo044w==",
"requested": "[2.2.27-pr-0688-0005, )",
"resolved": "2.2.27-pr-0688-0005",
"contentHash": "anCEOUzODQm9CQbxr2ywOfpeEUC3yIF9ZZ7g1nPmHVZ7G55K0MO/dZ84jwDIn8QZ5AUIlbQ1UjgdPxZpr3OTCw==",
"dependencies": {
"Microsoft.AspNetCore.Mvc.Core": "2.2.5",
"Newtonsoft.Json": "13.0.3"
Expand Down Expand Up @@ -1738,7 +1738,7 @@
"bookingqueuesubscriber.common": {
"type": "Project",
"dependencies": {
"BookingsApi.Client": "[2.3.1, )",
"BookingsApi.Client": "[2.3.9, )",
"LaunchDarkly.ServerSdk": "[7.0.3, )",
"Microsoft.ApplicationInsights": "[2.21.0, )",
"Microsoft.Azure.Functions.Extensions": "[1.1.0, )",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public async Task Should_handle_hearing_ready_for_video_integration_event()
'hearing_venue_name':'Birmingham Civil and Family Justice Centre',
'record_audio':true,
'video_supplier':'Vodafone',
'conference_room_type': 'VMR'
},
'participants':[
{
Expand Down Expand Up @@ -132,15 +133,15 @@ public async Task Should_handle_hearing_ready_for_video_integration_event()
'sip':'b5d8c1f5-ef19-4726-b722-3ef86bdfda95',
'pin':'1234',
'defence_advocate_username':null,
'role':1
'role':'host'
},
{
'$type':'BookingsApi.Infrastructure.Services.Dtos.EndpointDto, BookingsApi.Infrastructure.Services',
'display_name':'display 2',
'sip':'72677f04-65d0-41d3-bfe8-845f666c2198',
'pin':'5678',
'defence_advocate_username':null
'role':1
'defence_advocate_username':null,
'role':'host'
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using BookingQueueSubscriber.Services.Mappers;
using BookingQueueSubscriber.Services.MessageHandlers.Dtos;
using VideoApi.Contract.Enums;
using ConferenceRole = VideoApi.Contract.Enums.ConferenceRole;

namespace BookingQueueSubscriber.UnitTests.Mappers
{
Expand Down Expand Up @@ -29,7 +30,13 @@ public void should_map_hearing_dto_to_book_new_conference_request()
request.HearingRefId.Should().Be(hearingDto.HearingId);
request.Participants.Count.Should().Be(participants.Count);
request.Endpoints.Count.Should().Be(endpoints.Count);
request.Endpoints.First(x => x.DisplayName == "one").DefenceAdvocate.Should().NotBeEmpty();

var firstEndpoint = request.Endpoints.First(x => x.DisplayName == "one");
firstEndpoint.DefenceAdvocate.Should().NotBeEmpty();
firstEndpoint.ConferenceRole.Should().Be(ConferenceRole.Host);

var thirdEndpoint = request.Endpoints.First(x => x.DisplayName == "three");
thirdEndpoint.ConferenceRole.Should().Be(ConferenceRole.Guest);
}

private static HearingDto CreateHearingDto()
Expand Down Expand Up @@ -58,10 +65,11 @@ private static List<EndpointDto> CreateEndpoints(IEnumerable<ParticipantDto> par
{
new EndpointDto
{
DisplayName = "one", Sip = Guid.NewGuid().ToString(), Pin = "1234", DefenceAdvocateContactEmail = rep.ContactEmail
DisplayName = "one", Sip = Guid.NewGuid().ToString(), Pin = "1234", DefenceAdvocateContactEmail = rep.ContactEmail,
Role = Services.MessageHandlers.Dtos.ConferenceRole.Host
},
new EndpointDto {DisplayName = "two", Sip = Guid.NewGuid().ToString(), Pin = "5678"},
new EndpointDto {DisplayName = "three", Sip = Guid.NewGuid().ToString(), Pin = "9012"}
new EndpointDto {DisplayName = "two", Sip = Guid.NewGuid().ToString(), Pin = "5678", Role = Services.MessageHandlers.Dtos.ConferenceRole.Host},
new EndpointDto {DisplayName = "three", Sip = Guid.NewGuid().ToString(), Pin = "9012", Role = Services.MessageHandlers.Dtos.ConferenceRole.Guest}
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
using BookingQueueSubscriber.Services.MessageHandlers;
using BookingQueueSubscriber.Services.MessageHandlers.Core;
using BookingQueueSubscriber.Services.MessageHandlers.Dtos;
using VideoApi.Contract.Enums;
using VideoApi.Contract.Requests;
using VideoApi.Contract.Responses;
using ConferenceRole = VideoApi.Contract.Enums.ConferenceRole;

namespace BookingQueueSubscriber.UnitTests.MessageHandlers
{
Expand Down Expand Up @@ -59,7 +61,8 @@ public async Task should_call_video_api_when_handle_is_called_with_explicit_inte
request.DisplayName == integrationEvent.Endpoint.DisplayName &&
request.DefenceAdvocate == integrationEvent.Endpoint.DefenceAdvocateContactEmail &&
request.SipAddress == integrationEvent.Endpoint.Sip &&
request.Pin == integrationEvent.Endpoint.Pin
request.Pin == integrationEvent.Endpoint.Pin &&
request.ConferenceRole == ConferenceRole.Host
)), Times.Once);

VideoWebServiceMock.Verify(x => x.PushEndpointsUpdatedMessage(It.IsAny<Guid>(),
Expand All @@ -71,7 +74,7 @@ private EndpointAddedIntegrationEvent GetIntegrationEvent()
return new EndpointAddedIntegrationEvent
{
HearingId = HearingId,
Endpoint = new EndpointDto{DisplayName = "one", Sip = Guid.NewGuid().ToString(), Pin = "1234"}
Endpoint = new EndpointDto{DisplayName = "one", Sip = Guid.NewGuid().ToString(), Pin = "1234", Role = Services.MessageHandlers.Dtos.ConferenceRole.Host}
};
}
}
Expand Down
Loading

0 comments on commit ac495a2

Please sign in to comment.