public void Should_map_all_properties() { var conference = new ConferenceBuilder() .WithConferenceStatus(ConferenceState.InSession) .WithConferenceStatus(ConferenceState.Paused) .WithConferenceStatus(ConferenceState.Closed) .WithMeetingRoom("https://poc.node.com", "*****@*****.**") .WithParticipants(3) .WithMessages(5) .WithInterpreterRoom() .Build(); var pexipSelfTestNode = "*****@*****.**"; var response = ConferenceToDetailsResponseMapper.MapConferenceToResponse(conference, pexipSelfTestNode); response.Should().BeEquivalentTo(conference, options => options .Excluding(x => x.HearingRefId) .Excluding(x => x.Participants) .Excluding(x => x.ConferenceStatuses) .Excluding(x => x.State) .Excluding(x => x.InstantMessageHistory) .Excluding(x => ExcludeIdFromMessage(x)) .Excluding(x => x.IngestUrl) .Excluding(x => x.ActualStartTime) .Excluding(x => x.Endpoints) .Excluding(x => x.CreatedDateTime) .Excluding(x => x.Rooms) ); response.StartedDateTime.Should().HaveValue().And.Be(conference.ActualStartTime); response.ClosedDateTime.Should().HaveValue().And.Be(conference.ClosedDateTime); response.CurrentStatus.Should().BeEquivalentTo(conference.GetCurrentStatus()); var participants = conference.GetParticipants(); response.Participants.Should().BeEquivalentTo(participants, options => options .Excluding(x => x.ParticipantRefId) .Excluding(x => x.TestCallResultId) .Excluding(x => x.TestCallResult) .Excluding(x => x.CurrentConsultationRoomId) .Excluding(x => x.CurrentConsultationRoom) .Excluding(x => x.CurrentRoom) .Excluding(x => x.State) .Excluding(x => x.LinkedParticipants) .Excluding(x => x.RoomParticipants) ); var civilianRoom = response.CivilianRooms.First(); var room = conference.Rooms.First(); civilianRoom.Id.Should().Be(room.Id); civilianRoom.Label.Should().Be(room.Label); civilianRoom.Participants.Select(x => x).Should() .BeEquivalentTo(room.RoomParticipants.Select(x => x.ParticipantId)); }
public async Task <IActionResult> BookNewConferenceAsync(BookNewConferenceRequest request) { _logger.LogDebug("BookNewConference"); foreach (var participant in request.Participants) { participant.Username = participant.Username.ToLower().Trim(); participant.Name = participant.Name.Trim(); participant.FirstName = participant.FirstName.Trim(); participant.LastName = participant.LastName.Trim(); participant.DisplayName = participant.DisplayName.Trim(); } var createAudioRecordingResponse = await CreateAudioApplicationWithRetryAsync(request); if (!createAudioRecordingResponse.Success) { return(StatusCode((int)createAudioRecordingResponse.StatusCode, createAudioRecordingResponse.Message)); } var conferenceId = await CreateConferenceWithRetiesAsync(request, createAudioRecordingResponse.IngestUrl); _logger.LogDebug("Conference Created"); var conferenceEndpoints = await _queryHandler.Handle <GetEndpointsForConferenceQuery, IList <Endpoint> >( new GetEndpointsForConferenceQuery(conferenceId)); var endpointDtos = conferenceEndpoints.Select(EndpointMapper.MapToEndpoint); var kinlyBookedSuccess = await BookKinlyMeetingRoomWithRetriesAsync(conferenceId, request.AudioRecordingRequired, createAudioRecordingResponse.IngestUrl, endpointDtos); if (!kinlyBookedSuccess) { var message = $"Could not book and find kinly meeting room for conferenceId: {conferenceId}"; _logger.LogError(message); return(StatusCode((int)HttpStatusCode.InternalServerError, message)); } _logger.LogDebug("Kinly Room Booked"); var getConferenceByIdQuery = new GetConferenceByIdQuery(conferenceId); var queriedConference = await _queryHandler.Handle <GetConferenceByIdQuery, Conference>(getConferenceByIdQuery); var response = ConferenceToDetailsResponseMapper.MapConferenceToResponse(queriedConference, _kinlyConfiguration.PexipSelfTestNode); _logger.LogInformation("Created conference {ResponseId} for hearing {HearingRefId}", response.Id, request.HearingRefId); return(CreatedAtAction("GetConferenceDetailsById", new { conferenceId = response.Id }, response)); }
public async Task <IActionResult> GetConferenceByHearingRefIdAsync(Guid hearingRefId, [FromQuery] bool?includeClosed = false) { _logger.LogDebug("GetConferenceByHearingRefId {HearingRefId}", hearingRefId); var query = new GetNonClosedConferenceByHearingRefIdQuery(hearingRefId, includeClosed.GetValueOrDefault()); var conference = await _queryHandler.Handle <GetNonClosedConferenceByHearingRefIdQuery, Conference>(query); if (conference == null) { _logger.LogWarning("Unable to find conference with hearing id {HearingRefId}", hearingRefId); return(NotFound()); } var response = ConferenceToDetailsResponseMapper.MapConferenceToResponse(conference, _kinlyConfiguration.PexipSelfTestNode); return(Ok(response)); }
public async Task <IActionResult> GetConferenceDetailsByIdAsync(Guid conferenceId) { _logger.LogDebug("GetConferenceDetailsById {ConferenceId}", conferenceId); var getConferenceByIdQuery = new GetConferenceByIdQuery(conferenceId); var queriedConference = await _queryHandler.Handle <GetConferenceByIdQuery, Conference>(getConferenceByIdQuery); if (queriedConference == null) { _logger.LogWarning("Unable to find conference {ConferenceId}", conferenceId); return(NotFound()); } var response = ConferenceToDetailsResponseMapper.MapConferenceToResponse(queriedConference, _kinlyConfiguration.PexipSelfTestNode); return(Ok(response)); }
public void Should_map_all_properties() { var conference = new ConferenceBuilder() .WithConferenceStatus(ConferenceState.InSession) .WithConferenceStatus(ConferenceState.Paused) .WithConferenceStatus(ConferenceState.Closed) .WithMeetingRoom("https://poc.node.com", "*****@*****.**") .WithParticipants(3) .WithMessages(5) .Build(); var pexipSelfTestNode = "*****@*****.**"; var response = ConferenceToDetailsResponseMapper.MapConferenceToResponse(conference, pexipSelfTestNode); response.Should().BeEquivalentTo(conference, options => options .Excluding(x => x.HearingRefId) .Excluding(x => x.Participants) .Excluding(x => x.ConferenceStatuses) .Excluding(x => x.State) .Excluding(x => x.InstantMessageHistory) .Excluding(x => ExcludeIdFromMessage(x)) .Excluding(x => x.IngestUrl) .Excluding(x => x.ActualStartTime) .Excluding(x => x.Endpoints) ); response.StartedDateTime.Should().HaveValue().And.Be(conference.ActualStartTime); response.ClosedDateTime.Should().HaveValue().And.Be(conference.ClosedDateTime); response.CurrentStatus.Should().BeEquivalentTo(conference.GetCurrentStatus()); var participants = conference.GetParticipants(); response.Participants.Should().BeEquivalentTo(participants, options => options .Excluding(x => x.ParticipantRefId) .Excluding(x => x.TestCallResultId) .Excluding(x => x.TestCallResult) .Excluding(x => x.CurrentRoom) .Excluding(x => x.State) ); }