Skip to content

Commit

Permalink
Remove suitability answer related properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaed Parkar committed Sep 11, 2023
1 parent 754513f commit 4542005
Show file tree
Hide file tree
Showing 61 changed files with 67 additions and 1,682 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,5 @@ public void ThenIndividualDetailsShouldBeUpdated(string participant)
model.TelephoneNumber.Should().Be(updateParticipantRequest.TelephoneNumber);
model.LinkedParticipants.Count.Should().Be(participant == "Individual" ? 1 : 0);
}

[Given(@"I have an update participant suitability answers with a valid user '(.*)'")]
public void GivenIHaveAnUpdateParticipantSuitabilityAnswersWithAValidUser(string role)
{
var participantId = _context.TestData.ParticipantsResponses.FirstOrDefault(x => x.UserRoleName.Equals(role)).Id;
var updateParticipantRequest = UpdateSuitabilityAnswersRequest.BuildRequest();
_context.TestData.Answers = updateParticipantRequest;
_context.Request = _context.Put(UpdateSuitabilityAnswers(_context.TestData.Hearing.Id, participantId), updateParticipantRequest);
}
}
}
28 changes: 0 additions & 28 deletions BookingsApi/BookingsApi.AcceptanceTests/Steps/PersonsSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,34 +92,6 @@ public void ThenPersonsDetailsShouldBeRetrieved()
actual.Username.Should().Be(expected.Username);
}

[Then(@"suitability answers for '(.*)' should be updated")]
public void ThenSuitabilityAnswersForShouldBeUpdated(string participant)
{
var username = _context.TestData.ParticipantsResponses
.FirstOrDefault(x => x.UserRoleName.Equals(participant)).Username;
var participantId = _context.TestData.ParticipantsResponses
.FirstOrDefault(x => x.UserRoleName.Equals(participant)).Id;
_context.Request = _context.Get(GetPersonSuitabilityAnswers(username));
_context.Response = _context.Client().Execute(_context.Request);
_context.Response.StatusCode.Should().Be(HttpStatusCode.OK);
var model =
RequestHelper.Deserialise<List<PersonSuitabilityAnswerResponse>>(
_context.Response.Content);
var expectedResult = _context.TestData.Answers;

expectedResult[0].Key.Should().Be(model[0].Answers[0].Key);
expectedResult[0].Answer.Should().Be(model[0].Answers[0].Answer);
expectedResult[0].ExtendedAnswer.Should().Be(model[0].Answers[0].ExtendedAnswer);
expectedResult[1].Key.Should().Be(model[0].Answers[1].Key);
expectedResult[1].Answer.Should().Be(model[0].Answers[1].Answer);
expectedResult[1].ExtendedAnswer.Should().Be(model[0].Answers[1].ExtendedAnswer);

model[0].HearingId.Should().Be(_context.TestData.Hearing.Id);
model[0].ParticipantId.Should().Be(participantId);
model[0].UpdatedAt.Should().BeAfter(DateTime.UtcNow.AddMinutes(-2));
model[0].QuestionnaireNotRequired.Should().BeFalse();
}

[Then(@"a list of hearings for deletion is (.*)")]
public void ThenAListOfHearingsForDeletionIs(int expectedNumOfHearings)
{
Expand Down
412 changes: 0 additions & 412 deletions BookingsApi/BookingsApi.Client/BookingsApiClient.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public BookNewHearingRequest()
/// <summary>
/// QuestionnaireNotRequired
/// </summary>
[Obsolete("This property is no longer used.")]
public bool QuestionnaireNotRequired { get; set; }

/// <summary>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace BookingsApi.Contract.V1.Requests
{
Expand Down Expand Up @@ -43,6 +44,8 @@ public class UpdateHearingRequest
/// <summary>
/// QuestionnaireNotRequired
/// </summary>
[Obsolete("This property is no longer used.")]
[DefaultValue(false)]
public bool? QuestionnaireNotRequired { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public DateTime HearingDate
/// <summary>
/// QuestionnaireNotRequired
/// </summary>
[Obsolete("This property is no longer used.")]
public bool QuestionnaireNotRequired { get; set; }

/// <summary>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public class CreateVideoHearingCommand : ICommand
{
public CreateVideoHearingCommand(CaseType caseType, HearingType hearingType, DateTime scheduledDateTime,
int scheduledDuration, HearingVenue venue, List<NewParticipant> participants, List<Case> cases,
bool questionnaireNotRequired, bool audioRecordingRequired, List<NewEndpoint> endpoints,
List<LinkedParticipantDto> linkedParticipants, bool isMultiDayFirstHearing)
bool audioRecordingRequired, List<NewEndpoint> endpoints, List<LinkedParticipantDto> linkedParticipants,
bool isMultiDayFirstHearing)
{
CaseType = caseType;
HearingType = hearingType;
Expand All @@ -18,7 +18,6 @@ public CreateVideoHearingCommand(CaseType caseType, HearingType hearingType, Dat
Venue = venue;
Participants = participants;
Cases = cases;
QuestionnaireNotRequired = questionnaireNotRequired;
AudioRecordingRequired = audioRecordingRequired;
Endpoints = endpoints;
LinkedParticipants = linkedParticipants;
Expand All @@ -36,7 +35,6 @@ public CreateVideoHearingCommand(CaseType caseType, HearingType hearingType, Dat
public string HearingRoomName { get; set; }
public string OtherInformation { get; set; }
public string CreatedBy { get; set; }
public bool QuestionnaireNotRequired { get; set; }
public bool AudioRecordingRequired { get; set; }
public List<NewEndpoint> Endpoints { get; }
public string CancelReason { get; set; }
Expand All @@ -61,8 +59,7 @@ public async Task Handle(CreateVideoHearingCommand command)
{
var videoHearing = new VideoHearing(command.CaseType, command.HearingType, command.ScheduledDateTime,
command.ScheduledDuration, command.Venue, command.HearingRoomName,
command.OtherInformation, command.CreatedBy, command.QuestionnaireNotRequired,
command.AudioRecordingRequired, command.CancelReason);
command.OtherInformation, command.CreatedBy, command.AudioRecordingRequired, command.CancelReason);

// Ideally, the domain object would implement the clone method and so this change is a work around.
videoHearing.IsFirstDayOfMultiDayHearing = command.IsMultiDayFirstHearing;
Expand Down
6 changes: 2 additions & 4 deletions BookingsApi/BookingsApi.DAL/Commands/UpdateHearingCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ public class UpdateHearingCommand : ICommand
public string OtherInformation { get; set; }
public string UpdatedBy { get; set; }
public List<Case> Cases { get; set; }
public bool QuestionnaireNotRequired { get; set; }
public bool AudioRecordingRequired { get; set; }

public UpdateHearingCommand(Guid hearingId, DateTime scheduledDateTime, int scheduledDuration,
HearingVenue hearingVenue, string hearingRoomName, string otherInformation, string updatedBy,
List<Case> cases, bool questionnaireNotRequired, bool audioRecordingRequired)
List<Case> cases, bool audioRecordingRequired)
{
HearingId = hearingId;
ScheduledDateTime = scheduledDateTime;
Expand All @@ -27,7 +26,6 @@ public UpdateHearingCommand(Guid hearingId, DateTime scheduledDateTime, int sche
OtherInformation = otherInformation;
UpdatedBy = updatedBy;
Cases = cases;
QuestionnaireNotRequired = questionnaireNotRequired;
AudioRecordingRequired = audioRecordingRequired;
}
}
Expand Down Expand Up @@ -60,7 +58,7 @@ public async Task Handle(UpdateHearingCommand command)

hearing.UpdateHearingDetails(command.HearingVenue, command.ScheduledDateTime,
command.ScheduledDuration, command.HearingRoomName, command.OtherInformation,
command.UpdatedBy, command.Cases, command.QuestionnaireNotRequired, command.AudioRecordingRequired);
command.UpdatedBy, command.Cases, command.AudioRecordingRequired);

if (command.ScheduledDateTime != oldScheduledDateTime)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public static CreateVideoHearingCommand CloneToCommand(Hearing hearing, DateTime

var duration = 480;
var command = new CreateVideoHearingCommand(hearing.CaseType, hearing.HearingType, newDate,
duration, hearing.HearingVenue, participants, cases, true,
hearing.AudioRecordingRequired, newEndpoints, linkedParticipantDtos, false)
duration, hearing.HearingVenue, participants, cases, hearing.AudioRecordingRequired, newEndpoints,
linkedParticipantDtos, false)
{
HearingRoomName = hearing.HearingRoomName,
OtherInformation = hearing.OtherInformation,
Expand Down
2 changes: 1 addition & 1 deletion BookingsApi/BookingsApi.DAL/Mappings/HearingMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void Configure(EntityTypeBuilder<Hearing> builder)
builder.Property(x => x.CreatedDate).HasConversion(v => v, v => DateTime.SpecifyKind(v, DateTimeKind.Utc));
builder.Property(x => x.UpdatedDate).HasConversion(v => v, v => DateTime.SpecifyKind(v, DateTimeKind.Utc));
builder.Property(x => x.Status).HasColumnName("HearingStatusId");
builder.Property(x => x.QuestionnaireNotRequired);
builder.Property<bool>("QuestionnaireNotRequired").HasDefaultValue(false);
builder.Property(x => x.CancelReason).HasMaxLength(255);
builder.Property(x => x.SourceId);
builder.Ignore(x => x.IsFirstDayOfMultiDayHearing);
Expand Down
Loading

0 comments on commit 4542005

Please sign in to comment.