public async Task <IActionResult> AddParticipantsToConferenceAsync(Guid conferenceId, AddParticipantsToConferenceRequest request) { _logger.LogDebug("AddParticipantsToConference"); var participants = request.Participants.Select(x => new Participant(x.ParticipantRefId, x.Name.Trim(), x.FirstName.Trim(), x.LastName.Trim(), x.DisplayName.Trim(), x.Username.ToLowerInvariant().Trim(), x.UserRole.MapToDomainEnum(), x.HearingRole, x.CaseTypeGroup, x.ContactEmail, x.ContactTelephone) { Representee = x.Representee }) .ToList(); var linkedParticipants = request.Participants .SelectMany(x => x.LinkedParticipants) .Select(x => new LinkedParticipantDto() { ParticipantRefId = x.ParticipantRefId, LinkedRefId = x.LinkedRefId, Type = x.Type.MapToDomainEnum() }).ToList(); try { var addParticipantCommand = new AddParticipantsToConferenceCommand(conferenceId, participants, linkedParticipants); await _commandHandler.Handle(addParticipantCommand); return(NoContent()); } catch (ConferenceNotFoundException ex) { _logger.LogError(ex, "Unable to find conference"); return(NotFound()); } }
public void GivenIHaveARequestToAddTwoLinkedParticipants() { var participantA = new ParticipantRequestBuilder(UserRole.Individual).Build(); var participantB = new ParticipantRequestBuilder(UserRole.Individual).Build(); participantA.LinkedParticipants.Add(new LinkedParticipantRequest() { Type = LinkedParticipantType.Interpreter, LinkedRefId = participantB.ParticipantRefId, ParticipantRefId = participantA.ParticipantRefId }); participantB.LinkedParticipants.Add(new LinkedParticipantRequest() { Type = LinkedParticipantType.Interpreter, LinkedRefId = participantA.ParticipantRefId, ParticipantRefId = participantB.ParticipantRefId }); var request = new AddParticipantsToConferenceRequest { Participants = new List <ParticipantRequest> { participantA, participantB }, }; _scenarioContext.Add(ParticipantUsernameKey, request.Participants.First().Username); _scenarioContext.Add(RequestBodyKey, request); _context.Request = _context.Put(AddParticipantsToConference(_context.Test.ConferenceResponse.Id), request); }
public void GivenIHaveARequestToAddTwoLinkedParticipants() { var conferenceId = _context.Test.Conference.Id; var participantA = new ParticipantRequestBuilder(UserRole.Individual).Build(); var participantB = new ParticipantRequestBuilder(UserRole.Individual).Build(); participantA.LinkedParticipants.Add(new LinkedParticipantRequest() { Type = LinkedParticipantType.Interpreter, LinkedRefId = participantB.ParticipantRefId, ParticipantRefId = participantA.ParticipantRefId }); participantB.LinkedParticipants.Add(new LinkedParticipantRequest() { Type = LinkedParticipantType.Interpreter, LinkedRefId = participantA.ParticipantRefId, ParticipantRefId = participantB.ParticipantRefId }); var request = new AddParticipantsToConferenceRequest { Participants = new List <ParticipantRequest> { participantA, participantB }, }; _context.Uri = AddParticipantsToConference(conferenceId); _context.HttpMethod = HttpMethod.Put; var jsonBody = RequestHelper.Serialise(request); _context.HttpContent = new StringContent(jsonBody, Encoding.UTF8, "application/json"); }
public void TestInitialize() { _request = new AddParticipantsToConferenceRequest { Participants = new List <ParticipantRequest> { new ParticipantRequestBuilder(UserRole.Individual).Build() } }; }
public void GivenIHaveAnAddParticipantToAValidConferenceRequest() { var request = new AddParticipantsToConferenceRequest { Participants = new List <ParticipantRequest> { new ParticipantRequestBuilder(UserRole.Individual).Build() } }; _scenarioContext.Add(ParticipantUsernameKey, request.Participants.First().Username); _context.Request = _context.Put(AddParticipantsToConference(_context.Test.ConferenceResponse.Id), request); }
public void GivenIHaveAnAddParticipantToConferenceRequestWithInvalidBody() { var request = new AddParticipantsToConferenceRequest { Participants = new List <ParticipantRequest>() }; _context.Uri = AddParticipantsToConference(_context.Test.Conference.Id); _context.HttpMethod = HttpMethod.Put; var jsonBody = RequestHelper.Serialise(request); _context.HttpContent = new StringContent(jsonBody, Encoding.UTF8, "application/json"); }
public async Task HandleAsync(ParticipantsAddedIntegrationEvent eventMessage) { var conference = await _videoApiService.GetConferenceByHearingRefId(eventMessage.HearingId); var request = new AddParticipantsToConferenceRequest { Participants = eventMessage.Participants .Select(ParticipantToParticipantRequestMapper.MapToParticipantRequest).ToList() }; await _videoApiService.AddParticipantsToConference(conference.Id, request); var updateConferenceParticipantsRequest = new UpdateConferenceParticipantsRequest { NewParticipants = eventMessage.Participants.Select(x => ParticipantToParticipantRequestMapper.MapToParticipantRequest(x)).ToList(), }; await _videoWebService.PushParticipantsUpdatedMessage(conference.Id, updateConferenceParticipantsRequest); }
public void GivenIHaveAnAddParticipantToConferenceRequest(Scenario scenario) { var request = new AddParticipantsToConferenceRequest() { Participants = new List <ParticipantRequest> { new ParticipantRequestBuilder(UserRole.Individual).Build() } }; var conferenceId = scenario switch { Scenario.Valid => _context.Test.Conference.Id, Scenario.Nonexistent => Guid.NewGuid(), Scenario.Invalid => Guid.Empty, _ => throw new ArgumentOutOfRangeException(nameof(scenario), scenario, null) }; _context.Uri = AddParticipantsToConference(conferenceId); _context.HttpMethod = HttpMethod.Put; var jsonBody = RequestHelper.Serialise(request); _context.HttpContent = new StringContent(jsonBody, Encoding.UTF8, "application/json"); }
public Task AddParticipantsToConference(Guid conferenceId, AddParticipantsToConferenceRequest request) { _logger.LogInformation("Adding participants to conference {ConferenceId}", conferenceId); return(_apiClient.AddParticipantsToConferenceAsync(conferenceId, request)); }
public Task AddParticipantsToConference(Guid conferenceId, AddParticipantsToConferenceRequest request) { AddParticipantsToConferenceCount++; return(Task.FromResult(HttpStatusCode.OK)); }