From be0a9683c72719a14d13946ce7c37845f330eba7 Mon Sep 17 00:00:00 2001 From: Carl Sixsmith Date: Fri, 30 Aug 2024 14:31:58 +0100 Subject: [PATCH 1/6] set consent approved at same time as approving to join the programme --- .../EnrolmentQueueEntryCompletedDomainEventHandler.cs | 3 ++- src/Domain/Entities/Participants/Participant.cs | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Application/Features/QualityAssurance/EventHandlers/EnrolmentQueueEntryCompletedDomainEventHandler.cs b/src/Application/Features/QualityAssurance/EventHandlers/EnrolmentQueueEntryCompletedDomainEventHandler.cs index 6a86da64..5d3a5b61 100644 --- a/src/Application/Features/QualityAssurance/EventHandlers/EnrolmentQueueEntryCompletedDomainEventHandler.cs +++ b/src/Application/Features/QualityAssurance/EventHandlers/EnrolmentQueueEntryCompletedDomainEventHandler.cs @@ -18,7 +18,8 @@ public async Task Handle(EnrolmentQueueEntryCompletedDomainEvent notification, C { if (notification.Entry.IsAccepted) { - notification.Entry.Participant!.TransitionTo(EnrolmentStatus.ApprovedStatus); + notification.Entry.Participant!.TransitionTo(EnrolmentStatus.ApprovedStatus) + .ApproveConsent(); } else { diff --git a/src/Domain/Entities/Participants/Participant.cs b/src/Domain/Entities/Participants/Participant.cs index f346ffdf..5d4911bf 100644 --- a/src/Domain/Entities/Participants/Participant.cs +++ b/src/Domain/Entities/Participants/Participant.cs @@ -245,4 +245,13 @@ public Participant AddOrUpdateSupervisor(Supervisor? newSupervisor) return this; } + public Participant ApproveConsent() + { + if(ConsentStatus == ConsentStatus.PendingStatus) + { + ConsentStatus = ConsentStatus.GrantedStatus; + } + return this; + } + } From 982eeaad1fab847a24814361d75001dda777a20c Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Mon, 2 Sep 2024 10:16:45 +0100 Subject: [PATCH 2/6] 'Enrolment Confirmed' status --- .../Dashboard/Queries/GetDashboard.cs | 6 ++ .../Participants/Commands/ConfirmEnrolment.cs | 54 ++++++++++++++ .../ParticipantAdvancedFilter.cs | 1 + .../ParticipantAdvancedSpecification.cs | 2 +- .../Commands/SubmitPqaResponse.cs | 2 +- .../Commands/SubmitToProviderQa.cs | 20 +++++ src/Domain/Common/Enums/EnrolmentStatus.cs | 12 ++- src/Server.UI/Pages/Dashboard/Dashboard.razor | 19 ++++- .../Pages/Enrolments/Enrolment.razor | 35 +++++++-- .../Components/ParticipantActionMenu.razor | 4 +- .../Pages/Participants/Participant.razor | 74 ++++++++++--------- .../Pages/Participants/Participants.razor | 10 ++- 12 files changed, 187 insertions(+), 52 deletions(-) create mode 100644 src/Application/Features/Participants/Commands/ConfirmEnrolment.cs diff --git a/src/Application/Features/Dashboard/Queries/GetDashboard.cs b/src/Application/Features/Dashboard/Queries/GetDashboard.cs index f68c1d6d..4e1ba056 100644 --- a/src/Application/Features/Dashboard/Queries/GetDashboard.cs +++ b/src/Application/Features/Dashboard/Queries/GetDashboard.cs @@ -42,6 +42,11 @@ into grp dto.PendingCases = result.Count; continue; } + if(result.Status == EnrolmentStatus.EnrolmentConfirmedStatus) + { + dto.ConfirmedCases = result.Count; + continue; + } if (result.Status == EnrolmentStatus.SubmittedToProviderStatus) { dto.CasesAtPqa = result.Count; @@ -72,6 +77,7 @@ public Validator() public class DashboardDto { public int PendingCases { get; set; } + public int ConfirmedCases { get; set; } public int CasesAtPqa { get; set; } public int CasesAtCfo { get; set; } public int ApprovedCases { get; set; } diff --git a/src/Application/Features/Participants/Commands/ConfirmEnrolment.cs b/src/Application/Features/Participants/Commands/ConfirmEnrolment.cs new file mode 100644 index 00000000..251259f4 --- /dev/null +++ b/src/Application/Features/Participants/Commands/ConfirmEnrolment.cs @@ -0,0 +1,54 @@ +using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.Common.Validators; +using Cfo.Cats.Application.SecurityConstants; + +namespace Cfo.Cats.Application.Features.Participants.Commands; + +public static class ConfirmEnrolment +{ + [RequestAuthorize(Policy = SecurityPolicies.Enrol)] + public class Command : IRequest + { + public required string ParticipantId { get; set; } + } + + class Handler(IUnitOfWork unitOfWork) : IRequestHandler + { + public async Task Handle(Command request, CancellationToken cancellationToken) + { + var participant = await unitOfWork.DbContext.Participants.FindAsync(request.ParticipantId); + + if(participant is null) + { + return Result.Failure("Participant not found"); + } + + participant.TransitionTo(EnrolmentStatus.EnrolmentConfirmedStatus); + + return Result.Success(); + } + } + + class Validator : AbstractValidator + { + private readonly IUnitOfWork _unitOfWork; + + public Validator(IUnitOfWork unitOfWork) + { + _unitOfWork = unitOfWork; + + RuleFor(c => c.ParticipantId) + .NotNull() + .Length(9) + .WithMessage("Invalid Participant Id") + .Matches(ValidationConstants.AlphaNumeric) + .WithMessage(string.Format(ValidationConstants.AlphaNumericMessage, "Participant Id")) + .MustAsync(Exist) + .WithMessage("Participant does not exist"); + } + + private async Task Exist(string identifier, CancellationToken cancellationToken) + => await _unitOfWork.DbContext.Participants.AnyAsync(e => e.Id == identifier, cancellationToken); + } + +} diff --git a/src/Application/Features/Participants/Specifications/ParticipantAdvancedFilter.cs b/src/Application/Features/Participants/Specifications/ParticipantAdvancedFilter.cs index 83f52870..2ade2fd5 100644 --- a/src/Application/Features/Participants/Specifications/ParticipantAdvancedFilter.cs +++ b/src/Application/Features/Participants/Specifications/ParticipantAdvancedFilter.cs @@ -13,6 +13,7 @@ public enum ParticipantListView { [Description("Default")] Default, [Description("Pending")] Pending, + [Description("Enrolment Confirmed")] EnrolmentConfirmed, [Description("Submitted To Provider")] SubmittedToProvider, [Description("Submitted To QA")] SubmittedToQa, [Description("Any QA")] SubmittedToAny, diff --git a/src/Application/Features/Participants/Specifications/ParticipantAdvancedSpecification.cs b/src/Application/Features/Participants/Specifications/ParticipantAdvancedSpecification.cs index db09ca5f..573ada24 100644 --- a/src/Application/Features/Participants/Specifications/ParticipantAdvancedSpecification.cs +++ b/src/Application/Features/Participants/Specifications/ParticipantAdvancedSpecification.cs @@ -12,7 +12,7 @@ public ParticipantAdvancedSpecification(ParticipantAdvancedFilter filter) filter.ListView == ParticipantListView.Default); Query.Where( p => p.EnrolmentStatus == EnrolmentStatus.PendingStatus.Value, filter.ListView == ParticipantListView.Pending); - + Query.Where(p => p.EnrolmentStatus == EnrolmentStatus.EnrolmentConfirmedStatus.Value, filter.ListView == ParticipantListView.EnrolmentConfirmed); Query.Where( p => p.EnrolmentStatus == EnrolmentStatus.SubmittedToProviderStatus.Value, filter.ListView == ParticipantListView.SubmittedToProvider); Query.Where( p => p.EnrolmentStatus == EnrolmentStatus.SubmittedToAuthorityStatus.Value, filter.ListView == ParticipantListView.SubmittedToQa); Query.Where( p => p.EnrolmentStatus == EnrolmentStatus.SubmittedToProviderStatus.Value || p.EnrolmentStatus == EnrolmentStatus.SubmittedToAuthorityStatus.Value, filter.ListView == ParticipantListView.SubmittedToAny); diff --git a/src/Application/Features/QualityAssurance/Commands/SubmitPqaResponse.cs b/src/Application/Features/QualityAssurance/Commands/SubmitPqaResponse.cs index f9656aba..d612e5e2 100644 --- a/src/Application/Features/QualityAssurance/Commands/SubmitPqaResponse.cs +++ b/src/Application/Features/QualityAssurance/Commands/SubmitPqaResponse.cs @@ -31,7 +31,7 @@ public async Task Handle(Command request, CancellationToken cancellation } entry.Complete(request.Accept.GetValueOrDefault(), request.Message); - EnrolmentStatus transitionTo = request.Accept.GetValueOrDefault() ? EnrolmentStatus.SubmittedToAuthorityStatus : EnrolmentStatus.PendingStatus; + EnrolmentStatus transitionTo = request.Accept.GetValueOrDefault() ? EnrolmentStatus.SubmittedToAuthorityStatus : EnrolmentStatus.EnrolmentConfirmedStatus; entry.Participant!.TransitionTo(transitionTo); return Result.Success(); diff --git a/src/Application/Features/QualityAssurance/Commands/SubmitToProviderQa.cs b/src/Application/Features/QualityAssurance/Commands/SubmitToProviderQa.cs index 306639f7..8b4da909 100644 --- a/src/Application/Features/QualityAssurance/Commands/SubmitToProviderQa.cs +++ b/src/Application/Features/QualityAssurance/Commands/SubmitToProviderQa.cs @@ -145,4 +145,24 @@ private async Task MustBeJustified(Command command, CancellationToken canc return false; } } + + public class E_ParticipantStatusShouldBeConfirmed : AbstractValidator + { + private IUnitOfWork _unitOfWork; + + public E_ParticipantStatusShouldBeConfirmed(IUnitOfWork unitOfWork) + { + _unitOfWork = unitOfWork; + + RuleFor(c => c.ParticipantId) + .MustAsync(MustBeConfirmed) + .WithMessage("Enrolment status must be confirmed"); + } + + private async Task MustBeConfirmed(string participantId, CancellationToken cancellationToken) + { + var result = await _unitOfWork.DbContext.Participants.SingleOrDefaultAsync(p => p.Id == participantId); + return result?.EnrolmentStatus == EnrolmentStatus.EnrolmentConfirmedStatus; + } + } } diff --git a/src/Domain/Common/Enums/EnrolmentStatus.cs b/src/Domain/Common/Enums/EnrolmentStatus.cs index b938aa07..a56e4784 100644 --- a/src/Domain/Common/Enums/EnrolmentStatus.cs +++ b/src/Domain/Common/Enums/EnrolmentStatus.cs @@ -6,6 +6,7 @@ public abstract class EnrolmentStatus : SmartEnum { public static readonly EnrolmentStatus PendingStatus = new Pending(); + public static readonly EnrolmentStatus EnrolmentConfirmedStatus = new EnrolmentConfirmed(); public static readonly EnrolmentStatus SubmittedToProviderStatus = new SubmittedToProvider(); public static readonly EnrolmentStatus SubmittedToAuthorityStatus = new SubmittedToAuthority(); public static readonly EnrolmentStatus ApprovedStatus = new Approved(); @@ -43,7 +44,7 @@ public Pending() : base("Pending", 0) { } protected override EnrolmentStatus[] GetAllowedTransitions() - => [ ArchivedStatus, SubmittedToProviderStatus]; + => [ ArchivedStatus, EnrolmentConfirmedStatus]; } private sealed class SubmittedToProvider : EnrolmentStatus @@ -102,6 +103,15 @@ protected override EnrolmentStatus[] GetAllowedTransitions() => [ ArchivedStatus, ApprovedStatus ]; } + private sealed class EnrolmentConfirmed : EnrolmentStatus + { + public EnrolmentConfirmed() + : base("Enrolment Confirmed", 6) { } + + protected override EnrolmentStatus[] GetAllowedTransitions() + => [ArchivedStatus, SubmittedToProviderStatus]; + } + /// /// Indicates that a participant at this enrolment stage is allowed to have a new assessment created /// diff --git a/src/Server.UI/Pages/Dashboard/Dashboard.razor b/src/Server.UI/Pages/Dashboard/Dashboard.razor index 0a9ec8ba..6c799e12 100644 --- a/src/Server.UI/Pages/Dashboard/Dashboard.razor +++ b/src/Server.UI/Pages/Dashboard/Dashboard.razor @@ -23,13 +23,30 @@ - Your cases that are awaiting submission to PQA + Your cases that are awaiting enrolment confirmation @_dashboardDto?.PendingCases + + + + + + Pending Cases + + + + + Your cases that are awaiting submission to PQA + + @_dashboardDto?.ConfirmedCases + + + + diff --git a/src/Server.UI/Pages/Enrolments/Enrolment.razor b/src/Server.UI/Pages/Enrolments/Enrolment.razor index 9ebf3920..37330388 100644 --- a/src/Server.UI/Pages/Enrolments/Enrolment.razor +++ b/src/Server.UI/Pages/Enrolments/Enrolment.razor @@ -93,10 +93,10 @@ @code { private ParticipantDto? _participant; - + [Parameter] public required string ParticipantId { get; set; } - + [CascadingParameter] public UserProfile? UserProfile { get; set; } @@ -111,7 +111,7 @@ private SetEnrolmentLocation.Command SetEnrolmentCommand { get; set; } = null!; private AddConsent.Command AddConsentCommand { get; set; } = null!; private AddRightToWork.Command AddRightToWorkCommand { get; set; } = null!; - + private LocationDto[] Locations { get; set; } = []; protected override async Task OnInitializedAsync() @@ -151,10 +151,33 @@ } } - private void StepChanged(int index) + private async void StepChanged(int index) { - hideHeading = Stepper?.IsResultStep ?? false; - StateHasChanged(); + if(Stepper is not { IsResultStep: true }) + { + return; + } + + Result? result = null; + + try + { + hideHeading = true; + + result = await GetNewMediator().Send(new ConfirmEnrolment.Command + { + ParticipantId = ParticipantId + }); + } + finally + { + if(result is not { Succeeded: true }) + { + Snackbar.Add(result?.ErrorMessage ?? "An unknown issue occurred when confirming this enrolment", Severity.Error); + } + + StateHasChanged(); + } } private async Task SaveAndExit() diff --git a/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor b/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor index 3b2bb49f..e13c6ba6 100644 --- a/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor +++ b/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor @@ -26,12 +26,12 @@ Suspend } - @if (Participant.EnrolmentStatus == EnrolmentStatus.PendingStatus) + @if (Participant.EnrolmentStatus == EnrolmentStatus.EnrolmentConfirmedStatus) { Submit to Provider QA } - @if (Participant.EnrolmentStatus == EnrolmentStatus.PendingStatus) + @if (Participant.EnrolmentStatus == EnrolmentStatus.EnrolmentConfirmedStatus) { @ConstantString.AddRightToWork } diff --git a/src/Server.UI/Pages/Participants/Participant.razor b/src/Server.UI/Pages/Participants/Participant.razor index 28749347..de16f593 100644 --- a/src/Server.UI/Pages/Participants/Participant.razor +++ b/src/Server.UI/Pages/Participants/Participant.razor @@ -18,7 +18,6 @@ @if (_participant is not null) { - @@ -87,43 +86,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - @* - - - - - *@ - + + @if(_participant.EnrolmentStatus != EnrolmentStatus.PendingStatus) + { + + + + + + + + + + + + + + + + + + + + + + + + + + + + @* + + + + + *@ + + } - } diff --git a/src/Server.UI/Pages/Participants/Participants.razor b/src/Server.UI/Pages/Participants/Participants.razor index aab5ffcf..b5d4071f 100644 --- a/src/Server.UI/Pages/Participants/Participants.razor +++ b/src/Server.UI/Pages/Participants/Participants.razor @@ -92,10 +92,12 @@ @ConstantString.ResumeEnrolment } - - @ConstantString.Edit - - + else + { + + @ConstantString.Edit + + } From cc9c2d9ed5e64479e4b36cd65c808cd27b7f0db2 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 30 Aug 2024 14:16:25 +0100 Subject: [PATCH 3/6] Record participant active (in feed) status --- .../Commands/CreateParticipant.cs | 1 + ...ntActiveStatusChangedDomainEventHandler.cs | 17 + .../Entities/Participants/Participant.cs | 19 +- src/Domain/Events/ParticipantEvents.cs | 8 + .../Jobs/SyncParticipantsJob.cs | 3 + .../ParticipantEntityTypeConfiguration.cs | 3 + .../Candidates/DummyCandidateService.cs | 300 ++++++++++++------ 7 files changed, 250 insertions(+), 101 deletions(-) create mode 100644 src/Application/Features/Timelines/EventHandlers/ParticipantActiveStatusChangedDomainEventHandler.cs diff --git a/src/Application/Features/Participants/Commands/CreateParticipant.cs b/src/Application/Features/Participants/Commands/CreateParticipant.cs index 905d4299..b70abf00 100644 --- a/src/Application/Features/Participants/Commands/CreateParticipant.cs +++ b/src/Application/Features/Participants/Commands/CreateParticipant.cs @@ -57,6 +57,7 @@ public async Task> Handle(Command request, CancellationToken canc lastName: candidate.LastName, gender: candidate.Gender, dateOfBirth: candidate.DateOfBirth, + activeInFeed: candidate.IsActive, referralSource: request.ReferralSource!, referralComments: request.ReferralComments, locationId: candidate.MappedLocationId); diff --git a/src/Application/Features/Timelines/EventHandlers/ParticipantActiveStatusChangedDomainEventHandler.cs b/src/Application/Features/Timelines/EventHandlers/ParticipantActiveStatusChangedDomainEventHandler.cs new file mode 100644 index 00000000..9c2b4b0c --- /dev/null +++ b/src/Application/Features/Timelines/EventHandlers/ParticipantActiveStatusChangedDomainEventHandler.cs @@ -0,0 +1,17 @@ +using Cfo.Cats.Domain.Events; + +namespace Cfo.Cats.Application.Features.Timelines.EventHandlers; + +public class ParticipantActiveStatusChangedDomainEventHandler( + ICurrentUserService currentUserService, + IUnitOfWork unitOfWork) : TimelineNotificationHandler(currentUserService, unitOfWork) +{ + protected override TimelineEventType GetEventType() => TimelineEventType.Dms; + + protected override string GetLine1(ParticipantActiveStatusChangedDomainEvent notification) => "Participant active status updated"; + + protected override string? GetLine2(ParticipantActiveStatusChangedDomainEvent notification) => string.Format("To {0}", notification.To ? "Active" : "Inactive"); + protected override string? GetLine3(ParticipantActiveStatusChangedDomainEvent notification) => string.Format("From {0}", notification.From ? "Active" : "Inactive"); + + protected override string GetParticipantId(ParticipantActiveStatusChangedDomainEvent notification) => notification.Item.Id; +} diff --git a/src/Domain/Entities/Participants/Participant.cs b/src/Domain/Entities/Participants/Participant.cs index 5d4911bf..416554dc 100644 --- a/src/Domain/Entities/Participants/Participant.cs +++ b/src/Domain/Entities/Participants/Participant.cs @@ -23,7 +23,7 @@ private Participant() } #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public static Participant CreateFrom(string id, string firstName, string? middleName, string lastName, string? gender, DateTime dateOfBirth, string referralSource, string? referralComments, int locationId) + public static Participant CreateFrom(string id, string firstName, string? middleName, string lastName, string? gender, DateTime dateOfBirth, bool activeInFeed, string referralSource, string? referralComments, int locationId) { Participant p = new Participant { @@ -35,6 +35,7 @@ public static Participant CreateFrom(string id, string firstName, string? middle MiddleName = middleName, LastName = lastName, Gender = gender, + ActiveInFeed = activeInFeed, ReferralSource = referralSource, ReferralComments = referralComments, _currentLocationId = locationId @@ -50,6 +51,11 @@ public static Participant CreateFrom(string id, string firstName, string? middle public string? Gender { get; private set; } public DateOnly DateOfBirth { get; private set; } + /// + /// Whether the participant is active in the DMS feed. + /// + public bool ActiveInFeed { get; private set; } + public string ReferralSource { get; private set; } public string? ReferralComments { get; private set; } @@ -254,4 +260,15 @@ public Participant ApproveConsent() return this; } + public Participant UpdateActiveStatus(bool activeInFeed) + { + if(ActiveInFeed != activeInFeed) + { + ActiveInFeed = activeInFeed; + AddDomainEvent(new ParticipantActiveStatusChangedDomainEvent(this, ActiveInFeed, activeInFeed)); + } + + return this; + } + } diff --git a/src/Domain/Events/ParticipantEvents.cs b/src/Domain/Events/ParticipantEvents.cs index 728f54b8..109b0475 100644 --- a/src/Domain/Events/ParticipantEvents.cs +++ b/src/Domain/Events/ParticipantEvents.cs @@ -62,4 +62,12 @@ public sealed class ParticipantNameChangedDomainEvent(Participant participant, s public Participant Item { get; } = participant; public string? From { get; } = from; public string? To { get; } = to; +} + +public sealed class ParticipantActiveStatusChangedDomainEvent(Participant item, bool from, bool to) + : DomainEvent +{ + public Participant Item { get; } = item; + public bool From { get; } = from; + public bool To { get; } = to; } \ No newline at end of file diff --git a/src/Infrastructure/Jobs/SyncParticipantsJob.cs b/src/Infrastructure/Jobs/SyncParticipantsJob.cs index 1a473f1e..65da1ab9 100644 --- a/src/Infrastructure/Jobs/SyncParticipantsJob.cs +++ b/src/Infrastructure/Jobs/SyncParticipantsJob.cs @@ -82,6 +82,9 @@ public async Task Execute(IJobExecutionContext context) participant.AddOrUpdateGender(candidate.Gender); } + // Update active in feed status + participant.UpdateActiveStatus(candidate.IsActive); + // Dispatch events and commit transaction await domainEventDispatcher.DispatchEventsAsync(unitOfWork.DbContext, CancellationToken.None); await unitOfWork.CommitTransactionAsync(); diff --git a/src/Infrastructure/Persistence/Configurations/Participants/ParticipantEntityTypeConfiguration.cs b/src/Infrastructure/Persistence/Configurations/Participants/ParticipantEntityTypeConfiguration.cs index a8eb9570..bdf00c63 100644 --- a/src/Infrastructure/Persistence/Configurations/Participants/ParticipantEntityTypeConfiguration.cs +++ b/src/Infrastructure/Persistence/Configurations/Participants/ParticipantEntityTypeConfiguration.cs @@ -38,6 +38,9 @@ public void Configure(EntityTypeBuilder builder) builder.Property(p => p.Gender) .HasMaxLength(6); + builder.Property(p => p.ActiveInFeed) + .IsRequired(); + builder.Property(p => p.ReferralSource) .IsRequired() .HasMaxLength(100); diff --git a/src/Infrastructure/Services/Candidates/DummyCandidateService.cs b/src/Infrastructure/Services/Candidates/DummyCandidateService.cs index 0ec93c79..33a03dc3 100644 --- a/src/Infrastructure/Services/Candidates/DummyCandidateService.cs +++ b/src/Infrastructure/Services/Candidates/DummyCandidateService.cs @@ -20,7 +20,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "DELIUS", OrgCode = "LNS", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -34,7 +35,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "HBI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -48,7 +50,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N22", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -62,7 +65,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "GNI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -76,7 +80,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "SKI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -90,7 +95,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N07", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -104,7 +110,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "FYI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -118,7 +125,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "YSN", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -132,7 +140,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "OUT", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -146,7 +155,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "CWI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -160,7 +170,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N31", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -174,7 +185,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N26", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -188,7 +200,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "GMI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -202,7 +215,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "PBI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -216,7 +230,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N07", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -230,7 +245,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "IWI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -244,7 +260,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "DTV", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -258,7 +275,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "C19", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -272,7 +290,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "EHI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -286,7 +305,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "BXI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -300,7 +320,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "LTS", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -314,7 +335,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "ESX", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -328,7 +350,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "C20", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -342,7 +365,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "CWI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -356,7 +380,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "RCI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -370,7 +395,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "WCI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -384,7 +410,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "WMI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -398,7 +425,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "ESX", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -412,7 +440,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "SDI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -426,7 +455,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "AYI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -440,7 +470,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N06", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -454,7 +485,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "WWI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -468,7 +500,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "NWI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -482,7 +515,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "DTV", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -496,7 +530,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "FHI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -510,7 +545,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "C08", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -524,7 +560,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "SLI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -538,7 +575,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "BWI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -552,7 +590,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "MDI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -566,7 +605,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "DRS", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -580,7 +620,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "WTI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -594,7 +635,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "EXI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -608,7 +650,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N52", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -622,7 +665,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "SPI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -636,7 +680,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "DWI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -650,7 +695,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "PFI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -664,7 +710,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "PDI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -678,7 +725,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "CHS", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -692,7 +740,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "BMI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -706,7 +755,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "TRN", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -720,7 +770,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "FEI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -734,7 +785,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "MTI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -748,7 +800,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "HRI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -762,7 +815,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "FSI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -776,7 +830,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "GHI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -790,7 +845,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "STI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -804,7 +860,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "WNI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -818,7 +875,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "STI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -832,7 +890,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "CDI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -846,7 +905,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "C04", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -860,7 +920,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "GCS", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -874,7 +935,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "TCI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -888,7 +950,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "C20", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -902,7 +965,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "PVI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -916,7 +980,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N23", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -930,7 +995,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "OUT", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -944,7 +1010,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "ESI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -958,7 +1025,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "WSI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -972,7 +1040,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "EXI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -986,7 +1055,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "C07", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1000,7 +1070,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "TCI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1014,7 +1085,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "EXI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1028,7 +1100,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "WII", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1042,7 +1115,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "FYI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1056,7 +1130,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "TSI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1070,7 +1145,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N01", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1084,7 +1160,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "RHI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1098,7 +1175,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "LDN", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1112,7 +1190,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "HLI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1126,7 +1205,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "EYI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1140,7 +1220,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "TSI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1154,7 +1235,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "MRS", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1168,7 +1250,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "PRI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1182,7 +1265,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "ISI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1196,7 +1280,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N03", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1210,7 +1295,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "BNI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1224,7 +1310,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "SWM", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1238,7 +1325,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "CFI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1252,7 +1340,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "ASI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1266,7 +1355,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "LNS", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1280,7 +1370,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "BCI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1294,7 +1385,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "FBI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1308,7 +1400,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N24", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1322,7 +1415,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "WRI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1336,7 +1430,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "PFI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1350,7 +1445,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N58", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1364,7 +1460,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "N51", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1378,7 +1475,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "DHI", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1392,7 +1490,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "T01", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true }, new CandidateDto { @@ -1406,7 +1505,8 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService Primary = "NOMIS", EstCode = "HPS", Nationality = "", - Ethnicity = "" + Ethnicity = "", + IsActive = true } ]; From 528fc1c4eea501b5134e85b6871feec3551f8d70 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 30 Aug 2024 14:19:21 +0100 Subject: [PATCH 4/6] Bug fix for event dispatch ordering --- src/Domain/Entities/Participants/Participant.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Domain/Entities/Participants/Participant.cs b/src/Domain/Entities/Participants/Participant.cs index 416554dc..bb83183f 100644 --- a/src/Domain/Entities/Participants/Participant.cs +++ b/src/Domain/Entities/Participants/Participant.cs @@ -175,8 +175,8 @@ public Participant AddOrUpdateDateOfBirth(DateOnly dateOfBirth) { if(DateOfBirth != dateOfBirth) { - DateOfBirth = dateOfBirth; AddDomainEvent(new ParticipantDateOfBirthChangedDomainEvent(this, DateOfBirth, dateOfBirth)); + DateOfBirth = dateOfBirth; } return this; @@ -193,8 +193,8 @@ public Participant AddOrUpdateExternalIdentifier(ExternalIdentifier newIdentifie if(identifier is { Type.IsExclusive: true } ) { - _externalIdentifiers.Remove(identifier); AddDomainEvent(new ParticipantIdentifierChangedDomainEvent(this, identifier, newIdentifier)); + _externalIdentifiers.Remove(identifier); } _externalIdentifiers.Add(newIdentifier); @@ -206,8 +206,8 @@ public Participant AddOrUpdateGender(string? gender) { if (string.Equals(Gender, gender, StringComparison.OrdinalIgnoreCase) is false) { - Gender = gender; AddDomainEvent(new ParticipantGenderChangedDomainEvent(this, Gender, gender)); + Gender = gender; } return this; @@ -264,8 +264,8 @@ public Participant UpdateActiveStatus(bool activeInFeed) { if(ActiveInFeed != activeInFeed) { - ActiveInFeed = activeInFeed; AddDomainEvent(new ParticipantActiveStatusChangedDomainEvent(this, ActiveInFeed, activeInFeed)); + ActiveInFeed = activeInFeed; } return this; From d32dca9c1715ac2d093e43b2159a6aac2b157ea0 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 30 Aug 2024 14:50:00 +0100 Subject: [PATCH 5/6] Present ineligible screen when a candidate has no active custody/community record --- ...32447_Participant_ActiveInFeed.Designer.cs | 2720 +++++++++++++++++ ...20240830132447_Participant_ActiveInFeed.cs | 31 + .../ApplicationDbContextModelSnapshot.cs | 6 +- .../CandidateResultsComponent.razor | 42 +- .../Candidates/Components/MatchFound.razor | 6 +- .../Candidates/Components/MatchFound.razor.cs | 20 +- .../Candidates/Components/NotEligible.razor | 18 + 7 files changed, 2812 insertions(+), 31 deletions(-) create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240830132447_Participant_ActiveInFeed.Designer.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240830132447_Participant_ActiveInFeed.cs create mode 100644 src/Server.UI/Pages/Candidates/Components/NotEligible.razor diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240830132447_Participant_ActiveInFeed.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240830132447_Participant_ActiveInFeed.Designer.cs new file mode 100644 index 00000000..14b4fa94 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240830132447_Participant_ActiveInFeed.Designer.cs @@ -0,0 +1,2720 @@ +// +using System; +using Cfo.Cats.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20240830132447_Participant_ActiveInFeed")] + partial class Participant_ActiveInFeed + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Contract", b => + { + b.Property("Id") + .HasMaxLength(12) + .HasColumnType("nvarchar(12)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LotNumber") + .HasColumnType("int"); + + b.Property("_tenantId") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("LotNumber") + .IsUnique(); + + b.HasIndex("_tenantId"); + + b.ToTable("Contract", "Configuration"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("_contractId") + .HasMaxLength(12) + .HasColumnType("nvarchar(12)") + .HasColumnName("ContractId"); + + b.Property("_genderProvisionId") + .HasColumnType("int") + .HasColumnName("GenderProvisionId"); + + b.Property("_locationTypeId") + .HasColumnType("int") + .HasColumnName("LocationTypeId"); + + b.Property("_parentLocationId") + .HasColumnType("int") + .HasColumnName("ParentLocationId"); + + b.HasKey("Id"); + + b.HasIndex("_contractId"); + + b.HasIndex("_parentLocationId"); + + b.ToTable("Location", "Configuration"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.LocationMapping", b => + { + b.Property("Code") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CodeType") + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("DeliveryRegion") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("_locationId") + .HasColumnType("int") + .HasColumnName("LocationId"); + + b.HasKey("Code", "CodeType"); + + b.HasIndex("_locationId"); + + b.ToTable("LocationMapping", "Dms"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Tenant", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Tenant", "Configuration"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Assessments.ParticipantAssessment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssessmentJson") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Completed") + .HasColumnType("datetime2"); + + b.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("OwnerId") + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("TenantId") + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId"); + + b.HasIndex("TenantId"); + + b.ToTable("Assessment", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.AuditTrail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AffectedColumns") + .HasColumnType("nvarchar(max)"); + + b.Property("AuditType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("NewValues") + .HasColumnType("nvarchar(max)"); + + b.Property("OldValues") + .HasColumnType("nvarchar(max)"); + + b.Property("PrimaryKey") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TableName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AuditTrail", "Audit"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Bios.ParticipantBio", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BioJson") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Completed") + .HasColumnType("datetime2"); + + b.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Bio", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Documents.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DocumentType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EditorId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("OwnerId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("TenantId") + .HasColumnType("nvarchar(50)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("URL") + .HasColumnType("nvarchar(max)"); + + b.Property("Version") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.IdentityAuditTrail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ActionType") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("IpAddress") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("PerformedBy") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("UserName", "DateTime") + .HasDatabaseName("idx_IdentityAudit_UserName_DateTime"); + + b.ToTable("IdentityAuditTrail", "Audit"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.KeyValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Description") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("KeyValue", "Configuration"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentEscalationQueueEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("IsAccepted") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("OwnerId") + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("TenantId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId"); + + b.HasIndex("TenantId"); + + b.ToTable("EscalationQueue", "Enrolment"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentPqaQueueEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("IsAccepted") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("OwnerId") + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("TenantId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId"); + + b.HasIndex("TenantId"); + + b.ToTable("PqaQueue", "Enrolment"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentQa1QueueEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("IsAccepted") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("OwnerId") + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("TenantId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId"); + + b.HasIndex("TenantId"); + + b.ToTable("Qa1Queue", "Enrolment"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentQa2QueueEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("IsAccepted") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("OwnerId") + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("TenantId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId"); + + b.HasIndex("TenantId"); + + b.ToTable("Qa2Queue", "Enrolment"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => + { + b.Property("Id") + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("ActiveInFeed") + .HasColumnType("bit"); + + b.Property("AssessmentJustification") + .HasColumnType("nvarchar(max)"); + + b.Property("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .HasColumnType("date"); + + b.Property("EditorId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("EnrolmentLocationJustification") + .HasColumnType("nvarchar(max)"); + + b.Property("EnrolmentStatus") + .HasColumnType("int"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Gender") + .HasMaxLength(6) + .HasColumnType("nvarchar(6)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MiddleName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("OwnerId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ReferralComments") + .HasColumnType("nvarchar(max)"); + + b.Property("ReferralSource") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("_currentLocationId") + .HasColumnType("int") + .HasColumnName("CurrentLocationId"); + + b.Property("_enrolmentLocationId") + .HasColumnType("int") + .HasColumnName("EnrolmentLocationId"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("_currentLocationId"); + + b.HasIndex("_enrolmentLocationId"); + + b.ToTable("Participant", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.ParticipantEnrolmentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("EnrolmentStatus") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("EnrolmentHistory", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.PathwayPlan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("PathwayPlan", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Risk", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ActivityRecommendations") + .HasColumnType("nvarchar(max)"); + + b.Property("ActivityRecommendationsReceived") + .HasColumnType("datetime2"); + + b.Property("ActivityRestrictions") + .HasColumnType("nvarchar(max)"); + + b.Property("ActivityRestrictionsReceived") + .HasColumnType("datetime2"); + + b.Property("AdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("Completed") + .HasColumnType("datetime2"); + + b.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DeclarationSigned") + .HasColumnType("bit"); + + b.Property("IsRelevantToCommunity") + .HasColumnType("bit"); + + b.Property("IsRelevantToCustody") + .HasColumnType("bit"); + + b.Property("IsSubjectToSHPO") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LicenseConditions") + .HasColumnType("nvarchar(max)"); + + b.Property("LicenseEnd") + .HasColumnType("datetime2"); + + b.Property("MappaCategory") + .HasColumnType("int"); + + b.Property("MappaLevel") + .HasColumnType("int"); + + b.Property("NSDCase") + .HasColumnType("int"); + + b.Property("PSFRestrictions") + .HasColumnType("nvarchar(max)"); + + b.Property("PSFRestrictionsReceived") + .HasColumnType("datetime2"); + + b.Property("ParticipantId") + .IsRequired() + .HasColumnType("nvarchar(9)"); + + b.Property("ReferredOn") + .HasColumnType("datetime2"); + + b.Property("ReferrerEmail") + .HasColumnType("nvarchar(max)"); + + b.Property("ReferrerName") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewJustification") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewReason") + .HasColumnType("int"); + + b.Property("RiskToChildrenInCommunity") + .HasColumnType("int"); + + b.Property("RiskToChildrenInCustody") + .HasColumnType("int"); + + b.Property("RiskToKnownAdultInCommunity") + .HasColumnType("int"); + + b.Property("RiskToKnownAdultInCustody") + .HasColumnType("int"); + + b.Property("RiskToOtherPrisonersInCommunity") + .HasColumnType("int"); + + b.Property("RiskToOtherPrisonersInCustody") + .HasColumnType("int"); + + b.Property("RiskToPublicInCommunity") + .HasColumnType("int"); + + b.Property("RiskToPublicInCustody") + .HasColumnType("int"); + + b.Property("RiskToSelfInCommunity") + .HasColumnType("int"); + + b.Property("RiskToSelfInCustody") + .HasColumnType("int"); + + b.Property("RiskToStaffInCommunity") + .HasColumnType("int"); + + b.Property("RiskToStaffInCustody") + .HasColumnType("int"); + + b.Property("SpecificRisk") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Risk", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Timeline", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(36)"); + + b.Property("EventType") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Line1") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Line2") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Line3") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ParticipantId") + .IsRequired() + .HasColumnType("nvarchar(9)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Timeline", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationRole", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RoleRank") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Role", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Group") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RoleId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaim", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUser", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsLive") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("MemorableDate") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MemorablePlace") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("ProfilePictureDataUrl") + .HasColumnType("text"); + + b.Property("ProviderId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RefreshToken") + .HasColumnType("nvarchar(max)"); + + b.Property("RefreshTokenExpiryTime") + .HasColumnType("datetime2"); + + b.Property("RequiresPasswordReset") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("SuperiorId") + .HasColumnType("nvarchar(36)"); + + b.Property("TenantId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.HasIndex("SuperiorId"); + + b.HasIndex("TenantId"); + + b.ToTable("User", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("UserId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserClaim", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserRole", b => + { + b.Property("UserId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("RoleId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRole", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserToken", b => + { + b.Property("UserId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("UserToken", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.PasswordHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.ToTable("PasswordHistory", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.UserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("UserLogin", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FriendlyName") + .HasColumnType("nvarchar(max)"); + + b.Property("Xml") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("TenantLocation", b => + { + b.Property("LocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("nvarchar(50)"); + + b.HasKey("LocationId", "TenantId"); + + b.HasIndex("TenantId"); + + b.ToTable("TenantLocation", "Configuration"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Contract", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("_tenantId"); + + b.OwnsOne("Cfo.Cats.Domain.ValueObjects.Lifetime", "Lifetime", b1 => + { + b1.Property("ContractId") + .HasColumnType("nvarchar(12)"); + + b1.Property("EndDate") + .HasColumnType("datetime2") + .HasColumnName("LifetimeEnd"); + + b1.Property("StartDate") + .HasColumnType("datetime2") + .HasColumnName("LifetimeStart"); + + b1.HasKey("ContractId"); + + b1.ToTable("Contract", "Configuration"); + + b1.WithOwner() + .HasForeignKey("ContractId"); + }); + + b.Navigation("Lifetime") + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Location", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Contract", "Contract") + .WithMany("Locations") + .HasForeignKey("_contractId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", "ParentLocation") + .WithMany("ChildLocations") + .HasForeignKey("_parentLocationId") + .OnDelete(DeleteBehavior.Restrict); + + b.OwnsOne("Cfo.Cats.Domain.ValueObjects.Lifetime", "Lifetime", b1 => + { + b1.Property("LocationId") + .HasColumnType("int"); + + b1.Property("EndDate") + .HasColumnType("datetime2") + .HasColumnName("LifetimeEnd"); + + b1.Property("StartDate") + .HasColumnType("datetime2") + .HasColumnName("LifetimeStart"); + + b1.HasKey("LocationId"); + + b1.ToTable("Location", "Configuration"); + + b1.WithOwner() + .HasForeignKey("LocationId"); + }); + + b.Navigation("Contract"); + + b.Navigation("Lifetime") + .IsRequired(); + + b.Navigation("ParentLocation"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.LocationMapping", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", "Location") + .WithMany("LocationMappings") + .HasForeignKey("_locationId"); + + b.Navigation("Location"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Tenant", b => + { + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.TenantDomain", "Domains", b1 => + { + b1.Property("TenantId") + .HasColumnType("nvarchar(50)"); + + b1.Property("Domain") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.HasKey("TenantId", "Domain"); + + b1.ToTable("TenantDomain", "Configuration"); + + b1.WithOwner() + .HasForeignKey("TenantId"); + }); + + b.Navigation("Domains"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Assessments.ParticipantAssessment", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade); + + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.PathwayScore", "Scores", b1 => + { + b1.Property("AssessmentId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Pathway") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b1.Property("Score") + .HasColumnType("float"); + + b1.HasKey("AssessmentId", "Pathway"); + + b1.ToTable("AssessmentPathwayScore", "Participant"); + + b1.WithOwner() + .HasForeignKey("AssessmentId"); + }); + + b.Navigation("Editor"); + + b.Navigation("Owner"); + + b.Navigation("Scores"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.AuditTrail", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Bios.ParticipantBio", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Documents.Document", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("CreatedBy") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("LastModifiedBy") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Editor"); + + b.Navigation("Owner"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentEscalationQueueEntry", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", "Participant") + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.Note", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("EnrolmentEscalationQueueEntryId") + .HasColumnType("uniqueidentifier"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("EnrolmentEscalationQueueEntryId"); + + b1.HasIndex("LastModifiedBy"); + + b1.ToTable("EscalationNote", "Enrolment"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.WithOwner() + .HasForeignKey("EnrolmentEscalationQueueEntryId"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.Navigation("Editor"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("Participant"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentPqaQueueEntry", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", "Participant") + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.Note", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("EnrolmentPqaQueueEntryId") + .HasColumnType("uniqueidentifier"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("EnrolmentPqaQueueEntryId"); + + b1.HasIndex("LastModifiedBy"); + + b1.ToTable("PqaQueueNote", "Enrolment"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.WithOwner() + .HasForeignKey("EnrolmentPqaQueueEntryId"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.Navigation("Editor"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("Participant"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentQa1QueueEntry", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", "Participant") + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.Note", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("EnrolmentQa1QueueEntryId") + .HasColumnType("uniqueidentifier"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("EnrolmentQa1QueueEntryId"); + + b1.HasIndex("LastModifiedBy"); + + b1.ToTable("Qa1QueueNote", "Enrolment"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.WithOwner() + .HasForeignKey("EnrolmentQa1QueueEntryId"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.Navigation("Editor"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("Participant"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentQa2QueueEntry", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", "Participant") + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.Note", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("EnrolmentQa2QueueEntryId") + .HasColumnType("uniqueidentifier"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("EnrolmentQa2QueueEntryId"); + + b1.HasIndex("LastModifiedBy"); + + b1.ToTable("Qa2QueueNote", "Enrolment"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.WithOwner() + .HasForeignKey("EnrolmentQa2QueueEntryId"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.Navigation("Editor"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("Participant"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", "CurrentLocation") + .WithMany() + .HasForeignKey("_currentLocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_Participant_Location"); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", "EnrolmentLocation") + .WithMany() + .HasForeignKey("_enrolmentLocationId") + .HasConstraintName("FK_Participant_EnrolmentLocation"); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.Consent", "Consents", b1 => + { + b1.Property("ParticipantId") + .HasColumnType("nvarchar(9)"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("_documentId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DocumentId"); + + b1.HasKey("ParticipantId", "Id"); + + b1.HasIndex("_documentId"); + + b1.ToTable("Consent", "Participant"); + + b1.WithOwner() + .HasForeignKey("ParticipantId"); + + b1.HasOne("Cfo.Cats.Domain.Entities.Documents.Document", "Document") + .WithMany() + .HasForeignKey("_documentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b1.OwnsOne("Cfo.Cats.Domain.ValueObjects.Lifetime", "Lifetime", b2 => + { + b2.Property("ConsentParticipantId") + .HasColumnType("nvarchar(9)"); + + b2.Property("ConsentId") + .HasColumnType("int"); + + b2.Property("EndDate") + .HasColumnType("datetime2") + .HasColumnName("ValidTo"); + + b2.Property("StartDate") + .HasColumnType("datetime2") + .HasColumnName("ValidFrom"); + + b2.HasKey("ConsentParticipantId", "ConsentId"); + + b2.ToTable("Consent", "Participant"); + + b2.WithOwner() + .HasForeignKey("ConsentParticipantId", "ConsentId"); + }); + + b1.Navigation("Document"); + + b1.Navigation("Lifetime") + .IsRequired(); + }); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ExternalIdentifier", "ExternalIdentifiers", b1 => + { + b1.Property("Value") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b1.Property("Type") + .HasColumnType("int"); + + b1.Property("ParticipantId") + .HasColumnType("nvarchar(9)"); + + b1.HasKey("Value", "Type", "ParticipantId"); + + b1.HasIndex("ParticipantId"); + + b1.ToTable("ExternalIdentifier", "Participant"); + + b1.WithOwner() + .HasForeignKey("ParticipantId"); + }); + + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.Note", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b1.Property("ParticipantId") + .IsRequired() + .HasColumnType("nvarchar(9)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("LastModifiedBy"); + + b1.HasIndex("ParticipantId"); + + b1.ToTable("Note", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.WithOwner() + .HasForeignKey("ParticipantId"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.RightToWork", "RightToWorks", b1 => + { + b1.Property("ParticipantId") + .HasColumnType("nvarchar(9)"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("_documentId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DocumentId"); + + b1.HasKey("ParticipantId", "Id"); + + b1.HasIndex("_documentId"); + + b1.ToTable("RightToWork", "Participant"); + + b1.WithOwner() + .HasForeignKey("ParticipantId"); + + b1.HasOne("Cfo.Cats.Domain.Entities.Documents.Document", "Document") + .WithMany() + .HasForeignKey("_documentId"); + + b1.OwnsOne("Cfo.Cats.Domain.ValueObjects.Lifetime", "Lifetime", b2 => + { + b2.Property("RightToWorkParticipantId") + .HasColumnType("nvarchar(9)"); + + b2.Property("RightToWorkId") + .HasColumnType("int"); + + b2.Property("EndDate") + .HasColumnType("datetime2") + .HasColumnName("ValidTo"); + + b2.Property("StartDate") + .HasColumnType("datetime2") + .HasColumnName("ValidFrom"); + + b2.HasKey("RightToWorkParticipantId", "RightToWorkId"); + + b2.ToTable("RightToWork", "Participant"); + + b2.WithOwner() + .HasForeignKey("RightToWorkParticipantId", "RightToWorkId"); + }); + + b1.Navigation("Document"); + + b1.Navigation("Lifetime") + .IsRequired(); + }); + + b.OwnsOne("Cfo.Cats.Domain.Entities.Participants.Supervisor", "Supervisor", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("Address") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b1.Property("EmailAddress") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b1.Property("MobileNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b1.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b1.Property("ParticipantId") + .IsRequired() + .HasColumnType("nvarchar(9)"); + + b1.Property("TelephoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b1.HasKey("Id"); + + b1.HasIndex("ParticipantId") + .IsUnique(); + + b1.ToTable("Supervisor", "Participant"); + + b1.WithOwner() + .HasForeignKey("ParticipantId"); + }); + + b.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("ExternalIdentifiers"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + + b.Navigation("Supervisor"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.PathwayPlan", b => + { + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.Objective", "Objectives", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("Completed") + .HasColumnType("datetime2"); + + b1.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("CompletedStatus") + .HasColumnType("int"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.Property("Index") + .HasColumnType("int"); + + b1.Property("Justification") + .HasColumnType("nvarchar(max)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("PathwayPlanId") + .HasColumnType("uniqueidentifier"); + + b1.HasKey("Id"); + + b1.HasIndex("CompletedBy"); + + b1.HasIndex("PathwayPlanId"); + + b1.ToTable("Objective", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b1.WithOwner() + .HasForeignKey("PathwayPlanId"); + + b1.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", b2 => + { + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b2.Property("Completed") + .HasColumnType("datetime2"); + + b2.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b2.Property("CompletedStatus") + .HasColumnType("int"); + + b2.Property("Created") + .HasColumnType("datetime2"); + + b2.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b2.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b2.Property("Due") + .HasColumnType("datetime2"); + + b2.Property("Index") + .HasColumnType("int"); + + b2.Property("Justification") + .HasColumnType("nvarchar(max)"); + + b2.Property("LastModified") + .HasColumnType("datetime2"); + + b2.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b2.Property("ObjectiveId") + .HasColumnType("uniqueidentifier"); + + b2.HasKey("Id"); + + b2.HasIndex("CompletedBy"); + + b2.HasIndex("ObjectiveId"); + + b2.ToTable("ObjectiveTask", "Participant"); + + b2.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b2.WithOwner() + .HasForeignKey("ObjectiveId"); + + b2.Navigation("CompletedByUser"); + }); + + b1.Navigation("CompletedByUser"); + + b1.Navigation("Tasks"); + }); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.PathwayPlanReviewHistory", "ReviewHistories", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("PathwayPlanId") + .HasColumnType("uniqueidentifier"); + + b1.HasKey("Id"); + + b1.HasIndex("PathwayPlanId"); + + b1.ToTable("PathwayPlanReviewHistory", "Participant"); + + b1.WithOwner() + .HasForeignKey("PathwayPlanId"); + }); + + b.Navigation("Objectives"); + + b.Navigation("ReviewHistories"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Risk", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Timeline", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedByUser"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationRoleClaim", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationRole", "Role") + .WithMany("RoleClaims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUser", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Superior") + .WithMany() + .HasForeignKey("SuperiorId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.Note", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.Property("UserId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("LastModifiedBy"); + + b1.HasIndex("UserId"); + + b1.ToTable("Note", "Identity"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.WithOwner() + .HasForeignKey("UserId"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.Navigation("Notes"); + + b.Navigation("Superior"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserClaim", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "User") + .WithMany("UserClaims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserRole", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationRole", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserToken", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "User") + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.UserLogin", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "User") + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("TenantLocation", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", null) + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Contract", b => + { + b.Navigation("Locations"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Location", b => + { + b.Navigation("ChildLocations"); + + b.Navigation("LocationMappings"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationRole", b => + { + b.Navigation("RoleClaims"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUser", b => + { + b.Navigation("Logins"); + + b.Navigation("Tokens"); + + b.Navigation("UserClaims"); + + b.Navigation("UserRoles"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240830132447_Participant_ActiveInFeed.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240830132447_Participant_ActiveInFeed.cs new file mode 100644 index 00000000..7ad0287b --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240830132447_Participant_ActiveInFeed.cs @@ -0,0 +1,31 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Participant_ActiveInFeed : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ActiveInFeed", + schema: "Participant", + table: "Participant", + type: "bit", + nullable: false, + defaultValue: false); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ActiveInFeed", + schema: "Participant", + table: "Participant"); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs index dde4ca78..638a0a04 100644 --- a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs @@ -694,6 +694,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(9) .HasColumnType("nvarchar(9)"); + b.Property("ActiveInFeed") + .HasColumnType("bit"); + b.Property("AssessmentJustification") .HasColumnType("nvarchar(max)"); @@ -707,8 +710,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(36) .HasColumnType("nvarchar(36)"); - b.Property("DateOfBirth") - .IsRequired() + b.Property("DateOfBirth") .HasColumnType("date"); b.Property("EditorId") diff --git a/src/Server.UI/Pages/Candidates/Components/CandidateResultsComponent.razor b/src/Server.UI/Pages/Candidates/Components/CandidateResultsComponent.razor index f6ca2a26..5927d9b8 100644 --- a/src/Server.UI/Pages/Candidates/Components/CandidateResultsComponent.razor +++ b/src/Server.UI/Pages/Candidates/Components/CandidateResultsComponent.razor @@ -1,3 +1,4 @@ +@using Cfo.Cats.Application.Features.Candidates.DTOs @using Cfo.Cats.Application.Features.Candidates.Queries.Search @using Cfo.Cats.Application.Features.Participants.Queries @inherits CatsComponentBase @@ -11,9 +12,12 @@ private Type? _selectedType = null; private Dictionary _selectedParameters = []; - + private bool Confirmation { get; set; } + [Inject] + public ICandidateService CandidateService { get; set; } = default!; + [Parameter, EditorRequired] public EventCallback OnCancelled { get; set; } @@ -42,13 +46,13 @@ } else if (SearchReturnedIdenticalCandidate()) { - await BeginEnrolmentIfNotAlreadyEnrolled(); + await BeginEnrolmentIfEligible(); } else if (SearchReturnedSingleCandidate()) { - if(CandidateMeetsMinimumPrecedence(10)) + if(SearchReturnedCloseMatch()) { - await BeginEnrolmentIfNotAlreadyEnrolled(); + await BeginEnrolmentIfEligible(); } else { @@ -62,9 +66,9 @@ bool SearchReturnedIdenticalCandidate() => SearchResults.Any(result => result.Precedence is 1); bool SearchReturnedMultipleAmbiguousCandidates() => SearchResults is { Length: > 1 } && SearchReturnedIdenticalCandidate() is false; - void ShowCandidateFound() + void ShowCandidateFound(CandidateDto candidate) { - _selectedParameters.Add("CandidateId", Candidate.Upci); + _selectedParameters.Add("Candidate", candidate); _selectedParameters.Add("Query", Query); _selectedParameters.Add("OnParticipantEnrolled", EventCallback.Factory.Create(this, OnParticipantEnrolledHandler)); _selectedType = typeof(MatchFound); @@ -79,29 +83,43 @@ void ShowNoResultsFound() => _selectedType = typeof(NoResults); void ShowMoreInformationRequired() => _selectedType = typeof(MoreInformationRequired); void ShowTooManyResultsFound() => _selectedType = typeof(TooManyResults); + void ShowCandidateNotEligible() => _selectedType = typeof(NotEligible); - async Task BeginEnrolmentIfNotAlreadyEnrolled() + async Task BeginEnrolmentIfEligible() { var result = SearchResults .OrderBy(candidate => candidate.Precedence) .First(); - var enrolled = await GetNewMediator().Send(new CheckParticipantExistsById.Query + var alreadyEnrolled = await GetNewMediator().Send(new CheckParticipantExistsById.Query { Id = result.Upci }); - if (enrolled) + if (alreadyEnrolled) { ShowCandidateAlreadyEnrolled(); + return; } - else + + var candidate = await CandidateService.GetByUpciAsync(result.Upci); + + if (candidate is null) { - ShowCandidateFound(); + Snackbar.Add("An issue occurred when attempting to retrieve the candidates information.", Severity.Error); + return; } + + if(candidate.IsActive is false) + { + ShowCandidateNotEligible(); + return; + } + + ShowCandidateFound(candidate); } - bool CandidateMeetsMinimumPrecedence(int precedence) => Candidate.Precedence <= precedence; + bool SearchReturnedCloseMatch(int precedence = 10) => Candidate.Precedence <= precedence; SearchResult Candidate => SearchResults.OrderBy(candidate => candidate.Precedence).First(); diff --git a/src/Server.UI/Pages/Candidates/Components/MatchFound.razor b/src/Server.UI/Pages/Candidates/Components/MatchFound.razor index e0a0e70a..ba600225 100644 --- a/src/Server.UI/Pages/Candidates/Components/MatchFound.razor +++ b/src/Server.UI/Pages/Candidates/Components/MatchFound.razor @@ -1,11 +1,11 @@ @inherits CatsComponentBase -@if(candidate is not null && Model is not null) +@if(Model is not null) { - We have found a match: @(string.Join(' ', new [] { candidate.FirstName, candidate.SecondName, candidate.LastName})) (@candidate.Identifier) - We have them located at @(candidate.LocationDescription ?? "Unmapped Location") + We have found a match: @(string.Join(' ', new [] { Candidate.FirstName, Candidate.SecondName, Candidate.LastName})) (@Candidate.Identifier) + We have them located at @(Candidate.LocationDescription ?? "Unmapped Location") diff --git a/src/Server.UI/Pages/Candidates/Components/MatchFound.razor.cs b/src/Server.UI/Pages/Candidates/Components/MatchFound.razor.cs index e71772f9..a23b266d 100644 --- a/src/Server.UI/Pages/Candidates/Components/MatchFound.razor.cs +++ b/src/Server.UI/Pages/Candidates/Components/MatchFound.razor.cs @@ -16,13 +16,10 @@ public partial class MatchFound private CreateParticipant.Command? Model; - private CandidateDto? candidate; - private List? _comparisons; - [Parameter] - [EditorRequired] - public string CandidateId { get; set; } = default!; + [Parameter, EditorRequired] + public required CandidateDto Candidate { get; set; } [CascadingParameter] public UserProfile? UserProfile { get; set; } @@ -36,23 +33,18 @@ public partial class MatchFound [Parameter] public EventCallback OnParticipantEnrolled { get; set; } - [Inject] - public ICandidateService CandidateService { get; set; } = default!; protected async override Task OnInitializedAsync() { - candidate = await CandidateService.GetByUpciAsync(CandidateId) - ?? throw new ApplicationException("We found a candidate, but then could not get it"); - _comparisons = [ - new("First Name", Query.FirstName.ToUpper(), candidate.FirstName.ToUpper()), - new("Last Name", Query.LastName.ToUpper(), candidate.LastName.ToUpper()), - new("Date Of Birth", Query.DateOfBirth.GetValueOrDefault().ToShortDateString(), candidate.DateOfBirth.ToShortDateString()) + new("First Name", Query.FirstName.ToUpper(), Candidate.FirstName.ToUpper()), + new("Last Name", Query.LastName.ToUpper(), Candidate.LastName.ToUpper()), + new("Date Of Birth", Query.DateOfBirth.GetValueOrDefault().ToShortDateString(), Candidate.DateOfBirth.ToShortDateString()) ]; Model = new CreateParticipant.Command { - Candidate = candidate, + Candidate = Candidate, CurrentUser = UserProfile! }; diff --git a/src/Server.UI/Pages/Candidates/Components/NotEligible.razor b/src/Server.UI/Pages/Candidates/Components/NotEligible.razor new file mode 100644 index 00000000..173ddf1c --- /dev/null +++ b/src/Server.UI/Pages/Candidates/Components/NotEligible.razor @@ -0,0 +1,18 @@ + + + + The candidate found does not meet the eligiblity criteria. + + + + Back to Search + + + + +@code +{ + [Parameter] + public EventCallback OnCanceled { get; set; } + private Task BackToSearch() => OnCanceled.InvokeAsync(); +} \ No newline at end of file From 131348f83b0a1156a89d93549b98ab7d6738941c Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Mon, 2 Sep 2024 09:00:41 +0100 Subject: [PATCH 6/6] Candidate seeding - set some users to inactive --- .../Services/Candidates/DummyCandidateService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Infrastructure/Services/Candidates/DummyCandidateService.cs b/src/Infrastructure/Services/Candidates/DummyCandidateService.cs index 33a03dc3..1317c24e 100644 --- a/src/Infrastructure/Services/Candidates/DummyCandidateService.cs +++ b/src/Infrastructure/Services/Candidates/DummyCandidateService.cs @@ -66,7 +66,7 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService EstCode = "GNI", Nationality = "", Ethnicity = "", - IsActive = true + IsActive = false }, new CandidateDto { @@ -81,7 +81,7 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService EstCode = "SKI", Nationality = "", Ethnicity = "", - IsActive = true + IsActive = false }, new CandidateDto { @@ -96,7 +96,7 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService EstCode = "N07", Nationality = "", Ethnicity = "", - IsActive = true + IsActive = false }, new CandidateDto { @@ -111,7 +111,7 @@ public class DummyCandidateService(IUnitOfWork unitOfWork) : ICandidateService EstCode = "FYI", Nationality = "", Ethnicity = "", - IsActive = true + IsActive = false }, new CandidateDto {