From db4447c528d497611decee3f547285d35d216bd6 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Wed, 7 Aug 2024 16:01:44 +0100 Subject: [PATCH 01/35] WIP: Pathway Plan / Objectives screen --- .../Components/CasePathwayPlan.razor | 165 ++++++++++++++++++ .../Pages/Participants/Participant.razor | 3 + 2 files changed, 168 insertions(+) create mode 100644 src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor new file mode 100644 index 00000000..327511ad --- /dev/null +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -0,0 +1,165 @@ +@using Humanizer + + + +@if(Model is not null) +{ + + + + Select your tasks: + + @foreach (var objective in Model) + { + + +
+ @objective.Title + (@objective.Tasks.Count(x => x.Completed)/@objective.Tasks.Length) + @if(objective.Tasks.Any(x => IsOverdue(x.DueDate))) + { + + } + else if (objective.Tasks.Any(x => IsDueSoon(x.DueDate))) + { + + } +
+
+ + @foreach (var task in objective.Tasks) + { + +
+
+
+ + @task.Title + + @if (IsOverdue(task.DueDate)) + { + + + + } + else if (IsDueSoon(task.DueDate)) + { + + + + } +
+ Due @($"{task.DueDate.Humanize()} ({task.DueDate.ToShortDateString()})") +
+
+ + + +
+
+
+ } +
+
+ + } +
+
+} + +@code { + [Parameter, EditorRequired] + public required string ParticipantId { get; set; } + + public IEnumerable? Model { get; set; } + + IReadOnlyCollection SelectedTasks = []; + + protected override void OnInitialized() + { + var today = DateOnly.FromDateTime(DateTime.UtcNow); + + Model = new List() + { + new Objective("Employability Aid", new ObjectiveTask[] + { + new ObjectiveTask() + { + Title = "Construct a CV", + DueDate = today.AddDays(-1) + }, + new ObjectiveTask() + { + Title = "Interview practice/preparation", + DueDate = today.AddDays(6) + } + }), + new Objective("Finance and Debt", new ObjectiveTask[] + { + new ObjectiveTask() + { + Title = "Managing finances and debt", + DueDate = today.AddDays(14), + Completed = true + } + }), + new Objective("Identification", new ObjectiveTask[] + { + new ObjectiveTask() + { + Title = "Obtain a new passport", + DueDate = today.AddDays(60) + } + }), + new Objective("Disclosure Advice", new ObjectiveTask[] + { + new ObjectiveTask() + { + Title = "Offence disclosure discussion", + DueDate = today.AddDays(3) + } + }) + }; + + SelectedTasks = Model.SelectMany(objective => objective.Tasks.Where(task => task.Completed)) + .ToList() + .AsReadOnly(); + + base.OnInitialized(); + } + + public void Select(IReadOnlyCollection? tasks) + { + foreach(var task in SelectedTasks) + { + task.Completed = false; + } + + foreach(var task in tasks ?? []) + { + task.Completed = true; + } + + SelectedTasks = tasks ?? []; + } + + public async Task Edit(ObjectiveTask task) + { + await DialogService.ShowMessageBox("Edit Task", "Editing..."); + } + + public bool IsOverdue(DateOnly DueDate) => DateOnly.FromDateTime(DateTime.UtcNow) > DueDate; + public bool IsDueSoon(DateOnly DueDate, int daysNo = 7) => DateOnly.FromDateTime(DateTime.UtcNow).AddDays(daysNo) > DueDate; + + public record Objective(string Title, ObjectiveTask[] Tasks); + public class ObjectiveTask + { + public required string Title { get; set; } + public required DateOnly DueDate { get; set; } + public bool Completed { get; set; } = false; + } +} diff --git a/src/Server.UI/Pages/Participants/Participant.razor b/src/Server.UI/Pages/Participants/Participant.razor index 503f6df6..976e0b0d 100644 --- a/src/Server.UI/Pages/Participants/Participant.razor +++ b/src/Server.UI/Pages/Participants/Participant.razor @@ -90,6 +90,9 @@ + + + From a06991d1106372eabab944cce33c1b33847b4d15 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Wed, 7 Aug 2024 16:18:57 +0100 Subject: [PATCH 02/35] Objective task completion dates --- .../Components/CasePathwayPlan.razor | 64 ++++++++++++------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index 327511ad..5fe48a38 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -19,12 +19,12 @@
@objective.Title - (@objective.Tasks.Count(x => x.Completed)/@objective.Tasks.Length) - @if(objective.Tasks.Any(x => IsOverdue(x.DueDate))) + (@objective.Tasks.Count(x => x.Completed is not null)/@objective.Tasks.Length) + @if(objective.Tasks.Any(x => IsOverdue(x))) { } - else if (objective.Tasks.Any(x => IsDueSoon(x.DueDate))) + else if (objective.Tasks.Any(x => IsDueSoon(x))) { } @@ -40,20 +40,30 @@ @task.Title - @if (IsOverdue(task.DueDate)) + @if (IsNotComplete(task)) { - - - - } - else if (IsDueSoon(task.DueDate)) - { - - - + @if (IsOverdue(task)) + { + + + + } + else if (IsDueSoon(task)) + { + + + + } }
- Due @($"{task.DueDate.Humanize()} ({task.DueDate.ToShortDateString()})") + @if(task.Completed is null) + { + Due @($"{task.DueDate.Humanize()} ({task.DueDate.ToShortDateString()})") + } + else + { + Completed @task.Completed.Humanize() + }
@@ -104,7 +114,7 @@ { Title = "Managing finances and debt", DueDate = today.AddDays(14), - Completed = true + Completed = DateTime.UtcNow.AddMinutes(-30) } }), new Objective("Identification", new ObjectiveTask[] @@ -125,7 +135,7 @@ }) }; - SelectedTasks = Model.SelectMany(objective => objective.Tasks.Where(task => task.Completed)) + SelectedTasks = Model.SelectMany(objective => objective.Tasks.Where(task => task.Completed is not null)) .ToList() .AsReadOnly(); @@ -134,17 +144,22 @@ public void Select(IReadOnlyCollection? tasks) { - foreach(var task in SelectedTasks) + if (tasks is null) + { + return; + } + + foreach(var task in SelectedTasks.Except(tasks)) { - task.Completed = false; + task.Completed = null; } - foreach(var task in tasks ?? []) + foreach (var task in tasks.Where(IsNotComplete)) { - task.Completed = true; + task.Completed = DateTime.UtcNow; } - SelectedTasks = tasks ?? []; + SelectedTasks = tasks; } public async Task Edit(ObjectiveTask task) @@ -152,14 +167,15 @@ await DialogService.ShowMessageBox("Edit Task", "Editing..."); } - public bool IsOverdue(DateOnly DueDate) => DateOnly.FromDateTime(DateTime.UtcNow) > DueDate; - public bool IsDueSoon(DateOnly DueDate, int daysNo = 7) => DateOnly.FromDateTime(DateTime.UtcNow).AddDays(daysNo) > DueDate; + public bool IsOverdue(ObjectiveTask task) => IsNotComplete(task) && DateOnly.FromDateTime(DateTime.UtcNow) > task.DueDate; + public bool IsDueSoon(ObjectiveTask task, int daysNo = 7) => IsNotComplete(task) && DateOnly.FromDateTime(DateTime.UtcNow).AddDays(daysNo) > task.DueDate; + public bool IsNotComplete(ObjectiveTask task) => task.Completed is null; public record Objective(string Title, ObjectiveTask[] Tasks); public class ObjectiveTask { public required string Title { get; set; } public required DateOnly DueDate { get; set; } - public bool Completed { get; set; } = false; + public DateTime? Completed { get; set; } } } From 5730d1913e766d1590dde433a71eafaf4c070749 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 9 Aug 2024 13:57:15 +0100 Subject: [PATCH 03/35] Objective/Task data modelling and migrations --- .../Interfaces/IApplicationDbContext.cs | 3 + .../Objectives/Commands/AddObjective.cs | 54 + .../Features/Objectives/Commands/AddTask.cs | 74 + .../Participants/Commands/AddConsent.cs | 1 - src/Domain/Entities/Participants/Objective.cs | 41 + .../Entities/Participants/ObjectiveTask.cs | 42 + src/Domain/Events/ObjectiveEvents.cs | 24 + .../Constants/Database/DatabaseConstants.cs | 2 + .../Persistence/ApplicationDbContext.cs | 2 + .../ObjectiveEntityTypeConfiguration.cs | 55 + .../20240809101015_Objectives.Designer.cs | 2395 +++++++++++++++++ .../Migrations/20240809101015_Objectives.cs | 97 + .../ApplicationDbContextModelSnapshot.cs | 96 + .../Pages/Objectives/AddObjectiveDialog.razor | 61 + .../Objectives/Tasks/AddTaskDialog.razor | 68 + .../Objectives/Tasks/CloseTaskDialog.razor | 5 + .../Objectives/Tasks/EditTaskDialog.razor | 5 + .../Objectives/Tasks/ReviewTaskDialog.razor | 5 + 18 files changed, 3029 insertions(+), 1 deletion(-) create mode 100644 src/Application/Features/Objectives/Commands/AddObjective.cs create mode 100644 src/Application/Features/Objectives/Commands/AddTask.cs create mode 100644 src/Domain/Entities/Participants/Objective.cs create mode 100644 src/Domain/Entities/Participants/ObjectiveTask.cs create mode 100644 src/Domain/Events/ObjectiveEvents.cs create mode 100644 src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.Designer.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.cs create mode 100644 src/Server.UI/Pages/Objectives/AddObjectiveDialog.razor create mode 100644 src/Server.UI/Pages/Objectives/Tasks/AddTaskDialog.razor create mode 100644 src/Server.UI/Pages/Objectives/Tasks/CloseTaskDialog.razor create mode 100644 src/Server.UI/Pages/Objectives/Tasks/EditTaskDialog.razor create mode 100644 src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor diff --git a/src/Application/Common/Interfaces/IApplicationDbContext.cs b/src/Application/Common/Interfaces/IApplicationDbContext.cs index 2886ede6..bcc3e631 100644 --- a/src/Application/Common/Interfaces/IApplicationDbContext.cs +++ b/src/Application/Common/Interfaces/IApplicationDbContext.cs @@ -27,6 +27,9 @@ public interface IApplicationDbContext public DbSet Risks { get; } + public DbSet Objectives { get; } + public DbSet ObjectiveTasks { get; } + public DbSet KeyValues { get; } public DbSet ParticipantAssessments { get; } diff --git a/src/Application/Features/Objectives/Commands/AddObjective.cs b/src/Application/Features/Objectives/Commands/AddObjective.cs new file mode 100644 index 00000000..c7178b1d --- /dev/null +++ b/src/Application/Features/Objectives/Commands/AddObjective.cs @@ -0,0 +1,54 @@ +using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.Common.Validators; +using Cfo.Cats.Application.SecurityConstants; +using Cfo.Cats.Domain.Entities.Participants; + +namespace Cfo.Cats.Application.Features.Objectives.Commands; + +public static class AddObjective +{ + [RequestAuthorize(Policy = SecurityPolicies.Enrol)] + public class Command : IRequest + { + [Description("Participant Id")] + public required string ParticipantId { get; set; } + + public string? Title { get; set; } + + public class Mapping : Profile + { + public Mapping() + { + CreateMap(MemberList.None) + .ConstructUsing(dto => Objective.Create(dto.Title!, dto.ParticipantId)); + } + } + } + + public class Handler(IUnitOfWork unitOfWork, IMapper mapper) : IRequestHandler + { + public async Task Handle(Command request, CancellationToken cancellationToken) + { + var objective = mapper.Map(request); + await unitOfWork.DbContext.Objectives.AddAsync(objective, cancellationToken); + return Result.Success(); + } + } + + public class Validator : AbstractValidator + { + public Validator() + { + RuleFor(x => x.ParticipantId) + .Length(9) + .NotNull(); + + RuleFor(x => x.Title) + .NotEmpty() + .WithMessage("You must provide a title") + .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) + .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); + } + + } +} diff --git a/src/Application/Features/Objectives/Commands/AddTask.cs b/src/Application/Features/Objectives/Commands/AddTask.cs new file mode 100644 index 00000000..1082e1c7 --- /dev/null +++ b/src/Application/Features/Objectives/Commands/AddTask.cs @@ -0,0 +1,74 @@ + +using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.Common.Validators; +using Cfo.Cats.Application.SecurityConstants; +using Cfo.Cats.Domain.Entities.Participants; + +namespace Cfo.Cats.Application.Features.Objectives.Commands; + +public static class AddTask +{ + [RequestAuthorize(Policy = SecurityPolicies.Enrol)] + public class Command : IRequest + { + [Description("Objective Id")] + public required Guid ObjectiveId { get; set; } + + public string? Title { get; set; } + + public DateTime? Due { get; set; } + + public class Mapping : Profile + { + public Mapping() + { + CreateMap(MemberList.None) + .ConstructUsing(dto => ObjectiveTask.Create(dto.Title!, dto.Due!.Value)); + } + } + } + + public class Handler(IUnitOfWork unitOfWork, IMapper mapper) : IRequestHandler + { + public async Task Handle(Command request, CancellationToken cancellationToken) + { + var objective = await unitOfWork.DbContext.Objectives.FindAsync(request.ObjectiveId); + + if (objective is null) + { + throw new NotFoundException("Cannot find objective", request.ObjectiveId); + } + + var task = mapper.Map(request); + + objective.AddTask(task); + + return Result.Success(); + } + } + + public class Validator : AbstractValidator + { + public Validator() + { + var today = DateTime.UtcNow; + + RuleFor(x => x.ObjectiveId) + .NotNull(); + + RuleFor(x => x.Title) + .NotEmpty() + .WithMessage("You must provide a title") + .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) + .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); + + RuleFor(x => x.Due) + .NotNull() + .WithMessage("You must provide a Due date") + .GreaterThanOrEqualTo(new DateTime(today.Year, today.Month, 1)) + .WithMessage(ValidationConstants.DateMustBeInFuture); + } + + } + +} diff --git a/src/Application/Features/Participants/Commands/AddConsent.cs b/src/Application/Features/Participants/Commands/AddConsent.cs index 7f0fb135..3a78330f 100644 --- a/src/Application/Features/Participants/Commands/AddConsent.cs +++ b/src/Application/Features/Participants/Commands/AddConsent.cs @@ -1,7 +1,6 @@ using Cfo.Cats.Application.Common.Security; using Cfo.Cats.Application.SecurityConstants; using Cfo.Cats.Domain.Entities.Documents; -using Cfo.Cats.Domain.Entities.Participants; namespace Cfo.Cats.Application.Features.Participants.Commands; diff --git a/src/Domain/Entities/Participants/Objective.cs b/src/Domain/Entities/Participants/Objective.cs new file mode 100644 index 00000000..18435766 --- /dev/null +++ b/src/Domain/Entities/Participants/Objective.cs @@ -0,0 +1,41 @@ +using Cfo.Cats.Domain.Common.Entities; +using Cfo.Cats.Domain.Events; + +namespace Cfo.Cats.Domain.Entities.Participants; + +public class Objective : BaseAuditableEntity +{ +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + private Objective() + { + } +#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + + private List _tasks = new(); + + public string ParticipantId { get; private set; } + + public string Title { get; private set; } + + public IReadOnlyCollection Tasks => _tasks.AsReadOnly(); + + public Objective AddTask(ObjectiveTask task) + { + _tasks.Add(task); + AddDomainEvent(new ObjectiveTaskAddedToObjectiveDomainEvent(this, task)); + return this; + } + + public static Objective Create(string title, string participantId) + { + Objective objective = new() + { + Title = title, + ParticipantId = participantId + }; + + objective.AddDomainEvent(new ObjectiveCreatedDomainEvent(objective)); + return objective; + } + +} diff --git a/src/Domain/Entities/Participants/ObjectiveTask.cs b/src/Domain/Entities/Participants/ObjectiveTask.cs new file mode 100644 index 00000000..d1f318ec --- /dev/null +++ b/src/Domain/Entities/Participants/ObjectiveTask.cs @@ -0,0 +1,42 @@ +using Cfo.Cats.Domain.Common.Entities; +using Cfo.Cats.Domain.Events; +using Cfo.Cats.Domain.Identity; + +namespace Cfo.Cats.Domain.Entities.Participants; + +public class ObjectiveTask : BaseAuditableEntity +{ +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + private ObjectiveTask() + { + } +#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + + public void Complete(DateTime? nextDue) + { + Completed = DateTime.UtcNow; + Due = nextDue; + } + + public static ObjectiveTask Create(string title, DateTime due) + { + ObjectiveTask task = new() + { + Title = title, + Due = due + }; + + task.AddDomainEvent(new ObjectiveTaskCreatedDomainEvent(task)); + return task; + } + + public DateTime? Due { get; private set; } + public DateTime? Completed { get; set; } + public string? CompletedBy { get; set; } + public string Title { get; private set; } + + public virtual ApplicationUser? CompletedByUser { get; set; } + + // public bool IsOverdue() => Due > DateTime.UtcNow; + // public bool IsDueSoon() => Due > DateTime.UtcNow.AddDays(-14); +} diff --git a/src/Domain/Events/ObjectiveEvents.cs b/src/Domain/Events/ObjectiveEvents.cs new file mode 100644 index 00000000..06a09007 --- /dev/null +++ b/src/Domain/Events/ObjectiveEvents.cs @@ -0,0 +1,24 @@ +using Cfo.Cats.Domain.Entities.Participants; + +namespace Cfo.Cats.Domain.Events; + +public sealed class ObjectiveCreatedDomainEvent(Objective objective) : DomainEvent +{ + public Objective Item { get; set; } = objective; +} + +public sealed class ObjectiveTaskAddedToObjectiveDomainEvent(Objective objective, ObjectiveTask task) : DomainEvent +{ + public Objective Item { get; set; } = objective; + public ObjectiveTask Item2 { get; set; } = task; +} + +public sealed class ObjectiveTaskCreatedDomainEvent(ObjectiveTask objectiveTask) : DomainEvent +{ + public ObjectiveTask Item { get; set; } = objectiveTask; +} + +public sealed class ObjectiveTaskCompletedDomainEvent(ObjectiveTask objectiveTask) : DomainEvent +{ + public ObjectiveTask Item { get; set; } = objectiveTask; +} \ No newline at end of file diff --git a/src/Infrastructure/Constants/Database/DatabaseConstants.cs b/src/Infrastructure/Constants/Database/DatabaseConstants.cs index 0e54a4f8..ad661fe3 100644 --- a/src/Infrastructure/Constants/Database/DatabaseConstants.cs +++ b/src/Infrastructure/Constants/Database/DatabaseConstants.cs @@ -29,6 +29,8 @@ public static class Tables public const string EnrolmentHistory = nameof(EnrolmentHistory); public const string RightToWork = nameof(RightToWork); public const string Risk = nameof(Risk); + public const string Objective = nameof(Objective); + public const string ObjectiveTask = nameof(ObjectiveTask); public const string AssessmentPathwayScore = nameof(AssessmentPathwayScore); diff --git a/src/Infrastructure/Persistence/ApplicationDbContext.cs b/src/Infrastructure/Persistence/ApplicationDbContext.cs index 9dae66a3..24034427 100644 --- a/src/Infrastructure/Persistence/ApplicationDbContext.cs +++ b/src/Infrastructure/Persistence/ApplicationDbContext.cs @@ -38,6 +38,8 @@ public ApplicationDbContext(DbContextOptions options) public DbSet Participants => Set(); public DbSet Risks => Set(); + public DbSet Objectives => Set(); + public DbSet ObjectiveTasks => Set(); public DbSet ParticipantAssessments => Set(); diff --git a/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs b/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs new file mode 100644 index 00000000..34ac7a70 --- /dev/null +++ b/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs @@ -0,0 +1,55 @@ +using Cfo.Cats.Domain.Entities.Participants; +using Cfo.Cats.Infrastructure.Constants.Database; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace Cfo.Cats.Infrastructure.Persistence.Configurations.Participants; + +public class ObjectiveEntityTypeConfiguration + : IEntityTypeConfiguration + +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable( + DatabaseConstants.Tables.Objective, + DatabaseConstants.Schemas.Participant + ); + + builder.HasKey(o => o.Id); + + builder.Property(o => o.ParticipantId) + .HasMaxLength(DatabaseConstants.FieldLengths.ParticipantId) + .IsRequired(); + + builder.HasIndex(o => o.ParticipantId); + + builder.Property(o => o.CreatedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + builder.Property(o => o.LastModifiedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + builder.OwnsMany(o => o.Tasks, task => + { + task.WithOwner(); + task.ToTable( + DatabaseConstants.Tables.ObjectiveTask, + DatabaseConstants.Schemas.Participant); + + task.HasKey(t => t.Id); + + task.Property(t => t.CreatedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + task.Property(t => t.LastModifiedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + task.Property(t => t.CompletedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + task.HasOne(t => t.CompletedByUser) + .WithMany() + .HasForeignKey(t => t.CompletedBy); + }); + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.Designer.cs new file mode 100644 index 00000000..b61fe00d --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.Designer.cs @@ -0,0 +1,2395 @@ +// +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("20240809101015_Objectives")] + partial class Objectives + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .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("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.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.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + 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.Objective", 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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Objective", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => + { + b.Property("Id") + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .IsRequired() + .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("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.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("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.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.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.Objective", b => + { + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("Completed") + .HasColumnType("datetime2"); + + b1.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Due") + .HasColumnType("datetime2"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("ObjectiveId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CompletedBy"); + + b1.HasIndex("ObjectiveId"); + + b1.ToTable("ObjectiveTask", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b1.WithOwner() + .HasForeignKey("ObjectiveId"); + + b1.Navigation("CompletedByUser"); + }); + + b.Navigation("Tasks"); + }); + + 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.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.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + }); + + 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/20240809101015_Objectives.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.cs new file mode 100644 index 00000000..0e719cab --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.cs @@ -0,0 +1,97 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Objectives : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Objective", + schema: "Participant", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ParticipantId = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false), + Title = table.Column(type: "nvarchar(max)", nullable: false), + Created = table.Column(type: "datetime2", nullable: true), + CreatedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), + LastModified = table.Column(type: "datetime2", nullable: true), + LastModifiedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Objective", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ObjectiveTask", + schema: "Participant", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Due = table.Column(type: "datetime2", nullable: true), + Completed = table.Column(type: "datetime2", nullable: true), + CompletedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), + Title = table.Column(type: "nvarchar(max)", nullable: false), + ObjectiveId = table.Column(type: "uniqueidentifier", nullable: false), + Created = table.Column(type: "datetime2", nullable: true), + CreatedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), + LastModified = table.Column(type: "datetime2", nullable: true), + LastModifiedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjectiveTask", x => x.Id); + table.ForeignKey( + name: "FK_ObjectiveTask_Objective_ObjectiveId", + column: x => x.ObjectiveId, + principalSchema: "Participant", + principalTable: "Objective", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ObjectiveTask_User_CompletedBy", + column: x => x.CompletedBy, + principalSchema: "Identity", + principalTable: "User", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_Objective_ParticipantId", + schema: "Participant", + table: "Objective", + column: "ParticipantId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjectiveTask_CompletedBy", + schema: "Participant", + table: "ObjectiveTask", + column: "CompletedBy"); + + migrationBuilder.CreateIndex( + name: "IX_ObjectiveTask_ObjectiveId", + schema: "Participant", + table: "ObjectiveTask", + column: "ObjectiveId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ObjectiveTask", + schema: "Participant"); + + migrationBuilder.DropTable( + name: "Objective", + schema: "Participant"); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs index 1ddda9ea..22873ff2 100644 --- a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs @@ -595,6 +595,42 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Qa2Queue", "Enrolment"); }); + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Objective", 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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Objective", "Participant"); + }); + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => { b.Property("Id") @@ -1825,6 +1861,66 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Tenant"); }); + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Objective", b => + { + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("Completed") + .HasColumnType("datetime2"); + + b1.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Due") + .HasColumnType("datetime2"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("ObjectiveId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CompletedBy"); + + b1.HasIndex("ObjectiveId"); + + b1.ToTable("ObjectiveTask", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b1.WithOwner() + .HasForeignKey("ObjectiveId"); + + b1.Navigation("CompletedByUser"); + }); + + b.Navigation("Tasks"); + }); + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => { b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") diff --git a/src/Server.UI/Pages/Objectives/AddObjectiveDialog.razor b/src/Server.UI/Pages/Objectives/AddObjectiveDialog.razor new file mode 100644 index 00000000..b865feb4 --- /dev/null +++ b/src/Server.UI/Pages/Objectives/AddObjectiveDialog.razor @@ -0,0 +1,61 @@ +@using Cfo.Cats.Application.Features.Objectives.Commands + +@inherits CatsComponentBase + + + + + + + + + @ConstantString.Cancel + @ConstantString.Save + + + +@code { + MudForm? form; + bool saving; + + [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter, EditorRequired] + public required AddObjective.Command Model { get; set; } + + private void Cancel() + { + MudDialog.Cancel(); + } + + private async Task Submit() + { + try + { + saving = true; + + if (form is null) + { + saving = false; + return; + } + + await form.Validate(); + + if (form.IsValid) + { + MudDialog.Close(DialogResult.Ok(true)); + } + + } + finally + { + saving = false; + } + } + + +} diff --git a/src/Server.UI/Pages/Objectives/Tasks/AddTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/AddTaskDialog.razor new file mode 100644 index 00000000..441108bf --- /dev/null +++ b/src/Server.UI/Pages/Objectives/Tasks/AddTaskDialog.razor @@ -0,0 +1,68 @@ +@using Cfo.Cats.Application.Features.Objectives.Commands + +@inherits CatsComponentBase + + + + + + + + + + + @ConstantString.Cancel + @ConstantString.Save + + + +@code { + MudForm? form; + bool saving; + + [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter, EditorRequired] + public required AddTask.Command Model { get; set; } + + private void Cancel() + { + MudDialog.Cancel(); + } + + private async Task Submit() + { + try + { + saving = true; + + if (form is null) + { + saving = false; + return; + } + + await form.Validate(); + + if (form.IsValid) + { + MudDialog.Close(DialogResult.Ok(true)); + } + + } + finally + { + saving = false; + } + } + + +} diff --git a/src/Server.UI/Pages/Objectives/Tasks/CloseTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/CloseTaskDialog.razor new file mode 100644 index 00000000..e2cf9c1c --- /dev/null +++ b/src/Server.UI/Pages/Objectives/Tasks/CloseTaskDialog.razor @@ -0,0 +1,5 @@ +

CloseTaskDialog

+ +@code { + +} diff --git a/src/Server.UI/Pages/Objectives/Tasks/EditTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/EditTaskDialog.razor new file mode 100644 index 00000000..02a1a708 --- /dev/null +++ b/src/Server.UI/Pages/Objectives/Tasks/EditTaskDialog.razor @@ -0,0 +1,5 @@ +

EditTaskDialog

+ +@code { + +} diff --git a/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor new file mode 100644 index 00000000..201346a7 --- /dev/null +++ b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor @@ -0,0 +1,5 @@ +

ReviewTaskDialog

+ +@code { + +} From 45ea502f5c1cfa65cf093f39353ee8e306b24b9a Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 9 Aug 2024 13:58:52 +0100 Subject: [PATCH 04/35] WIP: Add tasks on a month basis, instead of specific dates --- .../Components/CasePathwayPlan.razor | 118 ++++++++++++++---- 1 file changed, 92 insertions(+), 26 deletions(-) diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index 5fe48a38..b48f7083 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -1,7 +1,13 @@ -@using Humanizer +@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Server.UI.Pages.Objectives.Tasks +@using Humanizer + +@inherits CatsComponentBase @@ -15,19 +21,23 @@ @foreach (var objective in Model) { - +
@objective.Title (@objective.Tasks.Count(x => x.Completed is not null)/@objective.Tasks.Length) - @if(objective.Tasks.Any(x => IsOverdue(x))) + @if(objective.Tasks.Any(IsOverdue)) { } - else if (objective.Tasks.Any(x => IsDueSoon(x))) + else if (objective.Tasks.Any(IsDueSoon)) { } + else if(objective.Tasks.All(IsComplete)) + { + + }
@@ -40,39 +50,63 @@ @task.Title - @if (IsNotComplete(task)) + @if (IsComplete(task)) { - @if (IsOverdue(task)) + + + + } + else + { + if (IsOverdue(task)) { - - + + + Due @task.DueDate.ToDateTime(TimeOnly.MinValue).ToString("MMM, yyyy") + + + + } else if (IsDueSoon(task)) { - - + + + Due @task.DueDate.ToDateTime(TimeOnly.MinValue).ToString("MMM, yyyy") + + + + } }
@if(task.Completed is null) { - Due @($"{task.DueDate.Humanize()} ({task.DueDate.ToShortDateString()})") + Due @task.DueDate.ToDateTime(TimeOnly.MinValue).ToString("MMM, yyyy") } else { Completed @task.Completed.Humanize() } -
+
+ + +
} +
+ + + +
@@ -82,6 +116,11 @@ } @code { + static DateOnly ToMonth(DateTime dateTime) => DateOnly.FromDateTime(new DateTime(dateTime.Year, dateTime.Month, 1)); + static DateOnly ToMonth(DateOnly date) => DateOnly.FromDateTime(new DateTime(date.Year, date.Month, 1)); + + readonly DateOnly currentMonth = ToMonth(DateTime.UtcNow); + [Parameter, EditorRequired] public required string ParticipantId { get; set; } @@ -91,21 +130,19 @@ protected override void OnInitialized() { - var today = DateOnly.FromDateTime(DateTime.UtcNow); - Model = new List() { - new Objective("Employability Aid", new ObjectiveTask[] + new Objective("Make Doris more employable because she has been unemployed for 6 months", new ObjectiveTask[] { new ObjectiveTask() { - Title = "Construct a CV", - DueDate = today.AddDays(-1) + Title = "Sort their appearance", + DueDate = currentMonth.AddMonths(-1) }, new ObjectiveTask() { - Title = "Interview practice/preparation", - DueDate = today.AddDays(6) + Title = "Create a CV", + DueDate = currentMonth } }), new Objective("Finance and Debt", new ObjectiveTask[] @@ -113,7 +150,7 @@ new ObjectiveTask() { Title = "Managing finances and debt", - DueDate = today.AddDays(14), + DueDate = currentMonth, Completed = DateTime.UtcNow.AddMinutes(-30) } }), @@ -122,7 +159,7 @@ new ObjectiveTask() { Title = "Obtain a new passport", - DueDate = today.AddDays(60) + DueDate = currentMonth.AddMonths(2) } }), new Objective("Disclosure Advice", new ObjectiveTask[] @@ -130,7 +167,7 @@ new ObjectiveTask() { Title = "Offence disclosure discussion", - DueDate = today.AddDays(3) + DueDate = currentMonth.AddMonths(1) } }) }; @@ -162,14 +199,43 @@ SelectedTasks = tasks; } + public async Task AddTask(Objective to) + { + var command = new AddTask.Command() + { + ObjectiveId = Guid.NewGuid() + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Small, FullWidth = true }; + var dialog = DialogService.Show("Add task to objective", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + await GetNewMediator().Send(command); + } + } + public async Task Edit(ObjectiveTask task) { await DialogService.ShowMessageBox("Edit Task", "Editing..."); } - public bool IsOverdue(ObjectiveTask task) => IsNotComplete(task) && DateOnly.FromDateTime(DateTime.UtcNow) > task.DueDate; - public bool IsDueSoon(ObjectiveTask task, int daysNo = 7) => IsNotComplete(task) && DateOnly.FromDateTime(DateTime.UtcNow).AddDays(daysNo) > task.DueDate; - public bool IsNotComplete(ObjectiveTask task) => task.Completed is null; + public async Task Close(ObjectiveTask task) + { + await DialogService.ShowMessageBox("Close Task", "Closing..."); + } + + public bool IsOverdue(ObjectiveTask task) => IsNotComplete(task) && ToMonth(DateTime.UtcNow) > ToMonth(task.DueDate.ToDateTime(TimeOnly.MinValue)); + public bool IsDueSoon(ObjectiveTask task) => IsNotComplete(task) && ToMonth(task.DueDate).Equals(currentMonth) || DateOnly.FromDateTime(DateTime.UtcNow.AddDays(14)) >= ToMonth(task.DueDate); + public bool IsNotComplete(ObjectiveTask task) => IsComplete(task) is false; + public bool IsComplete(ObjectiveTask task) => task.Completed is not null; public record Objective(string Title, ObjectiveTask[] Tasks); public class ObjectiveTask From a2854f84e43e0f79d5bb0e14145d8eaf1d1ce32c Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Mon, 12 Aug 2024 14:58:44 +0100 Subject: [PATCH 05/35] Objective/Task dto's and command handlers --- .../Features/Objectives/Commands/AddTask.cs | 9 +- .../Objectives/Commands/ReviewTask.cs | 65 +++++ .../Features/Objectives/DTOs/ObjectiveDto.cs | 19 ++ .../Objectives/DTOs/ObjectiveTaskDto.cs | 33 +++ .../Queries/GetObjectivesByParticipantId.cs | 45 +++ .../Common/Enums/ReoccurrenceFrequency.cs | 14 + .../Entities/Participants/ObjectiveTask.cs | 7 +- .../Constants/ConstantString.cs | 1 + .../Objectives/Tasks/ReviewTaskDialog.razor | 72 ++++- .../Components/CasePathwayPlan.razor | 267 ++++++++---------- 10 files changed, 376 insertions(+), 156 deletions(-) create mode 100644 src/Application/Features/Objectives/Commands/ReviewTask.cs create mode 100644 src/Application/Features/Objectives/DTOs/ObjectiveDto.cs create mode 100644 src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs create mode 100644 src/Application/Features/Objectives/Queries/GetObjectivesByParticipantId.cs create mode 100644 src/Domain/Common/Enums/ReoccurrenceFrequency.cs diff --git a/src/Application/Features/Objectives/Commands/AddTask.cs b/src/Application/Features/Objectives/Commands/AddTask.cs index 1082e1c7..17d77ea7 100644 --- a/src/Application/Features/Objectives/Commands/AddTask.cs +++ b/src/Application/Features/Objectives/Commands/AddTask.cs @@ -1,5 +1,4 @@ - -using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.Common.Security; using Cfo.Cats.Application.Common.Validators; using Cfo.Cats.Application.SecurityConstants; using Cfo.Cats.Domain.Entities.Participants; @@ -36,7 +35,7 @@ public async Task Handle(Command request, CancellationToken cancellation if (objective is null) { - throw new NotFoundException("Cannot find objective", request.ObjectiveId); + throw new NotFoundException("Cannot find objective", request.ObjectiveId); } var task = mapper.Map(request); @@ -66,7 +65,9 @@ public Validator() .NotNull() .WithMessage("You must provide a Due date") .GreaterThanOrEqualTo(new DateTime(today.Year, today.Month, 1)) - .WithMessage(ValidationConstants.DateMustBeInFuture); + .WithMessage(ValidationConstants.DateMustBeInFuture) + .Must(x => x!.Value.Day.Equals(1)) + .WithMessage("Due date must fall on the first day of the month"); } } diff --git a/src/Application/Features/Objectives/Commands/ReviewTask.cs b/src/Application/Features/Objectives/Commands/ReviewTask.cs new file mode 100644 index 00000000..217a5e95 --- /dev/null +++ b/src/Application/Features/Objectives/Commands/ReviewTask.cs @@ -0,0 +1,65 @@ +using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.Common.Validators; +using Cfo.Cats.Application.SecurityConstants; +using Cfo.Cats.Domain.Entities.Participants; + +namespace Cfo.Cats.Application.Features.Objectives.Commands; + +public class ReviewTask +{ + [RequestAuthorize(Policy = SecurityPolicies.Enrol)] + public class Command : IRequest + { + [Description("Objective Id")] + public required Guid TaskId { get; set; } + + [Description("Reoccurs")] + public bool Reoccurs { get; set; } + + [Description("Due")] + public DateTime? Due { get; set; } + } + + public class Handler(IUnitOfWork unitOfWork) : IRequestHandler + { + public async Task Handle(Command request, CancellationToken cancellationToken) + { + var task = await unitOfWork.DbContext.ObjectiveTasks.FindAsync(request.TaskId); + + if (task is null) + { + throw new NotFoundException("Cannot find task", request.TaskId); + } + + task.Complete(); + + if(request.Reoccurs) + { + + } + + return Result.Success(); + } + } + + public class Validator : AbstractValidator + { + public Validator() + { + var today = DateTime.UtcNow; + + RuleFor(x => x.TaskId) + .NotNull(); + + RuleFor(x => x.Due) + .NotNull() + .WithMessage("You must provide a Due date") + .GreaterThanOrEqualTo(new DateTime(today.Year, today.Month, 1)) + .WithMessage(ValidationConstants.DateMustBeInFuture) + .Must(x => x!.Value.Day.Equals(1)) + .WithMessage("Due date must fall on the first day of the month"); + } + + } + +} diff --git a/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs b/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs new file mode 100644 index 00000000..2c748848 --- /dev/null +++ b/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs @@ -0,0 +1,19 @@ +using Cfo.Cats.Domain.Entities.Participants; + +namespace Cfo.Cats.Application.Features.Objectives.DTOs; + +public class ObjectiveDto +{ + public required Guid Id { get; set; } + public required string ParticipantId { get; set; } + public required string Title { get; set; } + public IEnumerable Tasks { get; set; } = []; + + public class Mapping : Profile + { + public Mapping() + { + CreateMap(); + } + } +} diff --git a/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs b/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs new file mode 100644 index 00000000..05dbc61a --- /dev/null +++ b/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs @@ -0,0 +1,33 @@ +using Cfo.Cats.Domain.Entities.Participants; + +namespace Cfo.Cats.Application.Features.Objectives.DTOs; + +public class ObjectiveTaskDto +{ + public required Guid Id { get; set; } + public required Guid ObjectiveId { get; set; } + public required string Title { get; set; } + public required DateTime Due { get; set; } + public required DateTime Created { get; set; } + public DateTime? Completed { get; set; } + public string? CompletedByName { get; set; } + + public bool IsCompleted => Completed.HasValue; + public bool IsOverdue => IsCompleted is false && ToFirstDayOfMonth(DateTime.UtcNow) > ToFirstDayOfMonth(Due); + public bool IsDueSoon => IsCompleted is false && ToFirstDayOfMonth(DateTime.UtcNow).Equals(ToFirstDayOfMonth(Due)); + + public class Mapping : Profile + { + public Mapping() + { + CreateMap() + .ForMember(target => target.CompletedByName, options => options.MapFrom(source => source.CompletedByUser!.DisplayName)); + } + } + + /// + /// Takes a + /// + private static DateTime ToFirstDayOfMonth(DateTime dateTime) => new(dateTime.Year, dateTime.Month, 1); + +} diff --git a/src/Application/Features/Objectives/Queries/GetObjectivesByParticipantId.cs b/src/Application/Features/Objectives/Queries/GetObjectivesByParticipantId.cs new file mode 100644 index 00000000..6b2f79c7 --- /dev/null +++ b/src/Application/Features/Objectives/Queries/GetObjectivesByParticipantId.cs @@ -0,0 +1,45 @@ +using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.Common.Validators; +using Cfo.Cats.Application.Features.Objectives.DTOs; +using Cfo.Cats.Application.SecurityConstants; + +namespace Cfo.Cats.Application.Features.Objectives.Queries; + +public static class GetObjectivesByParticipantId +{ + [RequestAuthorize(Policy = SecurityPolicies.Enrol)] + public class Query : IRequest> + { + public required string ParticipantId { get; set; } + } + + public class Handler(IUnitOfWork unitOfWork, IMapper mapper) : IRequestHandler> + { + public async Task> Handle(Query request, CancellationToken cancellationToken) + { + var objectives = await unitOfWork.DbContext.Objectives + .Where(o => o.ParticipantId == request.ParticipantId) + .Include(o => o.Tasks) + .ProjectTo(mapper.ConfigurationProvider) + .ToListAsync(cancellationToken) ?? []; + + return objectives; + } + } + + public class Validator : AbstractValidator + { + public Validator() + { + RuleFor(x => x.ParticipantId) + .NotNull(); + + RuleFor(x => x.ParticipantId) + .MinimumLength(9) + .MaximumLength(9) + .Matches(ValidationConstants.AlphaNumeric) + .WithMessage(string.Format(ValidationConstants.AlphaNumericMessage, "Participant Id")); + } + } + +} diff --git a/src/Domain/Common/Enums/ReoccurrenceFrequency.cs b/src/Domain/Common/Enums/ReoccurrenceFrequency.cs new file mode 100644 index 00000000..fd7adb94 --- /dev/null +++ b/src/Domain/Common/Enums/ReoccurrenceFrequency.cs @@ -0,0 +1,14 @@ +using Ardalis.SmartEnum; + +namespace Cfo.Cats.Domain.Common.Enums; + +public class ReoccurrenceFrequency : SmartEnum +{ + public static readonly ReoccurrenceFrequency Daily = new("Daily", 0); + public static readonly ReoccurrenceFrequency Weekly = new("Weekly", 1); + public static readonly ReoccurrenceFrequency Monthly = new("Monthly", 2); + public static readonly ReoccurrenceFrequency Yearly = new("Yearly", 3); + + private ReoccurrenceFrequency(string name, int value) + : base(name, value) { } +} diff --git a/src/Domain/Entities/Participants/ObjectiveTask.cs b/src/Domain/Entities/Participants/ObjectiveTask.cs index d1f318ec..cb8d4d34 100644 --- a/src/Domain/Entities/Participants/ObjectiveTask.cs +++ b/src/Domain/Entities/Participants/ObjectiveTask.cs @@ -12,10 +12,10 @@ private ObjectiveTask() } #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public void Complete(DateTime? nextDue) + public void Complete() { Completed = DateTime.UtcNow; - Due = nextDue; + AddDomainEvent(new ObjectiveTaskCompletedDomainEvent(this)); } public static ObjectiveTask Create(string title, DateTime due) @@ -36,7 +36,4 @@ public static ObjectiveTask Create(string title, DateTime due) public string Title { get; private set; } public virtual ApplicationUser? CompletedByUser { get; set; } - - // public bool IsOverdue() => Due > DateTime.UtcNow; - // public bool IsDueSoon() => Due > DateTime.UtcNow.AddDays(-14); } diff --git a/src/Infrastructure/Constants/ConstantString.cs b/src/Infrastructure/Constants/ConstantString.cs index ca09991a..f6eb7fca 100644 --- a/src/Infrastructure/Constants/ConstantString.cs +++ b/src/Infrastructure/Constants/ConstantString.cs @@ -44,6 +44,7 @@ public static string Localize(string key) public static string Ok => Localize("OK"); public static string Confirm => Localize("Confirm"); public static string Continue => Localize("Continue"); + public static string Complete => Localize("Complete"); public static string Yes => Localize("Yes"); public static string No => Localize("No"); public static string Next => Localize("Next"); diff --git a/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor index 201346a7..d3dd891c 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor @@ -1,5 +1,75 @@ -

ReviewTaskDialog

+@using Cfo.Cats.Application.Features.Objectives.Commands + +@inherits CatsComponentBase + + + + + + + + + + + + + + + @ConstantString.Cancel + @ConstantString.Complete + + @code { + MudForm? form; + bool saving; + bool reoccurs; + + [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter, EditorRequired] + public required AddTask.Command Model { get; set; } + + private void Cancel() + { + MudDialog.Cancel(); + } + + private async Task Submit() + { + try + { + saving = true; + + if (form is null) + { + saving = false; + return; + } + + await form.Validate(); + + if (form.IsValid) + { + MudDialog.Close(DialogResult.Ok(true)); + } + + } + finally + { + saving = false; + } + } + } diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index b48f7083..c8b6b8e6 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -1,13 +1,14 @@ @using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Application.Features.Objectives.DTOs +@using Cfo.Cats.Application.Features.Objectives.Queries @using Cfo.Cats.Server.UI.Pages.Objectives.Tasks @using Humanizer @inherits CatsComponentBase @@ -15,26 +16,39 @@ @if(Model is not null) { - + - Select your tasks: +
+ + + + @if(Model.Any()) + { + Add another objective + } + else + { + Add an objective + } +
+
@foreach (var objective in Model) { - +
@objective.Title - (@objective.Tasks.Count(x => x.Completed is not null)/@objective.Tasks.Length) - @if(objective.Tasks.Any(IsOverdue)) + (@objective.Tasks.Count(x => x.IsCompleted)/@objective.Tasks.Count()) + @if(objective.Tasks.Any(task => task.IsOverdue)) { } - else if (objective.Tasks.Any(IsDueSoon)) + else if (objective.Tasks.Any(task => task.IsDueSoon)) { } - else if(objective.Tasks.All(IsComplete)) + else if(objective.Tasks.All(task => task.IsCompleted)) { } @@ -43,67 +57,86 @@ @foreach (var task in objective.Tasks) { - -
-
-
- - @task.Title - - @if (IsComplete(task)) - { - - - - } - else - { - if (IsOverdue(task)) + + + @if(task.IsCompleted) + { + + } + else + { + + } + + +
+
+
+ + @task.Title + + @if (task.IsCompleted) { - - - Due @task.DueDate.ToDateTime(TimeOnly.MinValue).ToString("MMM, yyyy") - - - - + + } - else if (IsDueSoon(task)) + else { - - - Due @task.DueDate.ToDateTime(TimeOnly.MinValue).ToString("MMM, yyyy") - - - - - + if (task.IsOverdue) + { + + + Due @task.Due.ToString("MMM, yyyy") + + + + + + } + else if (task.IsDueSoon) + { + + + Due @task.Due.ToString("MMM, yyyy") + + + + + + } } +
+ @if(task.IsCompleted) + { + Completed @task.Completed.Humanize() + } + else + { + Due @task.Due.ToString("MMM, yyyy") }
- @if(task.Completed is null) - { - Due @task.DueDate.ToDateTime(TimeOnly.MinValue).ToString("MMM, yyyy") - } - else - { - Completed @task.Completed.Humanize() - } -
-
- - - - - - +
+ + Extend date + Rename + Cancel + + + + Added @task.Created.Humanize() + + + + + +
-
+ }
- +
@@ -116,94 +149,42 @@ } @code { - static DateOnly ToMonth(DateTime dateTime) => DateOnly.FromDateTime(new DateTime(dateTime.Year, dateTime.Month, 1)); - static DateOnly ToMonth(DateOnly date) => DateOnly.FromDateTime(new DateTime(date.Year, date.Month, 1)); - - readonly DateOnly currentMonth = ToMonth(DateTime.UtcNow); - [Parameter, EditorRequired] public required string ParticipantId { get; set; } - public IEnumerable? Model { get; set; } + public IEnumerable? Model { get; set; } - IReadOnlyCollection SelectedTasks = []; + IReadOnlyCollection SelectedTasks = []; - protected override void OnInitialized() + protected override async Task OnInitializedAsync() { - Model = new List() - { - new Objective("Make Doris more employable because she has been unemployed for 6 months", new ObjectiveTask[] - { - new ObjectiveTask() - { - Title = "Sort their appearance", - DueDate = currentMonth.AddMonths(-1) - }, - new ObjectiveTask() - { - Title = "Create a CV", - DueDate = currentMonth - } - }), - new Objective("Finance and Debt", new ObjectiveTask[] - { - new ObjectiveTask() - { - Title = "Managing finances and debt", - DueDate = currentMonth, - Completed = DateTime.UtcNow.AddMinutes(-30) - } - }), - new Objective("Identification", new ObjectiveTask[] - { - new ObjectiveTask() - { - Title = "Obtain a new passport", - DueDate = currentMonth.AddMonths(2) - } - }), - new Objective("Disclosure Advice", new ObjectiveTask[] - { - new ObjectiveTask() - { - Title = "Offence disclosure discussion", - DueDate = currentMonth.AddMonths(1) - } - }) - }; - - SelectedTasks = Model.SelectMany(objective => objective.Tasks.Where(task => task.Completed is not null)) - .ToList() - .AsReadOnly(); - - base.OnInitialized(); + await OnRefresh(); + await base.OnInitializedAsync(); } - public void Select(IReadOnlyCollection? tasks) + private async Task OnRefresh() { - if (tasks is null) - { - return; - } - - foreach(var task in SelectedTasks.Except(tasks)) + Model = await GetNewMediator().Send(new GetObjectivesByParticipantId.Query() { - task.Completed = null; - } + ParticipantId = ParticipantId + }); - foreach (var task in tasks.Where(IsNotComplete)) - { - task.Completed = DateTime.UtcNow; - } + SelectedTasks = Model.SelectMany(objective => objective.Tasks + .Where(task => task.IsCompleted)) + .ToList() + .AsReadOnly(); + } - SelectedTasks = tasks; + public async Task ToggleTask(ObjectiveTaskDto task) + { + await Task.CompletedTask; } - public async Task AddTask(Objective to) + public async Task AddTask(ObjectiveDto to) { var command = new AddTask.Command() { - ObjectiveId = Guid.NewGuid() + ObjectiveId = to.Id }; var parameters = new DialogParameters() @@ -218,30 +199,24 @@ if (state!.Canceled is false) { - await GetNewMediator().Send(command); + var result = await GetNewMediator().Send(command); + + if(result.Succeeded) + { + await OnRefresh(); + } + } } - public async Task Edit(ObjectiveTask task) + public async Task RenameTask(ObjectiveTaskDto task) { await DialogService.ShowMessageBox("Edit Task", "Editing..."); } - public async Task Close(ObjectiveTask task) + public async Task CancelTask(ObjectiveTaskDto task) { await DialogService.ShowMessageBox("Close Task", "Closing..."); } - public bool IsOverdue(ObjectiveTask task) => IsNotComplete(task) && ToMonth(DateTime.UtcNow) > ToMonth(task.DueDate.ToDateTime(TimeOnly.MinValue)); - public bool IsDueSoon(ObjectiveTask task) => IsNotComplete(task) && ToMonth(task.DueDate).Equals(currentMonth) || DateOnly.FromDateTime(DateTime.UtcNow.AddDays(14)) >= ToMonth(task.DueDate); - public bool IsNotComplete(ObjectiveTask task) => IsComplete(task) is false; - public bool IsComplete(ObjectiveTask task) => task.Completed is not null; - - public record Objective(string Title, ObjectiveTask[] Tasks); - public class ObjectiveTask - { - public required string Title { get; set; } - public required DateOnly DueDate { get; set; } - public DateTime? Completed { get; set; } - } } From 215fbaf2a2e86a279a71eccb7f6380a6fe796f1f Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Tue, 13 Aug 2024 19:59:33 +0100 Subject: [PATCH 06/35] Objective/task create and update commands --- .../Features/Objectives/Commands/AddTask.cs | 17 +- .../Features/Objectives/Commands/EditTask.cs | 92 + .../Objectives/Commands/ReviewTask.cs | 57 +- .../Features/Objectives/DTOs/ObjectiveDto.cs | 1 + .../Objectives/DTOs/ObjectiveTaskDto.cs | 9 +- .../Common/Enums/TaskCompletionStatus.cs | 12 + .../Entities/Participants/ObjectiveTask.cs | 35 +- .../ObjectiveEntityTypeConfiguration.cs | 15 +- .../20240813134025_Objectives_v2.Designer.cs | 2429 +++++++++++++++++ .../20240813134025_Objectives_v2.cs | 75 + .../20240813163959_Objectives_v3.Designer.cs | 2429 +++++++++++++++++ .../20240813163959_Objectives_v3.cs | 54 + .../20240813182343_Objectives_v4.Designer.cs | 2426 ++++++++++++++++ .../20240813182343_Objectives_v4.cs | 55 + .../ApplicationDbContextModelSnapshot.cs | 8 +- .../Objectives/Tasks/CloseTaskDialog.razor | 5 - .../Objectives/Tasks/EditTaskDialog.razor | 5 - .../Tasks/ExtendDateTaskDialog.razor | 64 + .../Objectives/Tasks/RenameTaskDialog.razor | 60 + .../Objectives/Tasks/ReviewTaskDialog.razor | 25 +- .../Components/CasePathwayPlan.razor | 228 +- 21 files changed, 7995 insertions(+), 106 deletions(-) create mode 100644 src/Application/Features/Objectives/Commands/EditTask.cs create mode 100644 src/Domain/Common/Enums/TaskCompletionStatus.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.Designer.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.Designer.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.Designer.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.cs delete mode 100644 src/Server.UI/Pages/Objectives/Tasks/CloseTaskDialog.razor delete mode 100644 src/Server.UI/Pages/Objectives/Tasks/EditTaskDialog.razor create mode 100644 src/Server.UI/Pages/Objectives/Tasks/ExtendDateTaskDialog.razor create mode 100644 src/Server.UI/Pages/Objectives/Tasks/RenameTaskDialog.razor diff --git a/src/Application/Features/Objectives/Commands/AddTask.cs b/src/Application/Features/Objectives/Commands/AddTask.cs index 17d77ea7..125242b9 100644 --- a/src/Application/Features/Objectives/Commands/AddTask.cs +++ b/src/Application/Features/Objectives/Commands/AddTask.cs @@ -62,12 +62,17 @@ public Validator() .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); RuleFor(x => x.Due) - .NotNull() - .WithMessage("You must provide a Due date") - .GreaterThanOrEqualTo(new DateTime(today.Year, today.Month, 1)) - .WithMessage(ValidationConstants.DateMustBeInFuture) - .Must(x => x!.Value.Day.Equals(1)) - .WithMessage("Due date must fall on the first day of the month"); + .Must(x => x.HasValue) + .WithMessage("You must provide a Due date"); + + When(x => x.Due.HasValue, () => + { + RuleFor(x => x.Due) + .GreaterThanOrEqualTo(new DateTime(today.Year, today.Month, 1)) + .WithMessage(ValidationConstants.DateMustBeInFuture) + .Must(x => x!.Value.Day.Equals(1)) + .WithMessage("Due date must fall on the first day of the month"); + }); } } diff --git a/src/Application/Features/Objectives/Commands/EditTask.cs b/src/Application/Features/Objectives/Commands/EditTask.cs new file mode 100644 index 00000000..28748cbc --- /dev/null +++ b/src/Application/Features/Objectives/Commands/EditTask.cs @@ -0,0 +1,92 @@ +using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.Common.Validators; +using Cfo.Cats.Application.SecurityConstants; +using Cfo.Cats.Domain.Entities.Participants; + +namespace Cfo.Cats.Application.Features.Objectives.Commands; + +public static class EditTask +{ + [RequestAuthorize(Policy = SecurityPolicies.Enrol)] + public class Command : IRequest + { + [Description("Task Id")] + public required Guid TaskId { get; set; } + + [Description("Objective Id")] + public required Guid ObjectiveId { get; set; } + + [Description("Title")] + public string? Title { get; set; } + + [Description("Due")] + public DateTime? Due { get; set; } + } + + public class Handler(IUnitOfWork unitOfWork) : IRequestHandler + { + public async Task Handle(Command request, CancellationToken cancellationToken) + { + var objective = await unitOfWork.DbContext.Objectives.FindAsync(request.ObjectiveId); + + if (objective is null) + { + throw new NotFoundException("Cannot find objective", request.ObjectiveId); + } + + var task = objective.Tasks.FirstOrDefault(x => x.Id == request.TaskId); + + if (task is null) + { + throw new NotFoundException("Cannot find task", request.TaskId); + } + + if(request.Title is not null) + { + task.Rename(request.Title); + } + + if(request.Due.HasValue) + { + task.Extend(request.Due.Value); + } + + return Result.Success(); + } + } + + public class Validator : AbstractValidator + { + public Validator() + { + var today = DateTime.UtcNow; + + RuleFor(x => x.ObjectiveId) + .NotNull(); + + RuleFor(x => x.TaskId) + .NotNull(); + + RuleFor(x => x.Title) + .NotEmpty() + .WithMessage("You must provide a title") + .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) + .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); + + RuleFor(x => x.Due) + .Must(x => x.HasValue) + .WithMessage("You must provide a Due date"); + + When(x => x.Due.HasValue, () => + { + RuleFor(x => x.Due) + .GreaterThanOrEqualTo(new DateTime(today.Year, today.Month, 1)) + .WithMessage(ValidationConstants.DateMustBeInFuture) + .Must(x => x!.Value.Day.Equals(1)) + .WithMessage("Due date must fall on the first day of the month"); + }); + } + + } + +} diff --git a/src/Application/Features/Objectives/Commands/ReviewTask.cs b/src/Application/Features/Objectives/Commands/ReviewTask.cs index 217a5e95..ca0396fb 100644 --- a/src/Application/Features/Objectives/Commands/ReviewTask.cs +++ b/src/Application/Features/Objectives/Commands/ReviewTask.cs @@ -1,7 +1,6 @@ using Cfo.Cats.Application.Common.Security; using Cfo.Cats.Application.Common.Validators; using Cfo.Cats.Application.SecurityConstants; -using Cfo.Cats.Domain.Entities.Participants; namespace Cfo.Cats.Application.Features.Objectives.Commands; @@ -10,32 +9,46 @@ public class ReviewTask [RequestAuthorize(Policy = SecurityPolicies.Enrol)] public class Command : IRequest { - [Description("Objective Id")] + [Description("Task Id")] public required Guid TaskId { get; set; } - [Description("Reoccurs")] - public bool Reoccurs { get; set; } + [Description("Objective Id")] + public required Guid ObjectiveId { get; set; } + + [Description("Cancel")] + public required bool Close { get; set; } - [Description("Due")] - public DateTime? Due { get; set; } + [Description("Justification")] + public string Justification { get; set; } = string.Empty; } public class Handler(IUnitOfWork unitOfWork) : IRequestHandler { public async Task Handle(Command request, CancellationToken cancellationToken) { - var task = await unitOfWork.DbContext.ObjectiveTasks.FindAsync(request.TaskId); + var objective = await unitOfWork.DbContext.Objectives + .FindAsync(request.ObjectiveId); - if (task is null) + if (objective is null) { - throw new NotFoundException("Cannot find task", request.TaskId); + throw new NotFoundException("Cannot find objective", request.ObjectiveId); } - task.Complete(); + var task = objective.Tasks + .FirstOrDefault(task => task.Id == request.TaskId); - if(request.Reoccurs) + if (task is null) { + throw new NotFoundException("Cannot find task", request.TaskId); + } + if (request.Close) + { + task.Close(request.Justification); + } + else + { + task.Complete(request.Justification); } return Result.Success(); @@ -46,18 +59,22 @@ public class Validator : AbstractValidator { public Validator() { - var today = DateTime.UtcNow; - RuleFor(x => x.TaskId) .NotNull(); - RuleFor(x => x.Due) - .NotNull() - .WithMessage("You must provide a Due date") - .GreaterThanOrEqualTo(new DateTime(today.Year, today.Month, 1)) - .WithMessage(ValidationConstants.DateMustBeInFuture) - .Must(x => x!.Value.Day.Equals(1)) - .WithMessage("Due date must fall on the first day of the month"); + RuleFor(x => x.ObjectiveId) + .NotNull(); + + When(x => x.Close, () => + { + RuleFor(x => x.Justification) + .NotEmpty() + .WithMessage("Justification is required when closing a task"); + }); + + RuleFor(x => x.Justification) + .Matches(ValidationConstants.Notes) + .WithMessage(string.Format(ValidationConstants.NotesMessage, "Justification")); } } diff --git a/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs b/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs index 2c748848..a65a32a2 100644 --- a/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs +++ b/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs @@ -7,6 +7,7 @@ public class ObjectiveDto public required Guid Id { get; set; } public required string ParticipantId { get; set; } public required string Title { get; set; } + public required DateTime Created { get; set; } public IEnumerable Tasks { get; set; } = []; public class Mapping : Profile diff --git a/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs b/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs index 05dbc61a..49282e0f 100644 --- a/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs +++ b/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs @@ -12,9 +12,14 @@ public class ObjectiveTaskDto public DateTime? Completed { get; set; } public string? CompletedByName { get; set; } + public TaskCompletionStatus? CompletedStatus { get; set; } public bool IsCompleted => Completed.HasValue; - public bool IsOverdue => IsCompleted is false && ToFirstDayOfMonth(DateTime.UtcNow) > ToFirstDayOfMonth(Due); - public bool IsDueSoon => IsCompleted is false && ToFirstDayOfMonth(DateTime.UtcNow).Equals(ToFirstDayOfMonth(Due)); + public bool IsOverdue => IsCompleted is false + && (ToFirstDayOfMonth(DateTime.UtcNow) > ToFirstDayOfMonth(Due)); + + public bool IsDueSoon => IsCompleted is false + && (ToFirstDayOfMonth(DateTime.UtcNow).Equals(ToFirstDayOfMonth(Due)) + || IsOverdue is false && (DateTime.UtcNow.AddDays(14) > ToFirstDayOfMonth(Due))); public class Mapping : Profile { diff --git a/src/Domain/Common/Enums/TaskCompletionStatus.cs b/src/Domain/Common/Enums/TaskCompletionStatus.cs new file mode 100644 index 00000000..d1cc5d4b --- /dev/null +++ b/src/Domain/Common/Enums/TaskCompletionStatus.cs @@ -0,0 +1,12 @@ +using Ardalis.SmartEnum; + +namespace Cfo.Cats.Domain.Common.Enums; + +public class TaskCompletionStatus : SmartEnum +{ + public static readonly TaskCompletionStatus Done = new("Done", 0); + public static readonly TaskCompletionStatus Closed = new("Closed", 1); + + public TaskCompletionStatus(string name, int value) + : base(name, value) { } +} diff --git a/src/Domain/Entities/Participants/ObjectiveTask.cs b/src/Domain/Entities/Participants/ObjectiveTask.cs index cb8d4d34..4a9eb2f8 100644 --- a/src/Domain/Entities/Participants/ObjectiveTask.cs +++ b/src/Domain/Entities/Participants/ObjectiveTask.cs @@ -1,4 +1,5 @@ using Cfo.Cats.Domain.Common.Entities; +using Cfo.Cats.Domain.Common.Enums; using Cfo.Cats.Domain.Events; using Cfo.Cats.Domain.Identity; @@ -12,12 +13,24 @@ private ObjectiveTask() } #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public void Complete() + public void Complete(string? justification = null) { Completed = DateTime.UtcNow; + Justification = justification; + CompletedStatus = TaskCompletionStatus.Done; + //CompletedBy = ""; AddDomainEvent(new ObjectiveTaskCompletedDomainEvent(this)); } + public void Close(string justification) + { + Justification = justification; + Completed = DateTime.UtcNow; + CompletedStatus = TaskCompletionStatus.Closed; + //CompletedBy = ""; + //AddDomainEvent(new ObjectiveTaskCancelledDomainEvent(this)); + } + public static ObjectiveTask Create(string title, DateTime due) { ObjectiveTask task = new() @@ -30,9 +43,23 @@ public static ObjectiveTask Create(string title, DateTime due) return task; } - public DateTime? Due { get; private set; } - public DateTime? Completed { get; set; } - public string? CompletedBy { get; set; } + public void Extend(DateTime due) + { + Due = due; + } + + public void Rename(string title) + { + Title = title; + } + + public DateTime Due { get; private set; } + public DateTime? Completed { get; private set; } + public string? CompletedBy { get; private set; } + public TaskCompletionStatus? CompletedStatus { get; private set; } + + public string? Justification { get; private set; } + public Guid ObjectiveId { get; private set; } public string Title { get; private set; } public virtual ApplicationUser? CompletedByUser { get; set; } diff --git a/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs b/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs index 34ac7a70..6b2a3f49 100644 --- a/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs +++ b/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs @@ -1,4 +1,5 @@ -using Cfo.Cats.Domain.Entities.Participants; +using Cfo.Cats.Domain.Common.Enums; +using Cfo.Cats.Domain.Entities.Participants; using Cfo.Cats.Infrastructure.Constants.Database; using Microsoft.EntityFrameworkCore.Metadata.Builders; @@ -29,9 +30,13 @@ public void Configure(EntityTypeBuilder builder) builder.Property(o => o.LastModifiedBy) .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + builder.Navigation(e => e.Tasks).AutoInclude(); + builder.OwnsMany(o => o.Tasks, task => { - task.WithOwner(); + task.WithOwner() + .HasForeignKey(x => x.ObjectiveId); + task.ToTable( DatabaseConstants.Tables.ObjectiveTask, DatabaseConstants.Schemas.Participant); @@ -50,6 +55,12 @@ public void Configure(EntityTypeBuilder builder) task.HasOne(t => t.CompletedByUser) .WithMany() .HasForeignKey(t => t.CompletedBy); + + task.Property(t => t.CompletedStatus) + .HasConversion( + x => x!.Value, + x => TaskCompletionStatus.FromValue(x) + ); }); } } diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.Designer.cs new file mode 100644 index 00000000..f879b52f --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.Designer.cs @@ -0,0 +1,2429 @@ +// +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("20240813134025_Objectives_v2")] + partial class Objectives_v2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .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("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.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.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + 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.Objective", 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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Objective", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => + { + b.Property("Id") + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .IsRequired() + .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("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.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("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.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.Objective", b => + { + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("Cancelled") + .HasColumnType("datetime2"); + + b1.Property("CancelledBy") + .HasColumnType("nvarchar(max)"); + + b1.Property("CancelledReason") + .HasColumnType("nvarchar(max)"); + + b1.Property("Completed") + .HasColumnType("datetime2"); + + b1.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Due") + .HasColumnType("datetime2"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("ObjectiveId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CompletedBy"); + + b1.HasIndex("ObjectiveId"); + + b1.ToTable("ObjectiveTask", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b1.WithOwner() + .HasForeignKey("ObjectiveId"); + + b1.Navigation("CompletedByUser"); + }); + + b.Navigation("Tasks"); + }); + + 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.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.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + }); + + 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/20240813134025_Objectives_v2.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.cs new file mode 100644 index 00000000..4e2878e6 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.cs @@ -0,0 +1,75 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Objectives_v2 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Due", + schema: "Participant", + table: "ObjectiveTask", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldNullable: true); + + migrationBuilder.AddColumn( + name: "Cancelled", + schema: "Participant", + table: "ObjectiveTask", + type: "datetime2", + nullable: true); + + migrationBuilder.AddColumn( + name: "CancelledBy", + schema: "Participant", + table: "ObjectiveTask", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "CancelledReason", + schema: "Participant", + table: "ObjectiveTask", + type: "nvarchar(max)", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Cancelled", + schema: "Participant", + table: "ObjectiveTask"); + + migrationBuilder.DropColumn( + name: "CancelledBy", + schema: "Participant", + table: "ObjectiveTask"); + + migrationBuilder.DropColumn( + name: "CancelledReason", + schema: "Participant", + table: "ObjectiveTask"); + + migrationBuilder.AlterColumn( + name: "Due", + schema: "Participant", + table: "ObjectiveTask", + type: "datetime2", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.Designer.cs new file mode 100644 index 00000000..ca1172f6 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.Designer.cs @@ -0,0 +1,2429 @@ +// +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("20240813163959_Objectives_v3")] + partial class Objectives_v3 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .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("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.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.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + 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.Objective", 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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Objective", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => + { + b.Property("Id") + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .IsRequired() + .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("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.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("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.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.Objective", b => + { + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("Closed") + .HasColumnType("datetime2"); + + b1.Property("ClosedBy") + .HasColumnType("nvarchar(max)"); + + b1.Property("Completed") + .HasColumnType("datetime2"); + + b1.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Due") + .HasColumnType("datetime2"); + + b1.Property("Justification") + .HasColumnType("nvarchar(max)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("ObjectiveId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CompletedBy"); + + b1.HasIndex("ObjectiveId"); + + b1.ToTable("ObjectiveTask", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b1.WithOwner() + .HasForeignKey("ObjectiveId"); + + b1.Navigation("CompletedByUser"); + }); + + b.Navigation("Tasks"); + }); + + 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.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.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + }); + + 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/20240813163959_Objectives_v3.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.cs new file mode 100644 index 00000000..8b3c1931 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.cs @@ -0,0 +1,54 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Objectives_v3 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "CancelledReason", + schema: "Participant", + table: "ObjectiveTask", + newName: "Justification"); + + migrationBuilder.RenameColumn( + name: "CancelledBy", + schema: "Participant", + table: "ObjectiveTask", + newName: "ClosedBy"); + + migrationBuilder.RenameColumn( + name: "Cancelled", + schema: "Participant", + table: "ObjectiveTask", + newName: "Closed"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "Justification", + schema: "Participant", + table: "ObjectiveTask", + newName: "CancelledReason"); + + migrationBuilder.RenameColumn( + name: "ClosedBy", + schema: "Participant", + table: "ObjectiveTask", + newName: "CancelledBy"); + + migrationBuilder.RenameColumn( + name: "Closed", + schema: "Participant", + table: "ObjectiveTask", + newName: "Cancelled"); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.Designer.cs new file mode 100644 index 00000000..e9ae6da0 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.Designer.cs @@ -0,0 +1,2426 @@ +// +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("20240813182343_Objectives_v4")] + partial class Objectives_v4 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .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("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.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.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + 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.Objective", 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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Objective", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => + { + b.Property("Id") + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .IsRequired() + .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("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.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("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.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.Objective", b => + { + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", 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("Due") + .HasColumnType("datetime2"); + + b1.Property("Justification") + .HasColumnType("nvarchar(max)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("ObjectiveId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CompletedBy"); + + b1.HasIndex("ObjectiveId"); + + b1.ToTable("ObjectiveTask", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b1.WithOwner() + .HasForeignKey("ObjectiveId"); + + b1.Navigation("CompletedByUser"); + }); + + b.Navigation("Tasks"); + }); + + 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.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.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + }); + + 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/20240813182343_Objectives_v4.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.cs new file mode 100644 index 00000000..ee51bebf --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.cs @@ -0,0 +1,55 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Objectives_v4 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Closed", + schema: "Participant", + table: "ObjectiveTask"); + + migrationBuilder.DropColumn( + name: "ClosedBy", + schema: "Participant", + table: "ObjectiveTask"); + + migrationBuilder.AddColumn( + name: "CompletedStatus", + schema: "Participant", + table: "ObjectiveTask", + type: "int", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "CompletedStatus", + schema: "Participant", + table: "ObjectiveTask"); + + migrationBuilder.AddColumn( + name: "Closed", + schema: "Participant", + table: "ObjectiveTask", + type: "datetime2", + nullable: true); + + migrationBuilder.AddColumn( + name: "ClosedBy", + schema: "Participant", + table: "ObjectiveTask", + type: "nvarchar(max)", + nullable: true); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs index 82a68122..d4e8f91a 100644 --- a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs @@ -1901,6 +1901,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(36) .HasColumnType("nvarchar(36)"); + b1.Property("CompletedStatus") + .HasColumnType("int"); + b1.Property("Created") .HasColumnType("datetime2"); @@ -1908,9 +1911,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(36) .HasColumnType("nvarchar(36)"); - b1.Property("Due") + b1.Property("Due") .HasColumnType("datetime2"); + b1.Property("Justification") + .HasColumnType("nvarchar(max)"); + b1.Property("LastModified") .HasColumnType("datetime2"); diff --git a/src/Server.UI/Pages/Objectives/Tasks/CloseTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/CloseTaskDialog.razor deleted file mode 100644 index e2cf9c1c..00000000 --- a/src/Server.UI/Pages/Objectives/Tasks/CloseTaskDialog.razor +++ /dev/null @@ -1,5 +0,0 @@ -

CloseTaskDialog

- -@code { - -} diff --git a/src/Server.UI/Pages/Objectives/Tasks/EditTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/EditTaskDialog.razor deleted file mode 100644 index 02a1a708..00000000 --- a/src/Server.UI/Pages/Objectives/Tasks/EditTaskDialog.razor +++ /dev/null @@ -1,5 +0,0 @@ -

EditTaskDialog

- -@code { - -} diff --git a/src/Server.UI/Pages/Objectives/Tasks/ExtendDateTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/ExtendDateTaskDialog.razor new file mode 100644 index 00000000..35b2e75e --- /dev/null +++ b/src/Server.UI/Pages/Objectives/Tasks/ExtendDateTaskDialog.razor @@ -0,0 +1,64 @@ +@using Cfo.Cats.Application.Features.Objectives.Commands + +@inherits CatsComponentBase + + + + + + + + + @ConstantString.Cancel + @ConstantString.Save + + + +@code { + MudForm? form; + bool saving; + + [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter, EditorRequired] + public required EditTask.Command Model { get; set; } + + private void Cancel() + { + MudDialog.Cancel(); + } + + private async Task Submit() + { + try + { + saving = true; + + if (form is null) + { + saving = false; + return; + } + + await form.Validate(); + + if (form.IsValid) + { + MudDialog.Close(DialogResult.Ok(true)); + } + + } + finally + { + saving = false; + } + } + + +} diff --git a/src/Server.UI/Pages/Objectives/Tasks/RenameTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/RenameTaskDialog.razor new file mode 100644 index 00000000..2731cf52 --- /dev/null +++ b/src/Server.UI/Pages/Objectives/Tasks/RenameTaskDialog.razor @@ -0,0 +1,60 @@ +@using Cfo.Cats.Application.Features.Objectives.Commands + +@inherits CatsComponentBase + + + + + + + + + @ConstantString.Cancel + @ConstantString.Save + + + +@code { + MudForm? form; + bool saving; + + [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter, EditorRequired] + public required EditTask.Command Model { get; set; } + + private void Cancel() + { + MudDialog.Cancel(); + } + + private async Task Submit() + { + try + { + saving = true; + + if (form is null) + { + saving = false; + return; + } + + await form.Validate(); + + if (form.IsValid) + { + MudDialog.Close(DialogResult.Ok(true)); + } + + } + finally + { + saving = false; + } + } + + +} diff --git a/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor index d3dd891c..47f6c971 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor @@ -5,23 +5,11 @@ - - - - - - - + @@ -33,12 +21,11 @@ @code { MudForm? form; bool saving; - bool reoccurs; [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; [Parameter, EditorRequired] - public required AddTask.Command Model { get; set; } + public required ReviewTask.Command Model { get; set; } private void Cancel() { diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index c8b6b8e6..8db46b58 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -1,6 +1,8 @@ @using Cfo.Cats.Application.Features.Objectives.Commands @using Cfo.Cats.Application.Features.Objectives.DTOs @using Cfo.Cats.Application.Features.Objectives.Queries +@using Cfo.Cats.Domain.Common.Enums +@using Cfo.Cats.Server.UI.Pages.Objectives @using Cfo.Cats.Server.UI.Pages.Objectives.Tasks @using Humanizer @@ -17,55 +19,70 @@ { - -
- - - - @if(Model.Any()) - { - Add another objective - } - else - { - Add an objective - } + +
+ Review Pathway
- + +
+
+ + + + @if (Model.Any()) + { + Add another objective + } + else + { + Add an objective + } +
+ + +
+
- @foreach (var objective in Model) + @foreach (var objective in Model.OrderBy(x => x.Created)) { + var tasks = objective.Tasks + .Where(task => task.IsCompleted is false || hideCompleted is false) + .OrderBy(task => task.Created); +
@objective.Title - (@objective.Tasks.Count(x => x.IsCompleted)/@objective.Tasks.Count()) - @if(objective.Tasks.Any(task => task.IsOverdue)) + (@tasks.Count(x => x.IsCompleted)/@tasks.Count()) + @if(tasks.Any()) { - - } - else if (objective.Tasks.Any(task => task.IsDueSoon)) - { - - } - else if(objective.Tasks.All(task => task.IsCompleted)) - { - + if (tasks.Any(task => task.IsOverdue)) + { + + } + else if (tasks.Any(task => task.IsDueSoon)) + { + + } + else if (tasks.All(task => task.IsCompleted)) + { + + } }
- @foreach (var task in objective.Tasks) + @foreach (var task in tasks.OrderBy(x => x.Created)) { @if(task.IsCompleted) { - + } else { - + } @@ -78,7 +95,14 @@ @if (task.IsCompleted) { - + @if(task.CompletedStatus == TaskCompletionStatus.Done) + { + + } + else if(task.CompletedStatus == TaskCompletionStatus.Closed) + { + + } } else @@ -117,11 +141,20 @@ }
- - Extend date - Rename - Cancel - + + + Extend date + Rename + Close + + + + + New Activity + New ETE + New PSF + + Added @task.Created.Humanize() @@ -149,6 +182,8 @@ } @code { + private bool hideCompleted = false; + [Parameter, EditorRequired] public required string ParticipantId { get; set; } @@ -175,9 +210,64 @@ .AsReadOnly(); } - public async Task ToggleTask(ObjectiveTaskDto task) + public async Task AddObjective() { - await Task.CompletedTask; + var command = new AddObjective.Command() + { + ParticipantId = ParticipantId + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true }; + var dialog = DialogService.Show("Add objective", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnRefresh(); + } + + } + } + + public async Task ReviewTask(ObjectiveTaskDto task, bool close = false) + { + var command = new ReviewTask.Command() + { + ObjectiveId = task.ObjectiveId, + TaskId = task.Id, + Close = close + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true }; + var dialog = DialogService.Show(string.Format("{0} task", close ? "Close" : "Complete"), parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnRefresh(); + } + + } } public async Task AddTask(ObjectiveDto to) @@ -192,7 +282,7 @@ { x => x.Model, command } }; - var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Small, FullWidth = true }; + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true }; var dialog = DialogService.Show("Add task to objective", parameters, options); var state = await dialog.Result; @@ -209,14 +299,68 @@ } } - public async Task RenameTask(ObjectiveTaskDto task) + public async Task ExtendDate(ObjectiveTaskDto task) { - await DialogService.ShowMessageBox("Edit Task", "Editing..."); + var command = new EditTask.Command() + { + TaskId = task.Id, + ObjectiveId = task.ObjectiveId, + Title = task.Title, + Due = task.Due + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true }; + var dialog = DialogService.Show("Extend date", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnRefresh(); + } + + } } - public async Task CancelTask(ObjectiveTaskDto task) + public async Task RenameTask(ObjectiveTaskDto task) { - await DialogService.ShowMessageBox("Close Task", "Closing..."); + var command = new EditTask.Command() + { + TaskId = task.Id, + ObjectiveId = task.ObjectiveId, + Title = task.Title, + Due = task.Due + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true }; + var dialog = DialogService.Show("Rename task", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnRefresh(); + } + + } } } From 28759bbff022f17a6fb0bea227196568cfdf52e0 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Wed, 14 Aug 2024 10:07:29 +0100 Subject: [PATCH 07/35] Fix styling and add close button for dialogs --- .../Participants/Components/CasePathwayPlan.razor | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index 8db46b58..06fd294e 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -1,4 +1,4 @@ -@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Application.Features.Objectives.Commands @using Cfo.Cats.Application.Features.Objectives.DTOs @using Cfo.Cats.Application.Features.Objectives.Queries @using Cfo.Cats.Domain.Common.Enums @@ -24,7 +24,7 @@ Review Pathway
-
+
@@ -222,7 +222,7 @@ { x => x.Model, command } }; - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true }; + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; var dialog = DialogService.Show("Add objective", parameters, options); var state = await dialog.Result; @@ -253,7 +253,7 @@ { x => x.Model, command } }; - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true }; + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; var dialog = DialogService.Show(string.Format("{0} task", close ? "Close" : "Complete"), parameters, options); var state = await dialog.Result; @@ -282,7 +282,7 @@ { x => x.Model, command } }; - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true }; + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; var dialog = DialogService.Show("Add task to objective", parameters, options); var state = await dialog.Result; @@ -314,7 +314,7 @@ { x => x.Model, command } }; - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true }; + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; var dialog = DialogService.Show("Extend date", parameters, options); var state = await dialog.Result; @@ -346,7 +346,7 @@ { x => x.Model, command } }; - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true }; + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; var dialog = DialogService.Show("Rename task", parameters, options); var state = await dialog.Result; From 2b4d4612395b87f18d2858eda796cef950307ce5 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Wed, 14 Aug 2024 15:11:19 +0100 Subject: [PATCH 08/35] Remove 'close' option for task and allow selection of completion reason --- .../Objectives/Commands/ReviewTask.cs | 17 ++++---------- .../Common/Enums/TaskCompletionStatus.cs | 13 +++++++---- .../Entities/Participants/ObjectiveTask.cs | 14 ++--------- .../Objectives/Tasks/ReviewTaskDialog.razor | 23 ++++++++++++++----- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/Application/Features/Objectives/Commands/ReviewTask.cs b/src/Application/Features/Objectives/Commands/ReviewTask.cs index ca0396fb..c7d478e1 100644 --- a/src/Application/Features/Objectives/Commands/ReviewTask.cs +++ b/src/Application/Features/Objectives/Commands/ReviewTask.cs @@ -15,8 +15,8 @@ public class Command : IRequest [Description("Objective Id")] public required Guid ObjectiveId { get; set; } - [Description("Cancel")] - public required bool Close { get; set; } + [Description("Reason")] + public TaskCompletionStatus Reason { get; set; } = TaskCompletionStatus.Done; [Description("Justification")] public string Justification { get; set; } = string.Empty; @@ -42,14 +42,7 @@ public async Task Handle(Command request, CancellationToken cancellation throw new NotFoundException("Cannot find task", request.TaskId); } - if (request.Close) - { - task.Close(request.Justification); - } - else - { - task.Complete(request.Justification); - } + task.Review(request.Reason, request.Justification); return Result.Success(); } @@ -65,11 +58,11 @@ public Validator() RuleFor(x => x.ObjectiveId) .NotNull(); - When(x => x.Close, () => + When(x => x.Reason.RequiresJustification, () => { RuleFor(x => x.Justification) .NotEmpty() - .WithMessage("Justification is required when closing a task"); + .WithMessage("Justification is required for the selected reason"); }); RuleFor(x => x.Justification) diff --git a/src/Domain/Common/Enums/TaskCompletionStatus.cs b/src/Domain/Common/Enums/TaskCompletionStatus.cs index d1cc5d4b..1136afcc 100644 --- a/src/Domain/Common/Enums/TaskCompletionStatus.cs +++ b/src/Domain/Common/Enums/TaskCompletionStatus.cs @@ -4,9 +4,14 @@ namespace Cfo.Cats.Domain.Common.Enums; public class TaskCompletionStatus : SmartEnum { - public static readonly TaskCompletionStatus Done = new("Done", 0); - public static readonly TaskCompletionStatus Closed = new("Closed", 1); + public static readonly TaskCompletionStatus Done = new("Done", 0, false); + public static readonly TaskCompletionStatus NotRequired = new("No longer required", 1, true); - public TaskCompletionStatus(string name, int value) - : base(name, value) { } + public TaskCompletionStatus(string name, int value, bool requiresJustification = false) + : base(name, value) + { + RequiresJustification = requiresJustification; + } + + public bool RequiresJustification { get; private set; } } diff --git a/src/Domain/Entities/Participants/ObjectiveTask.cs b/src/Domain/Entities/Participants/ObjectiveTask.cs index 4a9eb2f8..b8411b21 100644 --- a/src/Domain/Entities/Participants/ObjectiveTask.cs +++ b/src/Domain/Entities/Participants/ObjectiveTask.cs @@ -13,24 +13,14 @@ private ObjectiveTask() } #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public void Complete(string? justification = null) + public void Review(TaskCompletionStatus status, string? justification = null) { Completed = DateTime.UtcNow; Justification = justification; - CompletedStatus = TaskCompletionStatus.Done; - //CompletedBy = ""; + CompletedStatus = status; AddDomainEvent(new ObjectiveTaskCompletedDomainEvent(this)); } - public void Close(string justification) - { - Justification = justification; - Completed = DateTime.UtcNow; - CompletedStatus = TaskCompletionStatus.Closed; - //CompletedBy = ""; - //AddDomainEvent(new ObjectiveTaskCancelledDomainEvent(this)); - } - public static ObjectiveTask Create(string title, DateTime due) { ObjectiveTask task = new() diff --git a/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor index 47f6c971..3f43b344 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor @@ -1,20 +1,31 @@ @using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Domain.Common.Enums @inherits CatsComponentBase - + + @foreach(var status in TaskCompletionStatus.List) + { + @status.Name + } + + @ConstantString.Cancel - @ConstantString.Complete + + @($"{ConstantString.Complete} Task") + From 7e9ee479082629da24004ca4f892b53ca5085801 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Wed, 14 Aug 2024 15:12:14 +0100 Subject: [PATCH 09/35] Objective sorting --- .../Components/CasePathwayPlan.razor | 71 +++++++++---------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index 06fd294e..48dbe9f6 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -20,30 +20,28 @@ -
- Review Pathway -
- -
-
- - - - @if (Model.Any()) - { - Add another objective - } - else - { - Add an objective - } -
+
+ + Date added + Title + No. of outstanding tasks + + + Ascending + Descending +
- +
+ + + + New objective +
+ - @foreach (var objective in Model.OrderBy(x => x.Created)) + @foreach (var objective in Model.OrderByDirection(sortDirection, selectors[selector])) { var tasks = objective.Tasks .Where(task => task.IsCompleted is false || hideCompleted is false) @@ -97,11 +95,11 @@ @if(task.CompletedStatus == TaskCompletionStatus.Done) { - + } - else if(task.CompletedStatus == TaskCompletionStatus.Closed) + else if(task.CompletedStatus == TaskCompletionStatus.NotRequired) { - + } } @@ -145,7 +143,6 @@ Extend date Rename - Close @@ -184,13 +181,21 @@ @code { private bool hideCompleted = false; + private string selector = "Created"; + private Dictionary> selectors = new() + { + { "Created", (objective) => objective.Created }, + { "Title", (objective) => objective.Title }, + { "Outstanding", (objective) => objective.Tasks.Where(task => task.IsCompleted is false).Count() }, + }; + + private SortDirection sortDirection = SortDirection.Ascending; + [Parameter, EditorRequired] public required string ParticipantId { get; set; } public IEnumerable? Model { get; set; } - IReadOnlyCollection SelectedTasks = []; - protected override async Task OnInitializedAsync() { await OnRefresh(); @@ -202,12 +207,7 @@ Model = await GetNewMediator().Send(new GetObjectivesByParticipantId.Query() { ParticipantId = ParticipantId - }); - - SelectedTasks = Model.SelectMany(objective => objective.Tasks - .Where(task => task.IsCompleted)) - .ToList() - .AsReadOnly(); + }); } public async Task AddObjective() @@ -239,13 +239,12 @@ } } - public async Task ReviewTask(ObjectiveTaskDto task, bool close = false) + public async Task ReviewTask(ObjectiveTaskDto task) { var command = new ReviewTask.Command() { ObjectiveId = task.ObjectiveId, - TaskId = task.Id, - Close = close + TaskId = task.Id }; var parameters = new DialogParameters() @@ -254,7 +253,7 @@ }; var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; - var dialog = DialogService.Show(string.Format("{0} task", close ? "Close" : "Complete"), parameters, options); + var dialog = DialogService.Show("Complete task", parameters, options); var state = await dialog.Result; From db17891882a7000cce93ca1e29e26c80af5b6055 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Thu, 15 Aug 2024 08:20:17 +0100 Subject: [PATCH 10/35] Add ability to rename objectives --- .../Objectives/Commands/EditObjective.cs | 53 ++++++++++++++++ src/Domain/Entities/Participants/Objective.cs | 5 ++ .../Objectives/RenameObjectiveDialog.razor | 60 +++++++++++++++++++ .../Components/CasePathwayPlan.razor | 41 ++++++++++++- src/Server.UI/wwwroot/css/app.css | 5 ++ 5 files changed, 161 insertions(+), 3 deletions(-) create mode 100644 src/Application/Features/Objectives/Commands/EditObjective.cs create mode 100644 src/Server.UI/Pages/Objectives/RenameObjectiveDialog.razor diff --git a/src/Application/Features/Objectives/Commands/EditObjective.cs b/src/Application/Features/Objectives/Commands/EditObjective.cs new file mode 100644 index 00000000..d10c5d98 --- /dev/null +++ b/src/Application/Features/Objectives/Commands/EditObjective.cs @@ -0,0 +1,53 @@ +using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.Common.Validators; +using Cfo.Cats.Application.SecurityConstants; + +namespace Cfo.Cats.Application.Features.Objectives.Commands; + +public static class EditObjective +{ + [RequestAuthorize(Policy = SecurityPolicies.Enrol)] + public class Command : IRequest + { + [Description("Objective Id")] + public required Guid ObjectiveId { get; set; } + + [Description("Title")] + public required string Title { get; set; } + } + + public class Handler(IUnitOfWork unitOfWork) : IRequestHandler + { + public async Task Handle(Command request, CancellationToken cancellationToken) + { + var objective = await unitOfWork.DbContext.Objectives.FindAsync(request.ObjectiveId); + + if (objective is null) + { + throw new NotFoundException("Cannot find objective", request.ObjectiveId); + } + + objective.Rename(request.Title); + + return Result.Success(); + } + } + + public class Validator : AbstractValidator + { + public Validator() + { + var today = DateTime.UtcNow; + + RuleFor(x => x.ObjectiveId) + .NotNull(); + + RuleFor(x => x.Title) + .NotEmpty() + .WithMessage("You must provide a title") + .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) + .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); + } + + } +} diff --git a/src/Domain/Entities/Participants/Objective.cs b/src/Domain/Entities/Participants/Objective.cs index 18435766..48cc67d8 100644 --- a/src/Domain/Entities/Participants/Objective.cs +++ b/src/Domain/Entities/Participants/Objective.cs @@ -26,6 +26,11 @@ public Objective AddTask(ObjectiveTask task) return this; } + public void Rename(string title) + { + Title = title; + } + public static Objective Create(string title, string participantId) { Objective objective = new() diff --git a/src/Server.UI/Pages/Objectives/RenameObjectiveDialog.razor b/src/Server.UI/Pages/Objectives/RenameObjectiveDialog.razor new file mode 100644 index 00000000..385b1565 --- /dev/null +++ b/src/Server.UI/Pages/Objectives/RenameObjectiveDialog.razor @@ -0,0 +1,60 @@ +@using Cfo.Cats.Application.Features.Objectives.Commands + +@inherits CatsComponentBase + + + + + + + + + @ConstantString.Cancel + @ConstantString.Save + + + +@code { + MudForm? form; + bool saving; + + [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter, EditorRequired] + public required EditObjective.Command Model { get; set; } + + private void Cancel() + { + MudDialog.Cancel(); + } + + private async Task Submit() + { + try + { + saving = true; + + if (form is null) + { + saving = false; + return; + } + + await form.Validate(); + + if (form.IsValid) + { + MudDialog.Close(DialogResult.Ok(true)); + } + + } + finally + { + saving = false; + } + } + + +} diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index 48dbe9f6..3ba430e4 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -21,12 +21,12 @@
- + Date added Title No. of outstanding tasks - + Ascending Descending @@ -165,7 +165,13 @@ } -
+
+ + + + + + @@ -362,4 +368,33 @@ } } + public async Task RenameObjective(ObjectiveDto objective) + { + var command = new EditObjective.Command() + { + ObjectiveId = objective.Id, + Title = objective.Title + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; + var dialog = DialogService.Show("Rename objective", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnRefresh(); + } + + } + } } diff --git a/src/Server.UI/wwwroot/css/app.css b/src/Server.UI/wwwroot/css/app.css index 0f5984b3..2c97e345 100644 --- a/src/Server.UI/wwwroot/css/app.css +++ b/src/Server.UI/wwwroot/css/app.css @@ -101,4 +101,9 @@ .description-pair dd { margin: 0; flex: 1; +} + +.mud-tooltip-root { + height: fit-content; + display: flex !important; } \ No newline at end of file From 1af4f65c70f7e07c9262550646dc929f27d536d0 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Thu, 15 Aug 2024 10:16:03 +0100 Subject: [PATCH 11/35] Objective status & review --- .../Objectives/Commands/ReviewObjective.cs | 52 + .../Objectives/Commands/ReviewTask.cs | 2 +- .../Features/Objectives/DTOs/ObjectiveDto.cs | 5 + .../Objectives/DTOs/ObjectiveTaskDto.cs | 2 +- src/Domain/Common/Enums/CompletionStatus.cs | 17 + .../Common/Enums/TaskCompletionStatus.cs | 17 - src/Domain/Entities/Participants/Objective.cs | 19 + .../Entities/Participants/ObjectiveTask.cs | 4 +- .../ObjectiveEntityTypeConfiguration.cs | 8 +- .../20240815084514_Objectives_v5.Designer.cs | 2432 ++++++++++++++++ .../20240815084514_Objectives_v5.cs | 44 + .../20240815085352_Objectives_v6.Designer.cs | 2432 ++++++++++++++++ .../20240815085352_Objectives_v6.cs | 39 + .../20240815090249_Objectives_v7.Designer.cs | 2435 +++++++++++++++++ .../20240815090249_Objectives_v7.cs | 30 + .../ApplicationDbContextModelSnapshot.cs | 9 + .../Objectives/ReviewObjectiveDialog.razor | 79 + .../Objectives/Tasks/ReviewTaskDialog.razor | 2 +- .../Components/CasePathwayPlan.razor | 56 +- 19 files changed, 7646 insertions(+), 38 deletions(-) create mode 100644 src/Application/Features/Objectives/Commands/ReviewObjective.cs create mode 100644 src/Domain/Common/Enums/CompletionStatus.cs delete mode 100644 src/Domain/Common/Enums/TaskCompletionStatus.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.Designer.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.Designer.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.Designer.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.cs create mode 100644 src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor diff --git a/src/Application/Features/Objectives/Commands/ReviewObjective.cs b/src/Application/Features/Objectives/Commands/ReviewObjective.cs new file mode 100644 index 00000000..acb7b597 --- /dev/null +++ b/src/Application/Features/Objectives/Commands/ReviewObjective.cs @@ -0,0 +1,52 @@ +using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.SecurityConstants; + +namespace Cfo.Cats.Application.Features.Objectives.Commands; + +public static class ReviewObjective +{ + [RequestAuthorize(Policy = SecurityPolicies.Enrol)] + public class Command : IRequest + { + [Description("Objective Id")] + public required Guid ObjectiveId { get; set; } + + public CompletionStatus Reason { get; set; } = CompletionStatus.Done; + + public string? Justification { get; set; } + } + + public class Handler(IUnitOfWork unitOfWork) : IRequestHandler + { + public async Task Handle(Command request, CancellationToken cancellationToken) + { + var objective = await unitOfWork.DbContext.Objectives.FindAsync(request.ObjectiveId); + + if (objective is null) + { + throw new NotFoundException("Cannot find objective", request.ObjectiveId); + } + + objective.Review(request.Reason, request.Justification); + + return Result.Success(); + } + } + + public class Validator : AbstractValidator + { + public Validator() + { + RuleFor(x => x.ObjectiveId) + .NotNull(); + + When(x => x.Reason.RequiresJustification, () => + { + RuleFor(x => x.Justification) + .NotEmpty() + .WithMessage("Justification is required for the selected reason"); + }); + } + + } +} diff --git a/src/Application/Features/Objectives/Commands/ReviewTask.cs b/src/Application/Features/Objectives/Commands/ReviewTask.cs index c7d478e1..5695530d 100644 --- a/src/Application/Features/Objectives/Commands/ReviewTask.cs +++ b/src/Application/Features/Objectives/Commands/ReviewTask.cs @@ -16,7 +16,7 @@ public class Command : IRequest public required Guid ObjectiveId { get; set; } [Description("Reason")] - public TaskCompletionStatus Reason { get; set; } = TaskCompletionStatus.Done; + public CompletionStatus Reason { get; set; } = CompletionStatus.Done; [Description("Justification")] public string Justification { get; set; } = string.Empty; diff --git a/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs b/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs index a65a32a2..27b08fdc 100644 --- a/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs +++ b/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs @@ -7,8 +7,13 @@ public class ObjectiveDto public required Guid Id { get; set; } public required string ParticipantId { get; set; } public required string Title { get; set; } + public DateTime? Completed { get; set; } + public CompletionStatus? CompletedStatus { get; set; } public required DateTime Created { get; set; } public IEnumerable Tasks { get; set; } = []; + public string? Justification { get; set; } + + public bool IsCompleted => Completed.HasValue; public class Mapping : Profile { diff --git a/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs b/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs index 49282e0f..8f881b03 100644 --- a/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs +++ b/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs @@ -12,7 +12,7 @@ public class ObjectiveTaskDto public DateTime? Completed { get; set; } public string? CompletedByName { get; set; } - public TaskCompletionStatus? CompletedStatus { get; set; } + public CompletionStatus? CompletedStatus { get; set; } public bool IsCompleted => Completed.HasValue; public bool IsOverdue => IsCompleted is false && (ToFirstDayOfMonth(DateTime.UtcNow) > ToFirstDayOfMonth(Due)); diff --git a/src/Domain/Common/Enums/CompletionStatus.cs b/src/Domain/Common/Enums/CompletionStatus.cs new file mode 100644 index 00000000..fdfe95d6 --- /dev/null +++ b/src/Domain/Common/Enums/CompletionStatus.cs @@ -0,0 +1,17 @@ +using Ardalis.SmartEnum; + +namespace Cfo.Cats.Domain.Common.Enums; + +public class CompletionStatus : SmartEnum +{ + public static readonly CompletionStatus Done = new("Done", 0, false); + public static readonly CompletionStatus NotRequired = new("No longer required", 1, true); + + public CompletionStatus(string name, int value, bool requiresJustification = false) + : base(name, value) + { + RequiresJustification = requiresJustification; + } + + public bool RequiresJustification { get; private set; } +} diff --git a/src/Domain/Common/Enums/TaskCompletionStatus.cs b/src/Domain/Common/Enums/TaskCompletionStatus.cs deleted file mode 100644 index 1136afcc..00000000 --- a/src/Domain/Common/Enums/TaskCompletionStatus.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Ardalis.SmartEnum; - -namespace Cfo.Cats.Domain.Common.Enums; - -public class TaskCompletionStatus : SmartEnum -{ - public static readonly TaskCompletionStatus Done = new("Done", 0, false); - public static readonly TaskCompletionStatus NotRequired = new("No longer required", 1, true); - - public TaskCompletionStatus(string name, int value, bool requiresJustification = false) - : base(name, value) - { - RequiresJustification = requiresJustification; - } - - public bool RequiresJustification { get; private set; } -} diff --git a/src/Domain/Entities/Participants/Objective.cs b/src/Domain/Entities/Participants/Objective.cs index 48cc67d8..d27c2b8e 100644 --- a/src/Domain/Entities/Participants/Objective.cs +++ b/src/Domain/Entities/Participants/Objective.cs @@ -1,4 +1,5 @@ using Cfo.Cats.Domain.Common.Entities; +using Cfo.Cats.Domain.Common.Enums; using Cfo.Cats.Domain.Events; namespace Cfo.Cats.Domain.Entities.Participants; @@ -13,9 +14,14 @@ private Objective() private List _tasks = new(); + public DateTime? Completed { get; set; } + public CompletionStatus? CompletedStatus { get; set; } + public string ParticipantId { get; private set; } public string Title { get; private set; } + + public string? Justification { get; private set; } public IReadOnlyCollection Tasks => _tasks.AsReadOnly(); @@ -31,6 +37,19 @@ public void Rename(string title) Title = title; } + public void Review(CompletionStatus status, string? justification) + { + foreach (var task in _tasks.Where(task => task.Completed is null)) + { + task.Review(status, justification); + } + + CompletedStatus = status; + Completed = DateTime.UtcNow; + Justification = justification; + // AddDomainEvent + } + public static Objective Create(string title, string participantId) { Objective objective = new() diff --git a/src/Domain/Entities/Participants/ObjectiveTask.cs b/src/Domain/Entities/Participants/ObjectiveTask.cs index b8411b21..20e71a69 100644 --- a/src/Domain/Entities/Participants/ObjectiveTask.cs +++ b/src/Domain/Entities/Participants/ObjectiveTask.cs @@ -13,7 +13,7 @@ private ObjectiveTask() } #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public void Review(TaskCompletionStatus status, string? justification = null) + public void Review(CompletionStatus status, string? justification = null) { Completed = DateTime.UtcNow; Justification = justification; @@ -46,7 +46,7 @@ public void Rename(string title) public DateTime Due { get; private set; } public DateTime? Completed { get; private set; } public string? CompletedBy { get; private set; } - public TaskCompletionStatus? CompletedStatus { get; private set; } + public CompletionStatus? CompletedStatus { get; private set; } public string? Justification { get; private set; } public Guid ObjectiveId { get; private set; } diff --git a/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs b/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs index 6b2a3f49..62c9e45e 100644 --- a/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs +++ b/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs @@ -30,6 +30,12 @@ public void Configure(EntityTypeBuilder builder) builder.Property(o => o.LastModifiedBy) .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + builder.Property(t => t.CompletedStatus) + .HasConversion( + x => x!.Value, + x => CompletionStatus.FromValue(x) + ); + builder.Navigation(e => e.Tasks).AutoInclude(); builder.OwnsMany(o => o.Tasks, task => @@ -59,7 +65,7 @@ public void Configure(EntityTypeBuilder builder) task.Property(t => t.CompletedStatus) .HasConversion( x => x!.Value, - x => TaskCompletionStatus.FromValue(x) + x => CompletionStatus.FromValue(x) ); }); } diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.Designer.cs new file mode 100644 index 00000000..e53e9314 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.Designer.cs @@ -0,0 +1,2432 @@ +// +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("20240815084514_Objectives_v5")] + partial class Objectives_v5 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .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("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.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.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + 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.Objective", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Completed") + .HasColumnType("datetime2"); + + b.Property("CompletedStatus") + .HasColumnType("int"); + + 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("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Objective", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => + { + b.Property("Id") + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .IsRequired() + .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("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.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("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.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.Objective", b => + { + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", 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("Due") + .HasColumnType("datetime2"); + + b1.Property("Justification") + .HasColumnType("nvarchar(max)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("ObjectiveId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CompletedBy"); + + b1.HasIndex("ObjectiveId"); + + b1.ToTable("ObjectiveTask", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b1.WithOwner() + .HasForeignKey("ObjectiveId"); + + b1.Navigation("CompletedByUser"); + }); + + b.Navigation("Tasks"); + }); + + 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.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.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + }); + + 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/20240815084514_Objectives_v5.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.cs new file mode 100644 index 00000000..e5506d0b --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.cs @@ -0,0 +1,44 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Objectives_v5 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Completed", + schema: "Participant", + table: "Objective", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "CompletedStatus", + schema: "Participant", + table: "Objective", + type: "int", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Completed", + schema: "Participant", + table: "Objective"); + + migrationBuilder.DropColumn( + name: "CompletedStatus", + schema: "Participant", + table: "Objective"); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.Designer.cs new file mode 100644 index 00000000..716dc440 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.Designer.cs @@ -0,0 +1,2432 @@ +// +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("20240815085352_Objectives_v6")] + partial class Objectives_v6 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .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("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.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.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + 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.Objective", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Completed") + .HasColumnType("datetime2"); + + b.Property("CompletedStatus") + .HasColumnType("int"); + + 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("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Objective", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => + { + b.Property("Id") + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .IsRequired() + .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("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.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("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.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.Objective", b => + { + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", 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("Due") + .HasColumnType("datetime2"); + + b1.Property("Justification") + .HasColumnType("nvarchar(max)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("ObjectiveId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CompletedBy"); + + b1.HasIndex("ObjectiveId"); + + b1.ToTable("ObjectiveTask", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b1.WithOwner() + .HasForeignKey("ObjectiveId"); + + b1.Navigation("CompletedByUser"); + }); + + b.Navigation("Tasks"); + }); + + 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.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.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + }); + + 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/20240815085352_Objectives_v6.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.cs new file mode 100644 index 00000000..c4ab472f --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.cs @@ -0,0 +1,39 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Objectives_v6 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Completed", + schema: "Participant", + table: "Objective", + type: "datetime2", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Completed", + schema: "Participant", + table: "Objective", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldNullable: true); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.Designer.cs new file mode 100644 index 00000000..3ec92a95 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.Designer.cs @@ -0,0 +1,2435 @@ +// +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("20240815090249_Objectives_v7")] + partial class Objectives_v7 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .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("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.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.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + 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.Objective", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Completed") + .HasColumnType("datetime2"); + + b.Property("CompletedStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Justification") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Objective", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => + { + b.Property("Id") + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .IsRequired() + .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("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.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("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.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.Objective", b => + { + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", 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("Due") + .HasColumnType("datetime2"); + + b1.Property("Justification") + .HasColumnType("nvarchar(max)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("ObjectiveId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CompletedBy"); + + b1.HasIndex("ObjectiveId"); + + b1.ToTable("ObjectiveTask", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b1.WithOwner() + .HasForeignKey("ObjectiveId"); + + b1.Navigation("CompletedByUser"); + }); + + b.Navigation("Tasks"); + }); + + 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.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.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + }); + + 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/20240815090249_Objectives_v7.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.cs new file mode 100644 index 00000000..f09309c5 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Objectives_v7 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Justification", + schema: "Participant", + table: "Objective", + type: "nvarchar(max)", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Justification", + schema: "Participant", + table: "Objective"); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs index d4e8f91a..95132cce 100644 --- a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs @@ -601,6 +601,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); + b.Property("Completed") + .HasColumnType("datetime2"); + + b.Property("CompletedStatus") + .HasColumnType("int"); + b.Property("Created") .HasColumnType("datetime2"); @@ -608,6 +614,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(36) .HasColumnType("nvarchar(36)"); + b.Property("Justification") + .HasColumnType("nvarchar(max)"); + b.Property("LastModified") .HasColumnType("datetime2"); diff --git a/src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor b/src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor new file mode 100644 index 00000000..eb3df570 --- /dev/null +++ b/src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor @@ -0,0 +1,79 @@ +@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Domain.Common.Enums + +@inherits CatsComponentBase + + + + + + @foreach (var status in CompletionStatus.List) + { + @status.Name + } + + + + + + + + + @ConstantString.Cancel + + @($"{ConstantString.Complete} Objective") + + + + +@code { + MudForm? form; + bool saving; + bool understood; + + [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter, EditorRequired] + public required ReviewObjective.Command Model { get; set; } + + private void Cancel() + { + MudDialog.Cancel(); + } + + private async Task Submit() + { + try + { + saving = true; + + if (form is null) + { + saving = false; + return; + } + + await form.Validate(); + + if (form.IsValid) + { + MudDialog.Close(DialogResult.Ok(true)); + } + + } + finally + { + saving = false; + } + } + + +} diff --git a/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor index 3f43b344..464f0041 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor @@ -9,7 +9,7 @@ - @foreach(var status in TaskCompletionStatus.List) + @foreach(var status in CompletionStatus.List) { @status.Name } diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index 3ba430e4..2f5afbfa 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -52,19 +52,16 @@
@objective.Title (@tasks.Count(x => x.IsCompleted)/@tasks.Count()) - @if(tasks.Any()) + @if(objective.IsCompleted) { - if (tasks.Any(task => task.IsOverdue)) + + @if (objective.CompletedStatus == CompletionStatus.Done) { - + } - else if (tasks.Any(task => task.IsDueSoon)) + else if (objective.CompletedStatus == CompletionStatus.NotRequired) { - - } - else if (tasks.All(task => task.IsCompleted)) - { - + } }
@@ -93,11 +90,11 @@ @if (task.IsCompleted) { - @if(task.CompletedStatus == TaskCompletionStatus.Done) + @if(task.CompletedStatus == CompletionStatus.Done) { } - else if(task.CompletedStatus == TaskCompletionStatus.NotRequired) + else if(task.CompletedStatus == CompletionStatus.NotRequired) { } @@ -166,14 +163,14 @@ }
- - + + - + - +
@@ -245,6 +242,35 @@ } } + public async Task ReviewObjective(ObjectiveDto objective) + { + var command = new ReviewObjective.Command() + { + ObjectiveId = objective.Id + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; + var dialog = DialogService.Show("Review objective", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnRefresh(); + } + + } + } + public async Task ReviewTask(ObjectiveTaskDto task) { var command = new ReviewTask.Command() From 3dad9d2cac0fc0a914d7838f26004a4620a03520 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Thu, 15 Aug 2024 10:59:10 +0100 Subject: [PATCH 12/35] Cleanup pathway plan + separate objective/task components --- .../Pages/Objectives/Objective.razor | 183 ++++++++++ .../Objectives/Tasks/ObjectiveTask.razor | 202 +++++++++++ .../Components/CasePathwayPlan.razor | 327 +----------------- 3 files changed, 395 insertions(+), 317 deletions(-) create mode 100644 src/Server.UI/Pages/Objectives/Objective.razor create mode 100644 src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor diff --git a/src/Server.UI/Pages/Objectives/Objective.razor b/src/Server.UI/Pages/Objectives/Objective.razor new file mode 100644 index 00000000..69d6e24c --- /dev/null +++ b/src/Server.UI/Pages/Objectives/Objective.razor @@ -0,0 +1,183 @@ +@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Application.Features.Objectives.DTOs +@using Cfo.Cats.Application.Features.Objectives.Queries +@using Cfo.Cats.Domain.Common.Enums +@using Cfo.Cats.Server.UI.Pages.Objectives +@using Cfo.Cats.Server.UI.Pages.Objectives.Tasks +@using Humanizer + +@inherits CatsComponentBase + + + +
+ @if(Model.IsCompleted) + { + + } + @Model.Title + (@Model.Tasks.Count(x => x.IsCompleted)/@Model.Tasks.Count()) + @if(Model.IsCompleted) + { + @if (Model.CompletedStatus == CompletionStatus.Done) + { + + } + else if (Model.CompletedStatus == CompletionStatus.NotRequired) + { + + } + } +
+
+ + @foreach (var task in Model.Tasks + .Where(task => task.IsCompleted is false || HideCompletedTasks is false) + .OrderBy(task => task.Created)) + { + + } +
+ + + + + + + + + +
+
+
+ +@code { + [Parameter, EditorRequired] + public required ObjectiveDto Model { get; set; } + + [Parameter, EditorRequired] + public required string ParticipantId { get; set; } + + [Parameter, EditorRequired] + public required bool HideCompletedTasks { get; set; } + + [Parameter] + public EventCallback OnChange { get; set; } + + public async Task AddObjective() + { + var command = new AddObjective.Command() + { + ParticipantId = ParticipantId + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; + var dialog = DialogService.Show("Add objective", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnChange.InvokeAsync(); + } + + } + } + + public async Task Review() + { + var command = new ReviewObjective.Command() + { + ObjectiveId = Model.Id + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; + var dialog = DialogService.Show("Review objective", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnChange.InvokeAsync(); + } + + } + } + + public async Task AddTask() + { + var command = new AddTask.Command() + { + ObjectiveId = Model.Id + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; + var dialog = DialogService.Show("Add task to objective", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnChange.InvokeAsync(); + } + + } + } + + public async Task Rename() + { + var command = new EditObjective.Command() + { + ObjectiveId = Model.Id, + Title = Model.Title + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; + var dialog = DialogService.Show("Rename objective", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnChange.InvokeAsync(); + } + + } + } +} diff --git a/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor new file mode 100644 index 00000000..f3c466f0 --- /dev/null +++ b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor @@ -0,0 +1,202 @@ +@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Application.Features.Objectives.DTOs +@using Cfo.Cats.Domain.Common.Enums +@using Humanizer + +@inherits CatsComponentBase + + + + @if (Model.IsCompleted) + { + + } + else + { + + } + + +
+
+
+ + @Model.Title + + @if (Model.IsCompleted) + { + + @if (Model.CompletedStatus == CompletionStatus.Done) + { + + } + else if (Model.CompletedStatus == CompletionStatus.NotRequired) + { + + } + + } + else + { + if (Model.IsOverdue) + { + + + Due @Model.Due.ToString("MMM, yyyy") + + + + + + } + else if (Model.IsDueSoon) + { + + + Due @Model.Due.ToString("MMM, yyyy") + + + + + + } + } +
+ @if (Model.IsCompleted) + { + Completed @Model.Completed.Humanize() + } + else + { + Due @Model.Due.ToString("MMM, yyyy") + } +
+
+ + + Extend date + Rename + + + + + New Activity + New ETE + New PSF + + + + + Added @Model.Created.Humanize() + + + + + +
+
+
+
+ +@code { + [Parameter, EditorRequired] + public required ObjectiveTaskDto Model { get; set; } + + [Parameter] + public EventCallback OnChange { get; set; } + + public async Task Review() + { + var command = new ReviewTask.Command() + { + TaskId = Model.Id, + ObjectiveId = Model.ObjectiveId + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; + var dialog = DialogService.Show("Complete task", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnChange.InvokeAsync(); + } + + } + } + + public async Task ExtendDate() + { + var command = new EditTask.Command() + { + TaskId = Model.Id, + ObjectiveId = Model.ObjectiveId, + Title = Model.Title, + Due = Model.Due + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; + var dialog = DialogService.Show("Extend date", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnChange.InvokeAsync(); + } + + } + } + + public async Task Rename() + { + var command = new EditTask.Command() + { + TaskId = Model.Id, + ObjectiveId = Model.ObjectiveId, + Title = Model.Title, + Due = Model.Due + }; + + var parameters = new DialogParameters() + { + { x => x.Model, command } + }; + + var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; + var dialog = DialogService.Show("Rename task", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnChange.InvokeAsync(); + } + + } + } + +} diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index 2f5afbfa..82c8269b 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -31,7 +31,10 @@ Descending
- +
+ + +
@@ -41,140 +44,11 @@
- @foreach (var objective in Model.OrderByDirection(sortDirection, selectors[selector])) + @foreach (var objective in Model + .Where(objective => objective.IsCompleted is false || hideCompletedObjectives is false) + .OrderByDirection(sortDirection, selectors[selector])) { - var tasks = objective.Tasks - .Where(task => task.IsCompleted is false || hideCompleted is false) - .OrderBy(task => task.Created); - - - -
- @objective.Title - (@tasks.Count(x => x.IsCompleted)/@tasks.Count()) - @if(objective.IsCompleted) - { - - @if (objective.CompletedStatus == CompletionStatus.Done) - { - - } - else if (objective.CompletedStatus == CompletionStatus.NotRequired) - { - - } - } -
-
- - @foreach (var task in tasks.OrderBy(x => x.Created)) - { - - - @if(task.IsCompleted) - { - - } - else - { - - } - - -
-
-
- - @task.Title - - @if (task.IsCompleted) - { - - @if(task.CompletedStatus == CompletionStatus.Done) - { - - } - else if(task.CompletedStatus == CompletionStatus.NotRequired) - { - - } - - } - else - { - if (task.IsOverdue) - { - - - Due @task.Due.ToString("MMM, yyyy") - - - - - - } - else if (task.IsDueSoon) - { - - - Due @task.Due.ToString("MMM, yyyy") - - - - - - } - } -
- @if(task.IsCompleted) - { - Completed @task.Completed.Humanize() - } - else - { - Due @task.Due.ToString("MMM, yyyy") - } -
-
- - - Extend date - Rename - - - - - New Activity - New ETE - New PSF - - - - - Added @task.Created.Humanize() - - - - - -
-
-
-
- } -
- - - - - - - - - -
-
-
+ } @@ -182,7 +56,8 @@ } @code { - private bool hideCompleted = false; + private bool hideCompletedObjectives = false; + private bool hideCompletedTasks = false; private string selector = "Created"; private Dictionary> selectors = new() @@ -241,186 +116,4 @@ } } - - public async Task ReviewObjective(ObjectiveDto objective) - { - var command = new ReviewObjective.Command() - { - ObjectiveId = objective.Id - }; - - var parameters = new DialogParameters() - { - { x => x.Model, command } - }; - - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; - var dialog = DialogService.Show("Review objective", parameters, options); - - var state = await dialog.Result; - - if (state!.Canceled is false) - { - var result = await GetNewMediator().Send(command); - - if (result.Succeeded) - { - await OnRefresh(); - } - - } - } - - public async Task ReviewTask(ObjectiveTaskDto task) - { - var command = new ReviewTask.Command() - { - ObjectiveId = task.ObjectiveId, - TaskId = task.Id - }; - - var parameters = new DialogParameters() - { - { x => x.Model, command } - }; - - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; - var dialog = DialogService.Show("Complete task", parameters, options); - - var state = await dialog.Result; - - if (state!.Canceled is false) - { - var result = await GetNewMediator().Send(command); - - if (result.Succeeded) - { - await OnRefresh(); - } - - } - } - - public async Task AddTask(ObjectiveDto to) - { - var command = new AddTask.Command() - { - ObjectiveId = to.Id - }; - - var parameters = new DialogParameters() - { - { x => x.Model, command } - }; - - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; - var dialog = DialogService.Show("Add task to objective", parameters, options); - - var state = await dialog.Result; - - if (state!.Canceled is false) - { - var result = await GetNewMediator().Send(command); - - if(result.Succeeded) - { - await OnRefresh(); - } - - } - } - - public async Task ExtendDate(ObjectiveTaskDto task) - { - var command = new EditTask.Command() - { - TaskId = task.Id, - ObjectiveId = task.ObjectiveId, - Title = task.Title, - Due = task.Due - }; - - var parameters = new DialogParameters() - { - { x => x.Model, command } - }; - - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; - var dialog = DialogService.Show("Extend date", parameters, options); - - var state = await dialog.Result; - - if (state!.Canceled is false) - { - var result = await GetNewMediator().Send(command); - - if (result.Succeeded) - { - await OnRefresh(); - } - - } - } - - public async Task RenameTask(ObjectiveTaskDto task) - { - var command = new EditTask.Command() - { - TaskId = task.Id, - ObjectiveId = task.ObjectiveId, - Title = task.Title, - Due = task.Due - }; - - var parameters = new DialogParameters() - { - { x => x.Model, command } - }; - - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; - var dialog = DialogService.Show("Rename task", parameters, options); - - var state = await dialog.Result; - - if (state!.Canceled is false) - { - var result = await GetNewMediator().Send(command); - - if (result.Succeeded) - { - await OnRefresh(); - } - - } - } - - public async Task RenameObjective(ObjectiveDto objective) - { - var command = new EditObjective.Command() - { - ObjectiveId = objective.Id, - Title = objective.Title - }; - - var parameters = new DialogParameters() - { - { x => x.Model, command } - }; - - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; - var dialog = DialogService.Show("Rename objective", parameters, options); - - var state = await dialog.Result; - - if (state!.Canceled is false) - { - var result = await GetNewMediator().Send(command); - - if (result.Succeeded) - { - await OnRefresh(); - } - - } - } } From 17a5639a314ccf4910a78dcb4bb713d4bd55af7d Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Thu, 15 Aug 2024 11:07:18 +0100 Subject: [PATCH 13/35] Re-add real-time status to objective --- src/Server.UI/Pages/Objectives/Objective.razor | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Server.UI/Pages/Objectives/Objective.razor b/src/Server.UI/Pages/Objectives/Objective.razor index 69d6e24c..a3c1d580 100644 --- a/src/Server.UI/Pages/Objectives/Objective.razor +++ b/src/Server.UI/Pages/Objectives/Objective.razor @@ -28,6 +28,17 @@ } } + else + { + if(Model.Tasks.Any(task => task.IsOverdue)) + { + + } + else if(Model.Tasks.Any(task => task.IsDueSoon)) + { + + } + }
From 926d93adc32b6ab129abe3e872fb1326f52128a1 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Thu, 15 Aug 2024 15:47:25 +0100 Subject: [PATCH 14/35] WIP - Pathway Plan reviews --- .../Interfaces/IApplicationDbContext.cs | 5 +- .../DTOs/ParticipantSummaryDto.cs | 2 + .../Queries/GetParticipantSummary.cs | 14 +- .../Commands/AddObjective.cs | 21 +- .../PathwayPlans/Commands/AddPathwayPlan.cs | 54 + .../Commands/AddTask.cs | 17 +- .../Commands/EditObjective.cs | 17 +- .../Commands/EditTask.cs | 26 +- .../Commands/ReviewObjective.cs | 14 +- .../Commands/ReviewTask.cs | 27 +- .../DTOs/ObjectiveDto.cs | 5 +- .../DTOs/ObjectiveTaskDto.cs | 4 +- .../PathwayPlans/DTOs/PathwayPlanDto.cs | 21 + .../DTOs/PathwayPlanSummaryDto.cs | 29 + .../Queries/GetPathwayPlanByParticipantId.cs} | 23 +- src/Domain/Entities/Participants/Objective.cs | 6 +- .../Entities/Participants/PathwayPlan.cs | 43 + .../Participants/PathwayPlanReviewHistory.cs | 25 + .../Constants/Database/DatabaseConstants.cs | 3 + .../Persistence/ApplicationDbContext.cs | 5 +- .../ObjectiveEntityTypeConfiguration.cs | 72 - .../PathwayPlanEntityTypeConfiguration.cs | 114 + .../20240815140110_Objectives_v8.Designer.cs | 2505 +++++++++++++++++ .../20240815140110_Objectives_v8.cs | 144 + .../ApplicationDbContextModelSnapshot.cs | 292 +- .../Pages/Objectives/AddObjectiveDialog.razor | 2 +- .../Pages/Objectives/Objective.razor | 43 +- .../Objectives/RenameObjectiveDialog.razor | 2 +- .../Objectives/ReviewObjectiveDialog.razor | 2 +- .../Objectives/Tasks/AddTaskDialog.razor | 2 +- .../Tasks/ExtendDateTaskDialog.razor | 2 +- .../Objectives/Tasks/ObjectiveTask.razor | 16 +- .../Objectives/Tasks/RenameTaskDialog.razor | 2 +- .../Objectives/Tasks/ReviewTaskDialog.razor | 2 +- .../Components/CasePathwayPlan.razor | 48 +- .../Participants/Components/CaseSummary.razor | 62 + .../Components/CaseSummary.razor.cs | 9 + 37 files changed, 3347 insertions(+), 333 deletions(-) rename src/Application/Features/{Objectives => PathwayPlans}/Commands/AddObjective.cs (71%) create mode 100644 src/Application/Features/PathwayPlans/Commands/AddPathwayPlan.cs rename src/Application/Features/{Objectives => PathwayPlans}/Commands/AddTask.cs (78%) rename src/Application/Features/{Objectives => PathwayPlans}/Commands/EditObjective.cs (67%) rename src/Application/Features/{Objectives => PathwayPlans}/Commands/EditTask.cs (75%) rename src/Application/Features/{Objectives => PathwayPlans}/Commands/ReviewObjective.cs (68%) rename src/Application/Features/{Objectives => PathwayPlans}/Commands/ReviewTask.cs (68%) rename src/Application/Features/{Objectives => PathwayPlans}/DTOs/ObjectiveDto.cs (84%) rename src/Application/Features/{Objectives => PathwayPlans}/DTOs/ObjectiveTaskDto.cs (95%) create mode 100644 src/Application/Features/PathwayPlans/DTOs/PathwayPlanDto.cs create mode 100644 src/Application/Features/PathwayPlans/DTOs/PathwayPlanSummaryDto.cs rename src/Application/Features/{Objectives/Queries/GetObjectivesByParticipantId.cs => PathwayPlans/Queries/GetPathwayPlanByParticipantId.cs} (53%) create mode 100644 src/Domain/Entities/Participants/PathwayPlan.cs create mode 100644 src/Domain/Entities/Participants/PathwayPlanReviewHistory.cs delete mode 100644 src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs create mode 100644 src/Infrastructure/Persistence/Configurations/Participants/PathwayPlanEntityTypeConfiguration.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.Designer.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.cs diff --git a/src/Application/Common/Interfaces/IApplicationDbContext.cs b/src/Application/Common/Interfaces/IApplicationDbContext.cs index 8fbddacf..28b74076 100644 --- a/src/Application/Common/Interfaces/IApplicationDbContext.cs +++ b/src/Application/Common/Interfaces/IApplicationDbContext.cs @@ -25,10 +25,9 @@ public interface IApplicationDbContext public DbSet Participants { get; } - public DbSet Risks { get; } + public DbSet PathwayPlans { get; } - public DbSet Objectives { get; } - public DbSet ObjectiveTasks { get; } + public DbSet Risks { get; } public DbSet KeyValues { get; } diff --git a/src/Application/Features/Participants/DTOs/ParticipantSummaryDto.cs b/src/Application/Features/Participants/DTOs/ParticipantSummaryDto.cs index 63c339a6..c8ca1570 100644 --- a/src/Application/Features/Participants/DTOs/ParticipantSummaryDto.cs +++ b/src/Application/Features/Participants/DTOs/ParticipantSummaryDto.cs @@ -1,3 +1,4 @@ +using Cfo.Cats.Application.Features.PathwayPlans.DTOs; using Cfo.Cats.Domain.Entities.Assessments; using Cfo.Cats.Domain.Entities.Participants; @@ -40,6 +41,7 @@ public class ParticipantSummaryDto public RiskSummaryDto? LatestRisk { get; set; } + public PathwayPlanSummaryDto? PathwayPlan { get; set; } private class Mapping : Profile { diff --git a/src/Application/Features/Participants/Queries/GetParticipantSummary.cs b/src/Application/Features/Participants/Queries/GetParticipantSummary.cs index 6cc84c26..754b6ffb 100644 --- a/src/Application/Features/Participants/Queries/GetParticipantSummary.cs +++ b/src/Application/Features/Participants/Queries/GetParticipantSummary.cs @@ -2,6 +2,7 @@ using Cfo.Cats.Application.Common.Validators; using Cfo.Cats.Application.Features.Participants.Caching; using Cfo.Cats.Application.Features.Participants.DTOs; +using Cfo.Cats.Application.Features.PathwayPlans.DTOs; using Cfo.Cats.Application.SecurityConstants; namespace Cfo.Cats.Application.Features.Participants.Queries; @@ -41,14 +42,19 @@ public async Task> Handle(Query request, Cancellat .ProjectTo(mapper.ConfigurationProvider) .ToArrayAsync(cancellationToken); - var risk = await unitOfWork.DbContext.Risks + summary.LatestRisk = await unitOfWork.DbContext.Risks .OrderByDescending(x => x.Created) + .ProjectTo(mapper.ConfigurationProvider) .FirstOrDefaultAsync(x => x.ParticipantId == request.ParticipantId, cancellationToken); - summary.LatestRisk = mapper.Map(risk); - - return Result.Success(summary); + summary.PathwayPlan = await unitOfWork.DbContext.PathwayPlans + .IgnoreAutoIncludes() + .Include(x => x.ReviewHistories) + .Where(x => x.ParticipantId == request.ParticipantId) + .ProjectTo(mapper.ConfigurationProvider) + .FirstOrDefaultAsync(cancellationToken); + return Result.Success(summary); } } diff --git a/src/Application/Features/Objectives/Commands/AddObjective.cs b/src/Application/Features/PathwayPlans/Commands/AddObjective.cs similarity index 71% rename from src/Application/Features/Objectives/Commands/AddObjective.cs rename to src/Application/Features/PathwayPlans/Commands/AddObjective.cs index c7178b1d..7593d1a3 100644 --- a/src/Application/Features/Objectives/Commands/AddObjective.cs +++ b/src/Application/Features/PathwayPlans/Commands/AddObjective.cs @@ -3,15 +3,15 @@ using Cfo.Cats.Application.SecurityConstants; using Cfo.Cats.Domain.Entities.Participants; -namespace Cfo.Cats.Application.Features.Objectives.Commands; +namespace Cfo.Cats.Application.Features.PathwayPlans.Commands; public static class AddObjective { [RequestAuthorize(Policy = SecurityPolicies.Enrol)] public class Command : IRequest { - [Description("Participant Id")] - public required string ParticipantId { get; set; } + [Description("Pathway Plan Id")] + public required Guid PathwayPlanId { get; set; } public string? Title { get; set; } @@ -20,7 +20,7 @@ public class Mapping : Profile public Mapping() { CreateMap(MemberList.None) - .ConstructUsing(dto => Objective.Create(dto.Title!, dto.ParticipantId)); + .ConstructUsing(dto => Objective.Create(dto.Title!, dto.PathwayPlanId)); } } } @@ -30,7 +30,15 @@ public class Handler(IUnitOfWork unitOfWork, IMapper mapper) : IRequestHandler Handle(Command request, CancellationToken cancellationToken) { var objective = mapper.Map(request); - await unitOfWork.DbContext.Objectives.AddAsync(objective, cancellationToken); + var pathwayPlan = await unitOfWork.DbContext.PathwayPlans.FindAsync(request.PathwayPlanId); + + if (pathwayPlan is null) + { + throw new NotFoundException("Cannot find pathway plan", request.PathwayPlanId); + } + + pathwayPlan.AddObjective(objective); + return Result.Success(); } } @@ -39,8 +47,7 @@ public class Validator : AbstractValidator { public Validator() { - RuleFor(x => x.ParticipantId) - .Length(9) + RuleFor(x => x.PathwayPlanId) .NotNull(); RuleFor(x => x.Title) diff --git a/src/Application/Features/PathwayPlans/Commands/AddPathwayPlan.cs b/src/Application/Features/PathwayPlans/Commands/AddPathwayPlan.cs new file mode 100644 index 00000000..4f1bd6f8 --- /dev/null +++ b/src/Application/Features/PathwayPlans/Commands/AddPathwayPlan.cs @@ -0,0 +1,54 @@ +using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.Common.Validators; +using Cfo.Cats.Application.SecurityConstants; +using Cfo.Cats.Domain.Entities.Participants; + +namespace Cfo.Cats.Application.Features.PathwayPlans.Commands; + +public static class AddPathwayPlan +{ + [RequestAuthorize(Policy = SecurityPolicies.Enrol)] + public class Command : IRequest + { + public required string ParticipantId { get; set; } + + public class Mapping : Profile + { + public Mapping() + { + CreateMap(MemberList.None) + .ConstructUsing(dto => PathwayPlan.Create(dto.ParticipantId)); + } + } + } + + public class Handler(IUnitOfWork unitOfWork, IMapper mapper) : IRequestHandler + { + public async Task Handle(Command request, CancellationToken cancellationToken) + { + if (await unitOfWork.DbContext.PathwayPlans.AnyAsync(p => p.ParticipantId == request.ParticipantId)) + { + return Result.Failure(); + } + + var pathwayPlan = mapper.Map(request); + + await unitOfWork.DbContext.PathwayPlans.AddAsync(pathwayPlan); + + return Result.Success(); + } + } + + public class Validator : AbstractValidator + { + public Validator() + { + RuleFor(x => x.ParticipantId) + .MinimumLength(9) + .MaximumLength(9) + .Matches(ValidationConstants.AlphaNumeric) + .WithMessage(string.Format(ValidationConstants.AlphaNumericMessage, "Participant Id")); + } + + } +} diff --git a/src/Application/Features/Objectives/Commands/AddTask.cs b/src/Application/Features/PathwayPlans/Commands/AddTask.cs similarity index 78% rename from src/Application/Features/Objectives/Commands/AddTask.cs rename to src/Application/Features/PathwayPlans/Commands/AddTask.cs index 125242b9..82b4793f 100644 --- a/src/Application/Features/Objectives/Commands/AddTask.cs +++ b/src/Application/Features/PathwayPlans/Commands/AddTask.cs @@ -3,13 +3,16 @@ using Cfo.Cats.Application.SecurityConstants; using Cfo.Cats.Domain.Entities.Participants; -namespace Cfo.Cats.Application.Features.Objectives.Commands; +namespace Cfo.Cats.Application.Features.PathwayPlans.Commands; public static class AddTask { [RequestAuthorize(Policy = SecurityPolicies.Enrol)] public class Command : IRequest { + [Description("Pathway Plan Id")] + public required Guid PathwayPlanId { get; set; } + [Description("Objective Id")] public required Guid ObjectiveId { get; set; } @@ -31,12 +34,11 @@ public class Handler(IUnitOfWork unitOfWork, IMapper mapper) : IRequestHandler Handle(Command request, CancellationToken cancellationToken) { - var objective = await unitOfWork.DbContext.Objectives.FindAsync(request.ObjectiveId); + var pathwayPlan = await unitOfWork.DbContext.PathwayPlans.FindAsync(request.PathwayPlanId) + ?? throw new NotFoundException("Cannot find pathway plan", request.PathwayPlanId); - if (objective is null) - { - throw new NotFoundException("Cannot find objective", request.ObjectiveId); - } + var objective = pathwayPlan.Objectives.FirstOrDefault(o => o.Id == request.ObjectiveId) + ?? throw new NotFoundException("Cannot find objective", request.ObjectiveId); var task = mapper.Map(request); @@ -55,6 +57,9 @@ public Validator() RuleFor(x => x.ObjectiveId) .NotNull(); + RuleFor(x => x.PathwayPlanId) + .NotNull(); + RuleFor(x => x.Title) .NotEmpty() .WithMessage("You must provide a title") diff --git a/src/Application/Features/Objectives/Commands/EditObjective.cs b/src/Application/Features/PathwayPlans/Commands/EditObjective.cs similarity index 67% rename from src/Application/Features/Objectives/Commands/EditObjective.cs rename to src/Application/Features/PathwayPlans/Commands/EditObjective.cs index d10c5d98..2511fd59 100644 --- a/src/Application/Features/Objectives/Commands/EditObjective.cs +++ b/src/Application/Features/PathwayPlans/Commands/EditObjective.cs @@ -2,7 +2,7 @@ using Cfo.Cats.Application.Common.Validators; using Cfo.Cats.Application.SecurityConstants; -namespace Cfo.Cats.Application.Features.Objectives.Commands; +namespace Cfo.Cats.Application.Features.PathwayPlans.Commands; public static class EditObjective { @@ -12,6 +12,9 @@ public class Command : IRequest [Description("Objective Id")] public required Guid ObjectiveId { get; set; } + [Description("Pathway Plan Id")] + public required Guid PathwayPlanId { get; set; } + [Description("Title")] public required string Title { get; set; } } @@ -20,12 +23,11 @@ public class Handler(IUnitOfWork unitOfWork) : IRequestHandler { public async Task Handle(Command request, CancellationToken cancellationToken) { - var objective = await unitOfWork.DbContext.Objectives.FindAsync(request.ObjectiveId); + var pathwayPlan = await unitOfWork.DbContext.PathwayPlans.FindAsync(request.PathwayPlanId) + ?? throw new NotFoundException("Cannot find pathway plan", request.PathwayPlanId); - if (objective is null) - { - throw new NotFoundException("Cannot find objective", request.ObjectiveId); - } + var objective = pathwayPlan.Objectives.FirstOrDefault(o => o.Id == request.ObjectiveId) + ?? throw new NotFoundException("Cannot find objective", request.ObjectiveId); objective.Rename(request.Title); @@ -42,6 +44,9 @@ public Validator() RuleFor(x => x.ObjectiveId) .NotNull(); + RuleFor(x => x.PathwayPlanId) + .NotNull(); + RuleFor(x => x.Title) .NotEmpty() .WithMessage("You must provide a title") diff --git a/src/Application/Features/Objectives/Commands/EditTask.cs b/src/Application/Features/PathwayPlans/Commands/EditTask.cs similarity index 75% rename from src/Application/Features/Objectives/Commands/EditTask.cs rename to src/Application/Features/PathwayPlans/Commands/EditTask.cs index 28748cbc..71f4ac13 100644 --- a/src/Application/Features/Objectives/Commands/EditTask.cs +++ b/src/Application/Features/PathwayPlans/Commands/EditTask.cs @@ -1,9 +1,8 @@ using Cfo.Cats.Application.Common.Security; using Cfo.Cats.Application.Common.Validators; using Cfo.Cats.Application.SecurityConstants; -using Cfo.Cats.Domain.Entities.Participants; -namespace Cfo.Cats.Application.Features.Objectives.Commands; +namespace Cfo.Cats.Application.Features.PathwayPlans.Commands; public static class EditTask { @@ -16,6 +15,9 @@ public class Command : IRequest [Description("Objective Id")] public required Guid ObjectiveId { get; set; } + [Description("Pathway Plan Id")] + public required Guid PathwayPlanId { get; set; } + [Description("Title")] public string? Title { get; set; } @@ -27,19 +29,14 @@ public class Handler(IUnitOfWork unitOfWork) : IRequestHandler { public async Task Handle(Command request, CancellationToken cancellationToken) { - var objective = await unitOfWork.DbContext.Objectives.FindAsync(request.ObjectiveId); - - if (objective is null) - { - throw new NotFoundException("Cannot find objective", request.ObjectiveId); - } + var pathwayPlan = await unitOfWork.DbContext.PathwayPlans.FindAsync(request.PathwayPlanId) + ?? throw new NotFoundException("Cannot find pathway plan", request.PathwayPlanId); - var task = objective.Tasks.FirstOrDefault(x => x.Id == request.TaskId); + var objective = pathwayPlan.Objectives.FirstOrDefault(o => o.Id == request.ObjectiveId) + ?? throw new NotFoundException("Cannot find objective", request.ObjectiveId); - if (task is null) - { - throw new NotFoundException("Cannot find task", request.TaskId); - } + var task = objective.Tasks.FirstOrDefault(x => x.Id == request.TaskId) + ?? throw new NotFoundException("Cannot find task", request.TaskId); if(request.Title is not null) { @@ -67,6 +64,9 @@ public Validator() RuleFor(x => x.TaskId) .NotNull(); + RuleFor(x => x.PathwayPlanId) + .NotNull(); + RuleFor(x => x.Title) .NotEmpty() .WithMessage("You must provide a title") diff --git a/src/Application/Features/Objectives/Commands/ReviewObjective.cs b/src/Application/Features/PathwayPlans/Commands/ReviewObjective.cs similarity index 68% rename from src/Application/Features/Objectives/Commands/ReviewObjective.cs rename to src/Application/Features/PathwayPlans/Commands/ReviewObjective.cs index acb7b597..5523de2f 100644 --- a/src/Application/Features/Objectives/Commands/ReviewObjective.cs +++ b/src/Application/Features/PathwayPlans/Commands/ReviewObjective.cs @@ -1,13 +1,16 @@ using Cfo.Cats.Application.Common.Security; using Cfo.Cats.Application.SecurityConstants; -namespace Cfo.Cats.Application.Features.Objectives.Commands; +namespace Cfo.Cats.Application.Features.PathwayPlans.Commands; public static class ReviewObjective { [RequestAuthorize(Policy = SecurityPolicies.Enrol)] public class Command : IRequest { + [Description("Pathway Plan Id")] + public required Guid PathwayPlanId { get; set; } + [Description("Objective Id")] public required Guid ObjectiveId { get; set; } @@ -20,12 +23,11 @@ public class Handler(IUnitOfWork unitOfWork) : IRequestHandler { public async Task Handle(Command request, CancellationToken cancellationToken) { - var objective = await unitOfWork.DbContext.Objectives.FindAsync(request.ObjectiveId); + var pathwayPlan = await unitOfWork.DbContext.PathwayPlans.FindAsync(request.PathwayPlanId) + ?? throw new NotFoundException("Cannot find pathway plan", request.PathwayPlanId); - if (objective is null) - { - throw new NotFoundException("Cannot find objective", request.ObjectiveId); - } + var objective = pathwayPlan.Objectives.FirstOrDefault(o => o.Id == request.ObjectiveId) + ?? throw new NotFoundException("Cannot find objective", request.ObjectiveId); objective.Review(request.Reason, request.Justification); diff --git a/src/Application/Features/Objectives/Commands/ReviewTask.cs b/src/Application/Features/PathwayPlans/Commands/ReviewTask.cs similarity index 68% rename from src/Application/Features/Objectives/Commands/ReviewTask.cs rename to src/Application/Features/PathwayPlans/Commands/ReviewTask.cs index 5695530d..89cb1096 100644 --- a/src/Application/Features/Objectives/Commands/ReviewTask.cs +++ b/src/Application/Features/PathwayPlans/Commands/ReviewTask.cs @@ -2,7 +2,7 @@ using Cfo.Cats.Application.Common.Validators; using Cfo.Cats.Application.SecurityConstants; -namespace Cfo.Cats.Application.Features.Objectives.Commands; +namespace Cfo.Cats.Application.Features.PathwayPlans.Commands; public class ReviewTask { @@ -15,6 +15,9 @@ public class Command : IRequest [Description("Objective Id")] public required Guid ObjectiveId { get; set; } + [Description("Pathway Plan Id")] + public required Guid PathwayPlanId { get; set; } + [Description("Reason")] public CompletionStatus Reason { get; set; } = CompletionStatus.Done; @@ -26,21 +29,14 @@ public class Handler(IUnitOfWork unitOfWork) : IRequestHandler { public async Task Handle(Command request, CancellationToken cancellationToken) { - var objective = await unitOfWork.DbContext.Objectives - .FindAsync(request.ObjectiveId); - - if (objective is null) - { - throw new NotFoundException("Cannot find objective", request.ObjectiveId); - } + var pathwayPlan = await unitOfWork.DbContext.PathwayPlans.FindAsync(request.PathwayPlanId) + ?? throw new NotFoundException("Cannot find pathway plan", request.PathwayPlanId); - var task = objective.Tasks - .FirstOrDefault(task => task.Id == request.TaskId); + var objective = pathwayPlan.Objectives.FirstOrDefault(o => o.Id == request.ObjectiveId) + ?? throw new NotFoundException("Cannot find objective", request.ObjectiveId); - if (task is null) - { - throw new NotFoundException("Cannot find task", request.TaskId); - } + var task = objective.Tasks.FirstOrDefault(x => x.Id == request.TaskId) + ?? throw new NotFoundException("Cannot find task", request.TaskId); task.Review(request.Reason, request.Justification); @@ -58,6 +54,9 @@ public Validator() RuleFor(x => x.ObjectiveId) .NotNull(); + RuleFor(x => x.PathwayPlanId) + .NotNull(); + When(x => x.Reason.RequiresJustification, () => { RuleFor(x => x.Justification) diff --git a/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs b/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs similarity index 84% rename from src/Application/Features/Objectives/DTOs/ObjectiveDto.cs rename to src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs index 27b08fdc..c5b6d6a2 100644 --- a/src/Application/Features/Objectives/DTOs/ObjectiveDto.cs +++ b/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs @@ -1,11 +1,12 @@ using Cfo.Cats.Domain.Entities.Participants; -namespace Cfo.Cats.Application.Features.Objectives.DTOs; +namespace Cfo.Cats.Application.Features.PathwayPlans.DTOs; public class ObjectiveDto { public required Guid Id { get; set; } - public required string ParticipantId { get; set; } + public required Guid PathwayPlanId { get; set; } + public required string Title { get; set; } public DateTime? Completed { get; set; } public CompletionStatus? CompletedStatus { get; set; } diff --git a/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs b/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs similarity index 95% rename from src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs rename to src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs index 8f881b03..e2b3e879 100644 --- a/src/Application/Features/Objectives/DTOs/ObjectiveTaskDto.cs +++ b/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs @@ -1,12 +1,12 @@ using Cfo.Cats.Domain.Entities.Participants; -namespace Cfo.Cats.Application.Features.Objectives.DTOs; +namespace Cfo.Cats.Application.Features.PathwayPlans.DTOs; public class ObjectiveTaskDto { public required Guid Id { get; set; } - public required Guid ObjectiveId { get; set; } public required string Title { get; set; } + public required Guid ObjectiveId { get; set; } public required DateTime Due { get; set; } public required DateTime Created { get; set; } public DateTime? Completed { get; set; } diff --git a/src/Application/Features/PathwayPlans/DTOs/PathwayPlanDto.cs b/src/Application/Features/PathwayPlans/DTOs/PathwayPlanDto.cs new file mode 100644 index 00000000..d6b468c7 --- /dev/null +++ b/src/Application/Features/PathwayPlans/DTOs/PathwayPlanDto.cs @@ -0,0 +1,21 @@ +using Cfo.Cats.Domain.Entities.Participants; + +namespace Cfo.Cats.Application.Features.PathwayPlans.DTOs; + +public class PathwayPlanDto +{ + public required Guid Id { get; set; } + public required string ParticipantId { get; set; } + public required DateTime Created { get; set; } + public required string CreatedBy { get; set; } + public IEnumerable Objectives { get; set; } = []; + + public class Mapping : Profile + { + public Mapping() + { + CreateMap(); + } + + } +} diff --git a/src/Application/Features/PathwayPlans/DTOs/PathwayPlanSummaryDto.cs b/src/Application/Features/PathwayPlans/DTOs/PathwayPlanSummaryDto.cs new file mode 100644 index 00000000..227bdcfd --- /dev/null +++ b/src/Application/Features/PathwayPlans/DTOs/PathwayPlanSummaryDto.cs @@ -0,0 +1,29 @@ +using Cfo.Cats.Domain.Entities.Participants; + +namespace Cfo.Cats.Application.Features.PathwayPlans.DTOs; + +public class PathwayPlanSummaryDto +{ + public required DateTime Created { get; set; } + public required string CreatedBy { get; set; } + public DateTime? LastReviewed { get; set; } + public string? LastReviewedBy { get; set; } + + private class Mapping : Profile + { + public Mapping() + { + CreateMap(MemberList.None) + .ForMember(target => target.LastReviewed, options => + options.MapFrom(source => source.ReviewHistories + .OrderByDescending(history => history.Created) + .Select(history => history.Created) + .FirstOrDefault())) + .ForMember(target => target.LastReviewedBy, options => + options.MapFrom(source => source.ReviewHistories + .OrderByDescending(history => history.Created) + .Select(history => history.CreatedBy) + .FirstOrDefault())); + } + } +} diff --git a/src/Application/Features/Objectives/Queries/GetObjectivesByParticipantId.cs b/src/Application/Features/PathwayPlans/Queries/GetPathwayPlanByParticipantId.cs similarity index 53% rename from src/Application/Features/Objectives/Queries/GetObjectivesByParticipantId.cs rename to src/Application/Features/PathwayPlans/Queries/GetPathwayPlanByParticipantId.cs index 6b2f79c7..b940cb62 100644 --- a/src/Application/Features/Objectives/Queries/GetObjectivesByParticipantId.cs +++ b/src/Application/Features/PathwayPlans/Queries/GetPathwayPlanByParticipantId.cs @@ -1,29 +1,28 @@ using Cfo.Cats.Application.Common.Security; using Cfo.Cats.Application.Common.Validators; -using Cfo.Cats.Application.Features.Objectives.DTOs; +using Cfo.Cats.Application.Features.PathwayPlans.DTOs; using Cfo.Cats.Application.SecurityConstants; -namespace Cfo.Cats.Application.Features.Objectives.Queries; +namespace Cfo.Cats.Application.Features.PathwayPlans.Queries; -public static class GetObjectivesByParticipantId +public static class GetPathwayPlanByParticipantId { [RequestAuthorize(Policy = SecurityPolicies.Enrol)] - public class Query : IRequest> + public class Query : IRequest { public required string ParticipantId { get; set; } } - public class Handler(IUnitOfWork unitOfWork, IMapper mapper) : IRequestHandler> + public class Handler(IUnitOfWork unitOfWork, IMapper mapper) : IRequestHandler { - public async Task> Handle(Query request, CancellationToken cancellationToken) + public async Task Handle(Query request, CancellationToken cancellationToken) { - var objectives = await unitOfWork.DbContext.Objectives - .Where(o => o.ParticipantId == request.ParticipantId) - .Include(o => o.Tasks) - .ProjectTo(mapper.ConfigurationProvider) - .ToListAsync(cancellationToken) ?? []; + var pathwayPlan = await unitOfWork.DbContext.PathwayPlans + .Where(p => p.ParticipantId == request.ParticipantId) + .ProjectTo(mapper.ConfigurationProvider) + .SingleOrDefaultAsync(cancellationToken); - return objectives; + return pathwayPlan; } } diff --git a/src/Domain/Entities/Participants/Objective.cs b/src/Domain/Entities/Participants/Objective.cs index d27c2b8e..cc48c098 100644 --- a/src/Domain/Entities/Participants/Objective.cs +++ b/src/Domain/Entities/Participants/Objective.cs @@ -17,7 +17,7 @@ private Objective() public DateTime? Completed { get; set; } public CompletionStatus? CompletedStatus { get; set; } - public string ParticipantId { get; private set; } + public Guid PathwayPlanId { get; private set; } public string Title { get; private set; } @@ -50,12 +50,12 @@ public void Review(CompletionStatus status, string? justification) // AddDomainEvent } - public static Objective Create(string title, string participantId) + public static Objective Create(string title, Guid pathwayPlanId) { Objective objective = new() { Title = title, - ParticipantId = participantId + PathwayPlanId = pathwayPlanId }; objective.AddDomainEvent(new ObjectiveCreatedDomainEvent(objective)); diff --git a/src/Domain/Entities/Participants/PathwayPlan.cs b/src/Domain/Entities/Participants/PathwayPlan.cs new file mode 100644 index 00000000..7ec0009d --- /dev/null +++ b/src/Domain/Entities/Participants/PathwayPlan.cs @@ -0,0 +1,43 @@ +using Cfo.Cats.Domain.Common.Entities; +using Cfo.Cats.Domain.Events; + +namespace Cfo.Cats.Domain.Entities.Participants; + +public class PathwayPlan : BaseAuditableEntity +{ +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + private PathwayPlan() + { + } +#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + + private List _objectives = new(); + private List _reviewHistories = new(); + + public string ParticipantId { get; private set; } + + public IReadOnlyList Objectives => _objectives; + public IReadOnlyList ReviewHistories => _reviewHistories; + + public void AddObjective(Objective objective) + { + _objectives.Add(objective); + } + + public void Review() + { + var history = PathwayPlanReviewHistory.Create(Id); + _reviewHistories.Add(history); + } + + public static PathwayPlan Create(string participantId) + { + PathwayPlan pathwayPlan = new() + { + ParticipantId = participantId + }; + + return pathwayPlan; + } + +} diff --git a/src/Domain/Entities/Participants/PathwayPlanReviewHistory.cs b/src/Domain/Entities/Participants/PathwayPlanReviewHistory.cs new file mode 100644 index 00000000..03f39528 --- /dev/null +++ b/src/Domain/Entities/Participants/PathwayPlanReviewHistory.cs @@ -0,0 +1,25 @@ +using Cfo.Cats.Domain.Common.Entities; + +namespace Cfo.Cats.Domain.Entities.Participants; + +public class PathwayPlanReviewHistory : BaseAuditableEntity +{ +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + private PathwayPlanReviewHistory() + { + } +#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + + public Guid PathwayPlanId { get; private set; } + + public static PathwayPlanReviewHistory Create(Guid pathwayPlanId) + { + PathwayPlanReviewHistory history = new() + { + PathwayPlanId = pathwayPlanId + }; + + return history; + } + +} diff --git a/src/Infrastructure/Constants/Database/DatabaseConstants.cs b/src/Infrastructure/Constants/Database/DatabaseConstants.cs index 22283c37..b87f663a 100644 --- a/src/Infrastructure/Constants/Database/DatabaseConstants.cs +++ b/src/Infrastructure/Constants/Database/DatabaseConstants.cs @@ -31,6 +31,9 @@ public static class Tables public const string Risk = nameof(Risk); public const string Objective = nameof(Objective); public const string ObjectiveTask = nameof(ObjectiveTask); + public const string PathwayPlan = nameof(PathwayPlan); + public const string PathwayPlanReviewHistory = nameof(PathwayPlanReviewHistory); + public const string AssessmentPathwayScore = nameof(AssessmentPathwayScore); diff --git a/src/Infrastructure/Persistence/ApplicationDbContext.cs b/src/Infrastructure/Persistence/ApplicationDbContext.cs index 0219b12b..ab163e08 100644 --- a/src/Infrastructure/Persistence/ApplicationDbContext.cs +++ b/src/Infrastructure/Persistence/ApplicationDbContext.cs @@ -36,11 +36,8 @@ public ApplicationDbContext(DbContextOptions options) public DbSet Documents => Set(); public DbSet Participants => Set(); - + public DbSet PathwayPlans => Set(); public DbSet Risks => Set(); - public DbSet Objectives => Set(); - public DbSet ObjectiveTasks => Set(); - public DbSet ParticipantAssessments => Set(); public DbSet KeyValues => Set(); diff --git a/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs b/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs deleted file mode 100644 index 62c9e45e..00000000 --- a/src/Infrastructure/Persistence/Configurations/Participants/ObjectiveEntityTypeConfiguration.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Cfo.Cats.Domain.Common.Enums; -using Cfo.Cats.Domain.Entities.Participants; -using Cfo.Cats.Infrastructure.Constants.Database; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Cfo.Cats.Infrastructure.Persistence.Configurations.Participants; - -public class ObjectiveEntityTypeConfiguration - : IEntityTypeConfiguration - -{ - public void Configure(EntityTypeBuilder builder) - { - builder.ToTable( - DatabaseConstants.Tables.Objective, - DatabaseConstants.Schemas.Participant - ); - - builder.HasKey(o => o.Id); - - builder.Property(o => o.ParticipantId) - .HasMaxLength(DatabaseConstants.FieldLengths.ParticipantId) - .IsRequired(); - - builder.HasIndex(o => o.ParticipantId); - - builder.Property(o => o.CreatedBy) - .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); - - builder.Property(o => o.LastModifiedBy) - .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); - - builder.Property(t => t.CompletedStatus) - .HasConversion( - x => x!.Value, - x => CompletionStatus.FromValue(x) - ); - - builder.Navigation(e => e.Tasks).AutoInclude(); - - builder.OwnsMany(o => o.Tasks, task => - { - task.WithOwner() - .HasForeignKey(x => x.ObjectiveId); - - task.ToTable( - DatabaseConstants.Tables.ObjectiveTask, - DatabaseConstants.Schemas.Participant); - - task.HasKey(t => t.Id); - - task.Property(t => t.CreatedBy) - .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); - - task.Property(t => t.LastModifiedBy) - .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); - - task.Property(t => t.CompletedBy) - .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); - - task.HasOne(t => t.CompletedByUser) - .WithMany() - .HasForeignKey(t => t.CompletedBy); - - task.Property(t => t.CompletedStatus) - .HasConversion( - x => x!.Value, - x => CompletionStatus.FromValue(x) - ); - }); - } -} diff --git a/src/Infrastructure/Persistence/Configurations/Participants/PathwayPlanEntityTypeConfiguration.cs b/src/Infrastructure/Persistence/Configurations/Participants/PathwayPlanEntityTypeConfiguration.cs new file mode 100644 index 00000000..8bb80944 --- /dev/null +++ b/src/Infrastructure/Persistence/Configurations/Participants/PathwayPlanEntityTypeConfiguration.cs @@ -0,0 +1,114 @@ +using Cfo.Cats.Domain.Common.Enums; +using Cfo.Cats.Domain.Entities.Participants; +using Cfo.Cats.Infrastructure.Constants.Database; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using System.Security.AccessControl; + +namespace Cfo.Cats.Infrastructure.Persistence.Configurations.Participants; + +public class PathwayPlanEntityTypeConfiguration + : IEntityTypeConfiguration + +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable( + DatabaseConstants.Tables.PathwayPlan, + DatabaseConstants.Schemas.Participant + ); + + builder.HasKey(pathwayPlan => pathwayPlan.Id); + + builder.Property(pathwayPlan => pathwayPlan.ParticipantId) + .HasMaxLength(DatabaseConstants.FieldLengths.ParticipantId) + .IsRequired(); + + builder.HasIndex(pathwayPlan => pathwayPlan.ParticipantId); + + builder.Property(pathwayPlan => pathwayPlan.CreatedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + builder.Property(pathwayPlan => pathwayPlan.LastModifiedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + builder.OwnsMany(pathwayPlan => pathwayPlan.ReviewHistories, history => + { + history.ToTable( + DatabaseConstants.Tables.PathwayPlanReviewHistory, + DatabaseConstants.Schemas.Participant); + + history.WithOwner() + .HasForeignKey(history => history.PathwayPlanId); + + history.HasKey(history => history.Id); + + history.Property(history => history.CreatedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + history.Property(history => history.LastModifiedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + }); + + builder.Navigation(objective => objective.ReviewHistories).AutoInclude(); + + builder.OwnsMany(pathwayPlan => pathwayPlan.Objectives, objective => + { + objective.ToTable( + DatabaseConstants.Tables.Objective, + DatabaseConstants.Schemas.Participant); + + objective + .WithOwner() + .HasForeignKey(objective => objective.PathwayPlanId); + + objective.HasKey(objective => objective.Id); + + objective.Property(objective => objective.CreatedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + objective.Property(objective => objective.LastModifiedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + objective.Property(objective => objective.CompletedStatus) + .HasConversion( + x => x!.Value, + x => CompletionStatus.FromValue(x) + ); + + objective.OwnsMany(objective => objective.Tasks, task => + { + task.ToTable( + DatabaseConstants.Tables.ObjectiveTask, + DatabaseConstants.Schemas.Participant); + + task.WithOwner() + .HasForeignKey(task => task.ObjectiveId); + + task.HasKey(task => task.Id); + + task.Property(task => task.CreatedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + task.Property(task => task.LastModifiedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + task.Property(task => task.CompletedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + task.HasOne(task => task.CompletedByUser) + .WithMany() + .HasForeignKey(task => task.CompletedBy); + + task.Property(task => task.CompletedStatus) + .HasConversion( + x => x!.Value, + x => CompletionStatus.FromValue(x) + ); + }); + + objective.Navigation(objective => objective.Tasks).AutoInclude(); + }); + + builder.Navigation(pathwayPlan => pathwayPlan.Objectives).AutoInclude(); + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.Designer.cs new file mode 100644 index 00000000..cdbf3eb6 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.Designer.cs @@ -0,0 +1,2505 @@ +// +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("20240815140110_Objectives_v8")] + partial class Objectives_v8 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .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("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.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.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + 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("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .IsRequired() + .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("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("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.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.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.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + }); + + 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("CompletedStatus") + .HasColumnType("int"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + 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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("PathwayPlanId"); + + b1.ToTable("Objective", "Participant"); + + 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("Due") + .HasColumnType("datetime2"); + + 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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + 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("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/20240815140110_Objectives_v8.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.cs new file mode 100644 index 00000000..9d56304f --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.cs @@ -0,0 +1,144 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Objectives_v8 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_Objective_ParticipantId", + schema: "Participant", + table: "Objective"); + + migrationBuilder.DropColumn( + name: "ParticipantId", + schema: "Participant", + table: "Objective"); + + migrationBuilder.AddColumn( + name: "PathwayPlanId", + schema: "Participant", + table: "Objective", + type: "uniqueidentifier", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + + migrationBuilder.CreateTable( + name: "PathwayPlan", + schema: "Participant", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ParticipantId = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false), + Created = table.Column(type: "datetime2", nullable: true), + CreatedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), + LastModified = table.Column(type: "datetime2", nullable: true), + LastModifiedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PathwayPlan", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "PathwayPlanReviewHistory", + schema: "Participant", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + PathwayPlanId = table.Column(type: "uniqueidentifier", nullable: false), + Created = table.Column(type: "datetime2", nullable: true), + CreatedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), + LastModified = table.Column(type: "datetime2", nullable: true), + LastModifiedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PathwayPlanReviewHistory", x => x.Id); + table.ForeignKey( + name: "FK_PathwayPlanReviewHistory_PathwayPlan_PathwayPlanId", + column: x => x.PathwayPlanId, + principalSchema: "Participant", + principalTable: "PathwayPlan", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Objective_PathwayPlanId", + schema: "Participant", + table: "Objective", + column: "PathwayPlanId"); + + migrationBuilder.CreateIndex( + name: "IX_PathwayPlan_ParticipantId", + schema: "Participant", + table: "PathwayPlan", + column: "ParticipantId"); + + migrationBuilder.CreateIndex( + name: "IX_PathwayPlanReviewHistory_PathwayPlanId", + schema: "Participant", + table: "PathwayPlanReviewHistory", + column: "PathwayPlanId"); + + migrationBuilder.AddForeignKey( + name: "FK_Objective_PathwayPlan_PathwayPlanId", + schema: "Participant", + table: "Objective", + column: "PathwayPlanId", + principalSchema: "Participant", + principalTable: "PathwayPlan", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Objective_PathwayPlan_PathwayPlanId", + schema: "Participant", + table: "Objective"); + + migrationBuilder.DropTable( + name: "PathwayPlanReviewHistory", + schema: "Participant"); + + migrationBuilder.DropTable( + name: "PathwayPlan", + schema: "Participant"); + + migrationBuilder.DropIndex( + name: "IX_Objective_PathwayPlanId", + schema: "Participant", + table: "Objective"); + + migrationBuilder.DropColumn( + name: "PathwayPlanId", + schema: "Participant", + table: "Objective"); + + migrationBuilder.AddColumn( + name: "ParticipantId", + schema: "Participant", + table: "Objective", + type: "nvarchar(9)", + maxLength: 9, + nullable: false, + defaultValue: ""); + + migrationBuilder.CreateIndex( + name: "IX_Objective_ParticipantId", + schema: "Participant", + table: "Objective", + column: "ParticipantId"); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs index 95132cce..2a15a603 100644 --- a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs @@ -595,51 +595,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Qa2Queue", "Enrolment"); }); - modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Objective", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Completed") - .HasColumnType("datetime2"); - - b.Property("CompletedStatus") - .HasColumnType("int"); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("Justification") - .HasColumnType("nvarchar(max)"); - - b.Property("LastModified") - .HasColumnType("datetime2"); - - b.Property("LastModifiedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("ParticipantId") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("nvarchar(9)"); - - b.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ParticipantId"); - - b.ToTable("Objective", "Participant"); - }); - modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => { b.Property("Id") @@ -761,6 +716,38 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -1895,72 +1882,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Tenant"); }); - modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Objective", b => - { - b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", 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("Due") - .HasColumnType("datetime2"); - - b1.Property("Justification") - .HasColumnType("nvarchar(max)"); - - b1.Property("LastModified") - .HasColumnType("datetime2"); - - b1.Property("LastModifiedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("ObjectiveId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("Id"); - - b1.HasIndex("CompletedBy"); - - b1.HasIndex("ObjectiveId"); - - b1.ToTable("ObjectiveTask", "Participant"); - - b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") - .WithMany() - .HasForeignKey("CompletedBy"); - - b1.WithOwner() - .HasForeignKey("ObjectiveId"); - - b1.Navigation("CompletedByUser"); - }); - - b.Navigation("Tasks"); - }); - modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => { b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") @@ -2209,6 +2130,155 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("RightToWorks"); }); + 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("CompletedStatus") + .HasColumnType("int"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + 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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("PathwayPlanId"); + + b1.ToTable("Objective", "Participant"); + + 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("Due") + .HasColumnType("datetime2"); + + 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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + 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("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) diff --git a/src/Server.UI/Pages/Objectives/AddObjectiveDialog.razor b/src/Server.UI/Pages/Objectives/AddObjectiveDialog.razor index b865feb4..71abf76e 100644 --- a/src/Server.UI/Pages/Objectives/AddObjectiveDialog.razor +++ b/src/Server.UI/Pages/Objectives/AddObjectiveDialog.razor @@ -1,4 +1,4 @@ -@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Application.Features.PathwayPlans.Commands @inherits CatsComponentBase diff --git a/src/Server.UI/Pages/Objectives/Objective.razor b/src/Server.UI/Pages/Objectives/Objective.razor index a3c1d580..6102fd67 100644 --- a/src/Server.UI/Pages/Objectives/Objective.razor +++ b/src/Server.UI/Pages/Objectives/Objective.razor @@ -1,6 +1,6 @@ -@using Cfo.Cats.Application.Features.Objectives.Commands -@using Cfo.Cats.Application.Features.Objectives.DTOs -@using Cfo.Cats.Application.Features.Objectives.Queries +@using Cfo.Cats.Application.Features.PathwayPlans.Commands +@using Cfo.Cats.Application.Features.PathwayPlans.DTOs +@using Cfo.Cats.Application.Features.PathwayPlans.Queries @using Cfo.Cats.Domain.Common.Enums @using Cfo.Cats.Server.UI.Pages.Objectives @using Cfo.Cats.Server.UI.Pages.Objectives.Tasks @@ -46,7 +46,7 @@ .Where(task => task.IsCompleted is false || HideCompletedTasks is false) .OrderBy(task => task.Created)) { - + }
@@ -66,48 +66,17 @@ [Parameter, EditorRequired] public required ObjectiveDto Model { get; set; } - [Parameter, EditorRequired] - public required string ParticipantId { get; set; } - [Parameter, EditorRequired] public required bool HideCompletedTasks { get; set; } [Parameter] public EventCallback OnChange { get; set; } - public async Task AddObjective() - { - var command = new AddObjective.Command() - { - ParticipantId = ParticipantId - }; - - var parameters = new DialogParameters() - { - { x => x.Model, command } - }; - - var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; - var dialog = DialogService.Show("Add objective", parameters, options); - - var state = await dialog.Result; - - if (state!.Canceled is false) - { - var result = await GetNewMediator().Send(command); - - if (result.Succeeded) - { - await OnChange.InvokeAsync(); - } - - } - } - public async Task Review() { var command = new ReviewObjective.Command() { + PathwayPlanId = Model.PathwayPlanId, ObjectiveId = Model.Id }; @@ -137,6 +106,7 @@ { var command = new AddTask.Command() { + PathwayPlanId = Model.PathwayPlanId, ObjectiveId = Model.Id }; @@ -166,6 +136,7 @@ { var command = new EditObjective.Command() { + PathwayPlanId = Model.PathwayPlanId, ObjectiveId = Model.Id, Title = Model.Title }; diff --git a/src/Server.UI/Pages/Objectives/RenameObjectiveDialog.razor b/src/Server.UI/Pages/Objectives/RenameObjectiveDialog.razor index 385b1565..d5600ec5 100644 --- a/src/Server.UI/Pages/Objectives/RenameObjectiveDialog.razor +++ b/src/Server.UI/Pages/Objectives/RenameObjectiveDialog.razor @@ -1,4 +1,4 @@ -@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Application.Features.PathwayPlans.Commands @inherits CatsComponentBase diff --git a/src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor b/src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor index eb3df570..32ec01a4 100644 --- a/src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor +++ b/src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor @@ -1,4 +1,4 @@ -@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Application.Features.PathwayPlans.Commands @using Cfo.Cats.Domain.Common.Enums @inherits CatsComponentBase diff --git a/src/Server.UI/Pages/Objectives/Tasks/AddTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/AddTaskDialog.razor index 441108bf..b49298fc 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/AddTaskDialog.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/AddTaskDialog.razor @@ -1,4 +1,4 @@ -@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Application.Features.PathwayPlans.Commands @inherits CatsComponentBase diff --git a/src/Server.UI/Pages/Objectives/Tasks/ExtendDateTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/ExtendDateTaskDialog.razor index 35b2e75e..c5545ffa 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/ExtendDateTaskDialog.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/ExtendDateTaskDialog.razor @@ -1,4 +1,4 @@ -@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Application.Features.PathwayPlans.Commands @inherits CatsComponentBase diff --git a/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor index f3c466f0..7b140b35 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor @@ -1,5 +1,5 @@ -@using Cfo.Cats.Application.Features.Objectives.Commands -@using Cfo.Cats.Application.Features.Objectives.DTOs +@using Cfo.Cats.Application.Features.PathwayPlans.Commands +@using Cfo.Cats.Application.Features.PathwayPlans.DTOs @using Cfo.Cats.Domain.Common.Enums @using Humanizer @@ -102,6 +102,9 @@ [Parameter, EditorRequired] public required ObjectiveTaskDto Model { get; set; } + [Parameter, EditorRequired] + public required Guid PathwayPlanId { get; set; } + [Parameter] public EventCallback OnChange { get; set; } @@ -110,7 +113,8 @@ var command = new ReviewTask.Command() { TaskId = Model.Id, - ObjectiveId = Model.ObjectiveId + ObjectiveId = Model.ObjectiveId, + PathwayPlanId = PathwayPlanId }; var parameters = new DialogParameters() @@ -142,7 +146,8 @@ TaskId = Model.Id, ObjectiveId = Model.ObjectiveId, Title = Model.Title, - Due = Model.Due + Due = Model.Due, + PathwayPlanId = PathwayPlanId }; var parameters = new DialogParameters() @@ -174,7 +179,8 @@ TaskId = Model.Id, ObjectiveId = Model.ObjectiveId, Title = Model.Title, - Due = Model.Due + Due = Model.Due, + PathwayPlanId = PathwayPlanId }; var parameters = new DialogParameters() diff --git a/src/Server.UI/Pages/Objectives/Tasks/RenameTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/RenameTaskDialog.razor index 2731cf52..8460f582 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/RenameTaskDialog.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/RenameTaskDialog.razor @@ -1,4 +1,4 @@ -@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Application.Features.PathwayPlans.Commands @inherits CatsComponentBase diff --git a/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor index 464f0041..0fd3c93b 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/ReviewTaskDialog.razor @@ -1,4 +1,4 @@ -@using Cfo.Cats.Application.Features.Objectives.Commands +@using Cfo.Cats.Application.Features.PathwayPlans.Commands @using Cfo.Cats.Domain.Common.Enums @inherits CatsComponentBase diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index 82c8269b..1d832bff 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -1,6 +1,6 @@ -@using Cfo.Cats.Application.Features.Objectives.Commands -@using Cfo.Cats.Application.Features.Objectives.DTOs -@using Cfo.Cats.Application.Features.Objectives.Queries +@using Cfo.Cats.Application.Features.PathwayPlans.Commands +@using Cfo.Cats.Application.Features.PathwayPlans.DTOs +@using Cfo.Cats.Application.Features.PathwayPlans.Queries @using Cfo.Cats.Domain.Common.Enums @using Cfo.Cats.Server.UI.Pages.Objectives @using Cfo.Cats.Server.UI.Pages.Objectives.Tasks @@ -20,40 +20,48 @@ -
- +
+ + + + New objective + + Reviewed Pathway Plan +
+
+ Date added Title No. of outstanding tasks - + Ascending Descending
- - + +
-
- - - - New objective -
- @foreach (var objective in Model + @foreach (var objective in Model.Objectives .Where(objective => objective.IsCompleted is false || hideCompletedObjectives is false) .OrderByDirection(sortDirection, selectors[selector])) { - + } } +else +{ + + No pathway plan found. + +} @code { private bool hideCompletedObjectives = false; @@ -72,7 +80,7 @@ [Parameter, EditorRequired] public required string ParticipantId { get; set; } - public IEnumerable? Model { get; set; } + public PathwayPlanDto? Model { get; set; } protected override async Task OnInitializedAsync() { @@ -82,17 +90,17 @@ private async Task OnRefresh() { - Model = await GetNewMediator().Send(new GetObjectivesByParticipantId.Query() + Model = await GetNewMediator().Send(new GetPathwayPlanByParticipantId.Query() { ParticipantId = ParticipantId - }); + }); } public async Task AddObjective() { var command = new AddObjective.Command() { - ParticipantId = ParticipantId + PathwayPlanId = Model!.Id }; var parameters = new DialogParameters() diff --git a/src/Server.UI/Pages/Participants/Components/CaseSummary.razor b/src/Server.UI/Pages/Participants/Components/CaseSummary.razor index aa0717cd..03370ff1 100644 --- a/src/Server.UI/Pages/Participants/Components/CaseSummary.razor +++ b/src/Server.UI/Pages/Participants/Components/CaseSummary.razor @@ -129,4 +129,66 @@ + + + + +
+ Pathway Plan +
+
+
+ + @if (HasPathwayPlan) + { +
+
+
+
+ Last Reviewed +
+
+ @if (HasPathwayBeenReviewed) + { + + + @ParticipantSummaryDto.PathwayPlan!.LastReviewed!.Value.Humanize() + + + } + else + { + Never + } +
+
+ @if (HasPathwayBeenReviewed) + { +
+
+ Reviewed By +
+
+ @UserService.DataSource.First(u => u.Id == ParticipantSummaryDto.PathwayPlan!.LastReviewedBy!).DisplayName +
+
+ } +
+
+ } + else + { + No pathway plan found. + } +
+ + @if (HasPathwayPlan) + { + + + + } + +
+
\ No newline at end of file diff --git a/src/Server.UI/Pages/Participants/Components/CaseSummary.razor.cs b/src/Server.UI/Pages/Participants/Components/CaseSummary.razor.cs index 08f17ea0..dfe7213b 100644 --- a/src/Server.UI/Pages/Participants/Components/CaseSummary.razor.cs +++ b/src/Server.UI/Pages/Participants/Components/CaseSummary.razor.cs @@ -2,6 +2,7 @@ using Cfo.Cats.Application.Features.Assessments.Commands; using Cfo.Cats.Application.Features.Participants.Commands; using Cfo.Cats.Application.Features.Participants.DTOs; +using Cfo.Cats.Application.Features.PathwayPlans.Commands; using Cfo.Cats.Domain.Common.Enums; using Cfo.Cats.Server.UI.Pages.Risk; @@ -150,4 +151,12 @@ public async Task ExpandRiskInformation() var result = await dialog.Result; } + private bool HasPathwayPlan => ParticipantSummaryDto.PathwayPlan is not null; + private bool HasPathwayBeenReviewed => HasPathwayPlan && ParticipantSummaryDto.PathwayPlan?.LastReviewed is not null; + + public async Task ReviewPathwayPlan() + { + await Task.CompletedTask; + } + } From 551fdfe814d4bdc796c1d3386509f5be885edf89 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Thu, 15 Aug 2024 18:17:22 +0100 Subject: [PATCH 15/35] CatsComponentBase - OnUpdate propagation --- src/Server.UI/Components/CatsComponentBase.cs | 3 +++ src/Server.UI/Pages/Participants/Participant.razor | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Server.UI/Components/CatsComponentBase.cs b/src/Server.UI/Components/CatsComponentBase.cs index 5c6ebf5e..23e44d22 100644 --- a/src/Server.UI/Components/CatsComponentBase.cs +++ b/src/Server.UI/Components/CatsComponentBase.cs @@ -7,6 +7,9 @@ public abstract class CatsComponentBase : OwningComponentBase private readonly List _scopes = new(); private bool _disposed = false; + + [Parameter] + public EventCallback OnUpdate { get; set; } = new EventCallback(); protected IMediator GetNewMediator() { diff --git a/src/Server.UI/Pages/Participants/Participant.razor b/src/Server.UI/Pages/Participants/Participant.razor index 3290f116..35910166 100644 --- a/src/Server.UI/Pages/Participants/Participant.razor +++ b/src/Server.UI/Pages/Participants/Participant.razor @@ -91,7 +91,7 @@ - + @@ -120,13 +120,19 @@ @code { [Parameter] public string Id { get; set; } = default!; - + [CascadingParameter] public UserProfile UserProfile { get; set; } = default!; private ParticipantSummaryDto? _participant = null; protected override async Task OnInitializedAsync() + { + await Refresh(); + await base.OnInitializedAsync(); + } + + private async Task Refresh() { _participant = await GetNewMediator().Send(new GetParticipantSummary.Query() { From 2ff9b0203c0cea1825177fc517886a3fcebbf460 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Thu, 15 Aug 2024 18:17:51 +0100 Subject: [PATCH 16/35] Add pathway plan --- .../Components/CasePathwayPlan.razor | 41 ++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index 1d832bff..2a1cb4e4 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -58,12 +58,18 @@ } else { - - No pathway plan found. - + + + No action plan found. Would you like to create one now? +
+ Action Plan +
+
+
} @code { + private bool loading; private bool hideCompletedObjectives = false; private bool hideCompletedTasks = false; @@ -90,10 +96,35 @@ else private async Task OnRefresh() { - Model = await GetNewMediator().Send(new GetPathwayPlanByParticipantId.Query() + loading = true; + + try + { + Model = await GetNewMediator().Send(new GetPathwayPlanByParticipantId.Query() + { + ParticipantId = ParticipantId + }); + } + finally + { + loading = false; + } + } + + public async Task AddPathwayPlan() + { + var command = new AddPathwayPlan.Command() { ParticipantId = ParticipantId - }); + }; + + var result = await GetNewMediator().Send(command); + + if(result.Succeeded) + { + await OnRefresh(); + await OnUpdate.InvokeAsync(); + } } public async Task AddObjective() From 418e15ae2b29934599165c167c36260c26e9ff27 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Thu, 15 Aug 2024 18:43:20 +0100 Subject: [PATCH 17/35] Pathway plan review command --- .../Commands/ReviewPathwayPlan.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Application/Features/PathwayPlans/Commands/ReviewPathwayPlan.cs diff --git a/src/Application/Features/PathwayPlans/Commands/ReviewPathwayPlan.cs b/src/Application/Features/PathwayPlans/Commands/ReviewPathwayPlan.cs new file mode 100644 index 00000000..85dd8dba --- /dev/null +++ b/src/Application/Features/PathwayPlans/Commands/ReviewPathwayPlan.cs @@ -0,0 +1,40 @@ +using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.SecurityConstants; + +namespace Cfo.Cats.Application.Features.PathwayPlans.Commands; + +public static class ReviewPathwayPlan +{ + [RequestAuthorize(Policy = SecurityPolicies.Enrol)] + public class Command : IRequest + { + public required Guid PathwayPlanId { get; set; } + } + + public class Handler(IUnitOfWork unitOfWork) : IRequestHandler + { + public async Task Handle(Command request, CancellationToken cancellationToken) + { + var pathwayPlan = await unitOfWork.DbContext.PathwayPlans.FirstOrDefaultAsync(x => x.Id == request.PathwayPlanId); + + if(pathwayPlan is null) + { + throw new NotFoundException("Cannot find pathway plan", request.PathwayPlanId); + } + + pathwayPlan.Review(); + + return Result.Success(); + } + } + + public class Validator : AbstractValidator + { + public Validator() + { + RuleFor(x => x.PathwayPlanId) + .NotNull(); + } + + } +} From 79b3c2ec3861986c247e2e0a46e97284ad556790 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 16 Aug 2024 12:57:24 +0100 Subject: [PATCH 18/35] Pathway plan review functionality + case summary information --- .../PathwayPlans/DTOs/PathwayPlanDto.cs | 14 ++++- .../Queries/GetPathwayPlanByParticipantId.cs | 1 + .../Components/CasePathwayPlan.razor | 51 +++++++++++++++--- .../Participants/Components/CaseSummary.razor | 52 +++++++++++++------ 4 files changed, 94 insertions(+), 24 deletions(-) diff --git a/src/Application/Features/PathwayPlans/DTOs/PathwayPlanDto.cs b/src/Application/Features/PathwayPlans/DTOs/PathwayPlanDto.cs index d6b468c7..0fb742e1 100644 --- a/src/Application/Features/PathwayPlans/DTOs/PathwayPlanDto.cs +++ b/src/Application/Features/PathwayPlans/DTOs/PathwayPlanDto.cs @@ -8,13 +8,25 @@ public class PathwayPlanDto public required string ParticipantId { get; set; } public required DateTime Created { get; set; } public required string CreatedBy { get; set; } + public DateTime? LastReviewed { get; set; } + public string? LastReviewedBy { get; set; } public IEnumerable Objectives { get; set; } = []; public class Mapping : Profile { public Mapping() { - CreateMap(); + CreateMap() + .ForMember(target => target.LastReviewed, options => + options.MapFrom(source => source.ReviewHistories + .OrderByDescending(history => history.Created) + .Select(history => history.Created) + .FirstOrDefault())) + .ForMember(target => target.LastReviewedBy, options => + options.MapFrom(source => source.ReviewHistories + .OrderByDescending(history => history.Created) + .Select(history => history.CreatedBy) + .FirstOrDefault())); } } diff --git a/src/Application/Features/PathwayPlans/Queries/GetPathwayPlanByParticipantId.cs b/src/Application/Features/PathwayPlans/Queries/GetPathwayPlanByParticipantId.cs index b940cb62..dae8f9d7 100644 --- a/src/Application/Features/PathwayPlans/Queries/GetPathwayPlanByParticipantId.cs +++ b/src/Application/Features/PathwayPlans/Queries/GetPathwayPlanByParticipantId.cs @@ -18,6 +18,7 @@ public class Handler(IUnitOfWork unitOfWork, IMapper mapper) : IRequestHandler Handle(Query request, CancellationToken cancellationToken) { var pathwayPlan = await unitOfWork.DbContext.PathwayPlans + .Include(p => p.ReviewHistories) .Where(p => p.ParticipantId == request.ParticipantId) .ProjectTo(mapper.ConfigurationProvider) .SingleOrDefaultAsync(cancellationToken); diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index 2a1cb4e4..e9168b1a 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -19,14 +19,20 @@ { - +
New objective - Reviewed Pathway Plan +
+ Review Pathway Plan + @if(Model.LastReviewed.HasValue) + { + Last reviewed @Model.LastReviewed.Value.Humanize() + } +
@@ -50,7 +56,7 @@ .Where(objective => objective.IsCompleted is false || hideCompletedObjectives is false) .OrderByDirection(sortDirection, selectors[selector])) { - + } @@ -90,11 +96,11 @@ else protected override async Task OnInitializedAsync() { - await OnRefresh(); + await OnRefresh(firstRender: true); await base.OnInitializedAsync(); } - private async Task OnRefresh() + private async Task OnRefresh(bool firstRender = false) { loading = true; @@ -104,6 +110,11 @@ else { ParticipantId = ParticipantId }); + + if(firstRender is false) + { + await OnUpdate.InvokeAsync(); // Bubble update, refreshing participant information + } } finally { @@ -123,7 +134,6 @@ else if(result.Succeeded) { await OnRefresh(); - await OnUpdate.InvokeAsync(); } } @@ -155,4 +165,33 @@ else } } + + public async Task ReviewPathwayPlan() + { + var command = new ReviewPathwayPlan.Command() + { + PathwayPlanId = Model!.Id + }; + + var state = await DialogService.ShowMessageBox( + title: "Review Pathway", + message: "I confirm I have reviewed all objectives/tasks and they are still relevant to the participants' pathway plan.", + options: new DialogOptions + { + MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true + }, + yesText: "Review", + cancelText: "Cancel"); + + if(state is true) + { + var result = await GetNewMediator().Send(command); + + if (result.Succeeded) + { + await OnRefresh(); + } + } + + } } diff --git a/src/Server.UI/Pages/Participants/Components/CaseSummary.razor b/src/Server.UI/Pages/Participants/Components/CaseSummary.razor index 03370ff1..af8cfa1f 100644 --- a/src/Server.UI/Pages/Participants/Components/CaseSummary.razor +++ b/src/Server.UI/Pages/Participants/Components/CaseSummary.razor @@ -144,35 +144,53 @@
-
- Last Reviewed -
-
- @if (HasPathwayBeenReviewed) - { + @if(HasPathwayBeenReviewed) + { +
+ Last Reviewed +
+
@ParticipantSummaryDto.PathwayPlan!.LastReviewed!.Value.Humanize() - } - else - { - Never - } -
+ + } + else + { +
+ Date Created +
+
+ + + @ParticipantSummaryDto.PathwayPlan!.Created.Humanize() + + +
+ }
- @if (HasPathwayBeenReviewed) - { -
+
+ @if(HasPathwayBeenReviewed) + {
Reviewed By
@UserService.DataSource.First(u => u.Id == ParticipantSummaryDto.PathwayPlan!.LastReviewedBy!).DisplayName
-
- } + } + else + { +
+ Created By +
+
+ @UserService.DataSource.First(u => u.Id == ParticipantSummaryDto.PathwayPlan!.CreatedBy).DisplayName +
+ } +
} From 5086eae1ae5e08c02357697dda7805228be78065 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 16 Aug 2024 13:05:22 +0100 Subject: [PATCH 19/35] Remove review action from case summary --- .../Pages/Participants/Components/CaseSummary.razor | 8 -------- .../Pages/Participants/Components/CaseSummary.razor.cs | 5 ----- 2 files changed, 13 deletions(-) diff --git a/src/Server.UI/Pages/Participants/Components/CaseSummary.razor b/src/Server.UI/Pages/Participants/Components/CaseSummary.razor index af8cfa1f..c3f0290d 100644 --- a/src/Server.UI/Pages/Participants/Components/CaseSummary.razor +++ b/src/Server.UI/Pages/Participants/Components/CaseSummary.razor @@ -199,14 +199,6 @@ No pathway plan found. } - - @if (HasPathwayPlan) - { - - - - } - \ No newline at end of file diff --git a/src/Server.UI/Pages/Participants/Components/CaseSummary.razor.cs b/src/Server.UI/Pages/Participants/Components/CaseSummary.razor.cs index dfe7213b..57175d56 100644 --- a/src/Server.UI/Pages/Participants/Components/CaseSummary.razor.cs +++ b/src/Server.UI/Pages/Participants/Components/CaseSummary.razor.cs @@ -154,9 +154,4 @@ public async Task ExpandRiskInformation() private bool HasPathwayPlan => ParticipantSummaryDto.PathwayPlan is not null; private bool HasPathwayBeenReviewed => HasPathwayPlan && ParticipantSummaryDto.PathwayPlan?.LastReviewed is not null; - public async Task ReviewPathwayPlan() - { - await Task.CompletedTask; - } - } From b12a3386bc3072a076d41ecb8b765c7b6ad71ae5 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 16 Aug 2024 13:59:01 +0100 Subject: [PATCH 20/35] Fix typos and ensure immutability in objectives --- src/Domain/Entities/Participants/Objective.cs | 6 +++--- .../Pages/Participants/Components/CasePathwayPlan.razor | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Domain/Entities/Participants/Objective.cs b/src/Domain/Entities/Participants/Objective.cs index cc48c098..7c604e88 100644 --- a/src/Domain/Entities/Participants/Objective.cs +++ b/src/Domain/Entities/Participants/Objective.cs @@ -1,4 +1,4 @@ -using Cfo.Cats.Domain.Common.Entities; +using Cfo.Cats.Domain.Common.Entities; using Cfo.Cats.Domain.Common.Enums; using Cfo.Cats.Domain.Events; @@ -14,8 +14,8 @@ private Objective() private List _tasks = new(); - public DateTime? Completed { get; set; } - public CompletionStatus? CompletedStatus { get; set; } + public DateTime? Completed { get; private set; } + public CompletionStatus? CompletedStatus { get; private set; } public Guid PathwayPlanId { get; private set; } diff --git a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor index e9168b1a..61f0c008 100644 --- a/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor +++ b/src/Server.UI/Pages/Participants/Components/CasePathwayPlan.razor @@ -66,9 +66,9 @@ else { - No action plan found. Would you like to create one now? + No pathway plan found. Would you like to create one now?
- Action Plan + Pathway Plan
From 818436edd1d1dde4b8cb1cb109ef1608169dc92a Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 16 Aug 2024 13:59:40 +0100 Subject: [PATCH 21/35] Identifiers for objectives/tasks --- .../PathwayPlans/DTOs/ObjectiveDto.cs | 4 +- .../PathwayPlans/DTOs/ObjectiveTaskDto.cs | 7 +- src/Domain/Entities/Participants/Objective.cs | 12 +- .../Entities/Participants/ObjectiveTask.cs | 10 +- .../Entities/Participants/PathwayPlan.cs | 2 +- .../20240816124115_Objectives_v9.Designer.cs | 2511 +++++++++++++++++ .../20240816124115_Objectives_v9.cs | 44 + .../ApplicationDbContextModelSnapshot.cs | 6 + .../Pages/Objectives/Objective.razor | 2 +- .../Objectives/Tasks/ObjectiveTask.razor | 2 +- 10 files changed, 2587 insertions(+), 13 deletions(-) create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.Designer.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.cs diff --git a/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs b/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs index c5b6d6a2..ea7e4060 100644 --- a/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs +++ b/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs @@ -6,14 +6,14 @@ public class ObjectiveDto { public required Guid Id { get; set; } public required Guid PathwayPlanId { get; set; } - public required string Title { get; set; } public DateTime? Completed { get; set; } public CompletionStatus? CompletedStatus { get; set; } public required DateTime Created { get; set; } public IEnumerable Tasks { get; set; } = []; public string? Justification { get; set; } - + public required int Index { get; set; } + public string DisplayName => $"{Index}. {Title}"; public bool IsCompleted => Completed.HasValue; public class Mapping : Profile diff --git a/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs b/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs index e2b3e879..d5f120b3 100644 --- a/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs +++ b/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs @@ -10,9 +10,9 @@ public class ObjectiveTaskDto public required DateTime Due { get; set; } public required DateTime Created { get; set; } public DateTime? Completed { get; set; } - public string? CompletedByName { get; set; } - public CompletionStatus? CompletedStatus { get; set; } + public required int Index { get; set; } + public string DisplayName => $"{Index}. {Title}"; public bool IsCompleted => Completed.HasValue; public bool IsOverdue => IsCompleted is false && (ToFirstDayOfMonth(DateTime.UtcNow) > ToFirstDayOfMonth(Due)); @@ -25,8 +25,7 @@ public class Mapping : Profile { public Mapping() { - CreateMap() - .ForMember(target => target.CompletedByName, options => options.MapFrom(source => source.CompletedByUser!.DisplayName)); + CreateMap(); } } diff --git a/src/Domain/Entities/Participants/Objective.cs b/src/Domain/Entities/Participants/Objective.cs index 7c604e88..1aa8ad9d 100644 --- a/src/Domain/Entities/Participants/Objective.cs +++ b/src/Domain/Entities/Participants/Objective.cs @@ -1,4 +1,4 @@ -using Cfo.Cats.Domain.Common.Entities; +using Cfo.Cats.Domain.Common.Entities; using Cfo.Cats.Domain.Common.Enums; using Cfo.Cats.Domain.Events; @@ -17,6 +17,8 @@ private Objective() public DateTime? Completed { get; private set; } public CompletionStatus? CompletedStatus { get; private set; } + public int Index { get; private set; } + public Guid PathwayPlanId { get; private set; } public string Title { get; private set; } @@ -27,11 +29,17 @@ private Objective() public Objective AddTask(ObjectiveTask task) { - _tasks.Add(task); + _tasks.Add(task.AtIndex(_tasks.Count + 1)); AddDomainEvent(new ObjectiveTaskAddedToObjectiveDomainEvent(this, task)); return this; } + public Objective AtIndex(int index) + { + Index = index; + return this; + } + public void Rename(string title) { Title = title; diff --git a/src/Domain/Entities/Participants/ObjectiveTask.cs b/src/Domain/Entities/Participants/ObjectiveTask.cs index 20e71a69..cc42eed1 100644 --- a/src/Domain/Entities/Participants/ObjectiveTask.cs +++ b/src/Domain/Entities/Participants/ObjectiveTask.cs @@ -1,4 +1,4 @@ -using Cfo.Cats.Domain.Common.Entities; +using Cfo.Cats.Domain.Common.Entities; using Cfo.Cats.Domain.Common.Enums; using Cfo.Cats.Domain.Events; using Cfo.Cats.Domain.Identity; @@ -43,11 +43,17 @@ public void Rename(string title) Title = title; } + public ObjectiveTask AtIndex(int index) + { + Index = index; + return this; + } + public DateTime Due { get; private set; } public DateTime? Completed { get; private set; } public string? CompletedBy { get; private set; } public CompletionStatus? CompletedStatus { get; private set; } - + public int Index { get; private set; } public string? Justification { get; private set; } public Guid ObjectiveId { get; private set; } public string Title { get; private set; } diff --git a/src/Domain/Entities/Participants/PathwayPlan.cs b/src/Domain/Entities/Participants/PathwayPlan.cs index 7ec0009d..4558f5de 100644 --- a/src/Domain/Entities/Participants/PathwayPlan.cs +++ b/src/Domain/Entities/Participants/PathwayPlan.cs @@ -21,7 +21,7 @@ private PathwayPlan() public void AddObjective(Objective objective) { - _objectives.Add(objective); + _objectives.Add(objective.AtIndex(_objectives.Count + 1)); } public void Review() diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.Designer.cs new file mode 100644 index 00000000..68326e44 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.Designer.cs @@ -0,0 +1,2511 @@ +// +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("20240816124115_Objectives_v9")] + partial class Objectives_v9 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .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("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.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.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + 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("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .IsRequired() + .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("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("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.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.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.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + }); + + 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("CompletedStatus") + .HasColumnType("int"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + 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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("PathwayPlanId"); + + b1.ToTable("Objective", "Participant"); + + 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("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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + 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("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/20240816124115_Objectives_v9.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.cs new file mode 100644 index 00000000..116e272e --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.cs @@ -0,0 +1,44 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Objectives_v9 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Index", + schema: "Participant", + table: "ObjectiveTask", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "Index", + schema: "Participant", + table: "Objective", + type: "int", + nullable: false, + defaultValue: 0); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Index", + schema: "Participant", + table: "ObjectiveTask"); + + migrationBuilder.DropColumn( + name: "Index", + schema: "Participant", + table: "Objective"); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs index 2a15a603..1bbbc32f 100644 --- a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs @@ -2151,6 +2151,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(36) .HasColumnType("nvarchar(36)"); + b1.Property("Index") + .HasColumnType("int"); + b1.Property("Justification") .HasColumnType("nvarchar(max)"); @@ -2203,6 +2206,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b2.Property("Due") .HasColumnType("datetime2"); + b2.Property("Index") + .HasColumnType("int"); + b2.Property("Justification") .HasColumnType("nvarchar(max)"); diff --git a/src/Server.UI/Pages/Objectives/Objective.razor b/src/Server.UI/Pages/Objectives/Objective.razor index 6102fd67..2d197663 100644 --- a/src/Server.UI/Pages/Objectives/Objective.razor +++ b/src/Server.UI/Pages/Objectives/Objective.razor @@ -15,7 +15,7 @@ { } - @Model.Title + @Model.DisplayName (@Model.Tasks.Count(x => x.IsCompleted)/@Model.Tasks.Count()) @if(Model.IsCompleted) { diff --git a/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor index 7b140b35..2c9457b1 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor @@ -21,7 +21,7 @@
- @Model.Title + @Model.DisplayName @if (Model.IsCompleted) { From ce4bd8f5191d27abc6044b4c668630d3e89fa1e8 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 16 Aug 2024 14:05:18 +0100 Subject: [PATCH 22/35] Fix typo for regex validator name --- .../Common/Validators/RegularExpressionValidation.cs | 2 +- .../Features/Identity/DTOs/ApplicationUserDtoValidator.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Application/Common/Validators/RegularExpressionValidation.cs b/src/Application/Common/Validators/RegularExpressionValidation.cs index 4a636720..6639c62e 100644 --- a/src/Application/Common/Validators/RegularExpressionValidation.cs +++ b/src/Application/Common/Validators/RegularExpressionValidation.cs @@ -5,7 +5,7 @@ public static class ValidationConstants public const string LettersSpacesUnderscores = @"^[A-Za-z_ ]+$"; public const string LettersSpacesUnderscoresMessage = "{0} must contain only letters, spaces, and underscores."; - public const string LettersSpacesCommaApostorphe = @"^[A-Za-z ',’]+$"; + public const string LettersSpacesCommaApostrophe = @"^[A-Za-z ',’]+$"; public const string LettersSpacesCommaApostropheMessage = "{0} must contain only letters, spaces, comma and an apostrophe."; public const string AlphabetsDigitsSpaceSlashHyphenDot= @"^[a-zA-Z0-9\s\\\/\-.]+$"; diff --git a/src/Application/Features/Identity/DTOs/ApplicationUserDtoValidator.cs b/src/Application/Features/Identity/DTOs/ApplicationUserDtoValidator.cs index f37c8bd1..7a9c3198 100644 --- a/src/Application/Features/Identity/DTOs/ApplicationUserDtoValidator.cs +++ b/src/Application/Features/Identity/DTOs/ApplicationUserDtoValidator.cs @@ -57,7 +57,7 @@ public ApplicationUserDtoValidator( RuleFor(x => x.MemorablePlace) .MaximumLength(50).WithMessage(_localizer["Memorable place must be less than or equal to 50 characters"]) - .Matches(ValidationConstants.LettersSpacesCommaApostorphe).WithMessage(_localizer[string.Format(ValidationConstants.LettersSpacesCommaApostropheMessage, "Memorable place")]); + .Matches(ValidationConstants.LettersSpacesCommaApostrophe).WithMessage(_localizer[string.Format(ValidationConstants.LettersSpacesCommaApostropheMessage, "Memorable place")]); RuleFor(x => x.MemorableDate) .NotEmpty().WithMessage(_localizer["Memorable date is required"]) From 7ff4db66acc3f16697031e530b0c81281890753d Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 16 Aug 2024 14:05:32 +0100 Subject: [PATCH 23/35] Restrict allowed characters for objective/task titles --- .../Features/PathwayPlans/Commands/AddObjective.cs | 4 ++-- src/Application/Features/PathwayPlans/Commands/AddTask.cs | 4 ++-- .../Features/PathwayPlans/Commands/EditObjective.cs | 4 ++-- src/Application/Features/PathwayPlans/Commands/EditTask.cs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Application/Features/PathwayPlans/Commands/AddObjective.cs b/src/Application/Features/PathwayPlans/Commands/AddObjective.cs index 7593d1a3..edf30673 100644 --- a/src/Application/Features/PathwayPlans/Commands/AddObjective.cs +++ b/src/Application/Features/PathwayPlans/Commands/AddObjective.cs @@ -53,8 +53,8 @@ public Validator() RuleFor(x => x.Title) .NotEmpty() .WithMessage("You must provide a title") - .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) - .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); + .Matches(ValidationConstants.LettersSpacesCommaApostrophe) + .WithMessage(string.Format(ValidationConstants.LettersSpacesCommaApostropheMessage, "Title")); } } diff --git a/src/Application/Features/PathwayPlans/Commands/AddTask.cs b/src/Application/Features/PathwayPlans/Commands/AddTask.cs index 82b4793f..028304fe 100644 --- a/src/Application/Features/PathwayPlans/Commands/AddTask.cs +++ b/src/Application/Features/PathwayPlans/Commands/AddTask.cs @@ -63,8 +63,8 @@ public Validator() RuleFor(x => x.Title) .NotEmpty() .WithMessage("You must provide a title") - .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) - .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); + .Matches(ValidationConstants.LettersSpacesCommaApostrophe) + .WithMessage(string.Format(ValidationConstants.LettersSpacesCommaApostropheMessage, "Title")); RuleFor(x => x.Due) .Must(x => x.HasValue) diff --git a/src/Application/Features/PathwayPlans/Commands/EditObjective.cs b/src/Application/Features/PathwayPlans/Commands/EditObjective.cs index 2511fd59..0e03d50c 100644 --- a/src/Application/Features/PathwayPlans/Commands/EditObjective.cs +++ b/src/Application/Features/PathwayPlans/Commands/EditObjective.cs @@ -50,8 +50,8 @@ public Validator() RuleFor(x => x.Title) .NotEmpty() .WithMessage("You must provide a title") - .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) - .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); + .Matches(ValidationConstants.LettersSpacesCommaApostrophe) + .WithMessage(string.Format(ValidationConstants.LettersSpacesCommaApostropheMessage, "Title")); } } diff --git a/src/Application/Features/PathwayPlans/Commands/EditTask.cs b/src/Application/Features/PathwayPlans/Commands/EditTask.cs index 71f4ac13..771384b9 100644 --- a/src/Application/Features/PathwayPlans/Commands/EditTask.cs +++ b/src/Application/Features/PathwayPlans/Commands/EditTask.cs @@ -70,8 +70,8 @@ public Validator() RuleFor(x => x.Title) .NotEmpty() .WithMessage("You must provide a title") - .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) - .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); + .Matches(ValidationConstants.LettersSpacesCommaApostrophe) + .WithMessage(string.Format(ValidationConstants.LettersSpacesCommaApostropheMessage, "Title")); RuleFor(x => x.Due) .Must(x => x.HasValue) From 6cb45d8e23bd2820375a4c2a875b77380263eb32 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 16 Aug 2024 15:00:19 +0100 Subject: [PATCH 24/35] Add expansion dialogs for displaying completion reason --- .../Interfaces/Identity/IUserService.cs | 1 + .../PathwayPlans/DTOs/ObjectiveDto.cs | 1 + .../PathwayPlans/DTOs/ObjectiveTaskDto.cs | 2 + .../Services/Identity/UserService.cs | 5 +++ .../Objectives/ExpandObjectiveDialog.razor | 38 +++++++++++++++++++ .../Pages/Objectives/Objective.razor | 19 ++++++++++ .../Objectives/Tasks/ExpandTaskDialog.razor | 38 +++++++++++++++++++ .../Objectives/Tasks/ObjectiveTask.razor | 19 ++++++++++ 8 files changed, 123 insertions(+) create mode 100644 src/Server.UI/Pages/Objectives/ExpandObjectiveDialog.razor create mode 100644 src/Server.UI/Pages/Objectives/Tasks/ExpandTaskDialog.razor diff --git a/src/Application/Common/Interfaces/Identity/IUserService.cs b/src/Application/Common/Interfaces/Identity/IUserService.cs index 40bcfcab..dc4c5fe9 100644 --- a/src/Application/Common/Interfaces/Identity/IUserService.cs +++ b/src/Application/Common/Interfaces/Identity/IUserService.cs @@ -8,4 +8,5 @@ public interface IUserService event Action? OnChange; void Initialize(); void Refresh(); + string? GetDisplayName(string userId); } diff --git a/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs b/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs index ea7e4060..fb1e2cb6 100644 --- a/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs +++ b/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs @@ -10,6 +10,7 @@ public class ObjectiveDto public DateTime? Completed { get; set; } public CompletionStatus? CompletedStatus { get; set; } public required DateTime Created { get; set; } + public required string CreatedBy { get; set; } public IEnumerable Tasks { get; set; } = []; public string? Justification { get; set; } public required int Index { get; set; } diff --git a/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs b/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs index d5f120b3..69ec7fa2 100644 --- a/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs +++ b/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs @@ -9,9 +9,11 @@ public class ObjectiveTaskDto public required Guid ObjectiveId { get; set; } public required DateTime Due { get; set; } public required DateTime Created { get; set; } + public required string CreatedBy { get; set; } public DateTime? Completed { get; set; } public CompletionStatus? CompletedStatus { get; set; } public required int Index { get; set; } + public string? Justification { get; set; } public string DisplayName => $"{Index}. {Title}"; public bool IsCompleted => Completed.HasValue; public bool IsOverdue => IsCompleted is false diff --git a/src/Infrastructure/Services/Identity/UserService.cs b/src/Infrastructure/Services/Identity/UserService.cs index 0c95829a..d679bcb4 100644 --- a/src/Infrastructure/Services/Identity/UserService.cs +++ b/src/Infrastructure/Services/Identity/UserService.cs @@ -30,6 +30,11 @@ public UserService(IFusionCache fusionCache, IMapper mapper, IServiceScopeFactor public event Action? OnChange; + public string? GetDisplayName(string userId) + { + return DataSource.FirstOrDefault(u => u.Id == userId)?.DisplayName; + } + public void Initialize() { DataSource = diff --git a/src/Server.UI/Pages/Objectives/ExpandObjectiveDialog.razor b/src/Server.UI/Pages/Objectives/ExpandObjectiveDialog.razor new file mode 100644 index 00000000..f8437a08 --- /dev/null +++ b/src/Server.UI/Pages/Objectives/ExpandObjectiveDialog.razor @@ -0,0 +1,38 @@ +@using Cfo.Cats.Application.Common.Interfaces.Identity +@using Cfo.Cats.Application.Features.PathwayPlans.DTOs + +@inherits CatsComponentBase + +@inject IUserService UserService + + + + Added on @Model.Created.ToLocalTime() by @UserService.GetDisplayName(Model.CreatedBy) + + @if (Model.IsCompleted) + { + Marked as @Model.CompletedStatus!.Name on @Model.Completed!.Value.ToLocalTime() + + } + + + @ConstantString.Ok + + + +@code { + [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter, EditorRequired] + public required ObjectiveDto Model { get; set; } + + private void Cancel() + { + MudDialog.Cancel(); + } +} diff --git a/src/Server.UI/Pages/Objectives/Objective.razor b/src/Server.UI/Pages/Objectives/Objective.razor index 2d197663..0b0f7cb3 100644 --- a/src/Server.UI/Pages/Objectives/Objective.razor +++ b/src/Server.UI/Pages/Objectives/Objective.razor @@ -55,6 +55,9 @@ + + + @@ -132,6 +135,22 @@ } } + public async Task Expand() + { + await DialogService.ShowAsync( + Model.Title, + new DialogParameters() + { + { x => x.Model, Model } + }, + new DialogOptions + { + MaxWidth = MaxWidth.Small, + FullWidth = true, + CloseButton = true + }); + } + public async Task Rename() { var command = new EditObjective.Command() diff --git a/src/Server.UI/Pages/Objectives/Tasks/ExpandTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/ExpandTaskDialog.razor new file mode 100644 index 00000000..3d704b97 --- /dev/null +++ b/src/Server.UI/Pages/Objectives/Tasks/ExpandTaskDialog.razor @@ -0,0 +1,38 @@ +@using Cfo.Cats.Application.Common.Interfaces.Identity +@using Cfo.Cats.Application.Features.PathwayPlans.DTOs + +@inherits CatsComponentBase + +@inject IUserService UserService + + + + Added on @Model.Created.ToLocalTime() by @UserService.GetDisplayName(Model.CreatedBy) + + @if (Model.IsCompleted) + { + Marked as @Model.CompletedStatus!.Name on @Model.Completed!.Value.ToLocalTime() + + } + + + @ConstantString.Ok + + + +@code { + [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter, EditorRequired] + public required ObjectiveTaskDto Model { get; set; } + + private void Cancel() + { + MudDialog.Cancel(); + } +} diff --git a/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor index 2c9457b1..65cfd185 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor @@ -85,6 +85,9 @@ New PSF + + + Added @Model.Created.Humanize() @@ -139,6 +142,22 @@ } } + public async Task Expand() + { + await DialogService.ShowAsync( + Model.Title, + new DialogParameters() + { + { x => x.Model, Model } + }, + new DialogOptions + { + MaxWidth = MaxWidth.Small, + FullWidth = true, + CloseButton = true + }); + } + public async Task ExtendDate() { var command = new EditTask.Command() From 79a6e15a3e4c5f118b890a4d8bc4d83608b041aa Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 16 Aug 2024 15:07:17 +0100 Subject: [PATCH 25/35] Resolve merge conflict --- src/Application/Common/Interfaces/IApplicationDbContext.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Application/Common/Interfaces/IApplicationDbContext.cs b/src/Application/Common/Interfaces/IApplicationDbContext.cs index 82948dc7..766f3734 100644 --- a/src/Application/Common/Interfaces/IApplicationDbContext.cs +++ b/src/Application/Common/Interfaces/IApplicationDbContext.cs @@ -30,8 +30,6 @@ public interface IApplicationDbContext DbSet Risks { get; } - DbSet Risks { get; } - DbSet KeyValues { get; } DbSet ParticipantAssessments { get; } From 6693f70fda96d970e3bede93d43bc1b7c5d79653 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 16 Aug 2024 15:12:44 +0100 Subject: [PATCH 26/35] Squash development migrations => PathwayPlan --- .../20240809101015_Objectives.Designer.cs | 2395 ---------------- .../20240813134025_Objectives_v2.Designer.cs | 2429 ---------------- .../20240813134025_Objectives_v2.cs | 75 - .../20240813163959_Objectives_v3.Designer.cs | 2429 ---------------- .../20240813163959_Objectives_v3.cs | 54 - .../20240813182343_Objectives_v4.Designer.cs | 2426 ---------------- .../20240813182343_Objectives_v4.cs | 55 - .../20240815084514_Objectives_v5.Designer.cs | 2432 ---------------- .../20240815084514_Objectives_v5.cs | 44 - .../20240815085352_Objectives_v6.Designer.cs | 2432 ---------------- .../20240815085352_Objectives_v6.cs | 39 - .../20240815090249_Objectives_v7.Designer.cs | 2435 ---------------- .../20240815090249_Objectives_v7.cs | 30 - .../20240815140110_Objectives_v8.Designer.cs | 2505 ----------------- .../20240815140110_Objectives_v8.cs | 144 - .../20240816124115_Objectives_v9.cs | 44 - ...=> 20240816141136_PathwayPlan.Designer.cs} | 52 +- ...tives.cs => 20240816141136_PathwayPlan.cs} | 87 +- 18 files changed, 131 insertions(+), 19976 deletions(-) delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.Designer.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.Designer.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.Designer.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.Designer.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.Designer.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.Designer.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.Designer.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.Designer.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.cs delete mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.cs rename src/Migrators/Migrators.MSSQL/Migrations/{20240816124115_Objectives_v9.Designer.cs => 20240816141136_PathwayPlan.Designer.cs} (98%) rename src/Migrators/Migrators.MSSQL/Migrations/{20240809101015_Objectives.cs => 20240816141136_PathwayPlan.cs} (50%) diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.Designer.cs deleted file mode 100644 index b61fe00d..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.Designer.cs +++ /dev/null @@ -1,2395 +0,0 @@ -// -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("20240809101015_Objectives")] - partial class Objectives - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .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("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.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.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Document", "Document"); - }); - - 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.Objective", 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.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ParticipantId"); - - b.ToTable("Objective", "Participant"); - }); - - modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => - { - b.Property("Id") - .HasMaxLength(9) - .HasColumnType("nvarchar(9)"); - - b.Property("ConsentStatus") - .HasColumnType("int"); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("DateOfBirth") - .IsRequired() - .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("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.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("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.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.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.Objective", b => - { - b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b1.Property("Completed") - .HasColumnType("datetime2"); - - b1.Property("CompletedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("Created") - .HasColumnType("datetime2"); - - b1.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("Due") - .HasColumnType("datetime2"); - - b1.Property("LastModified") - .HasColumnType("datetime2"); - - b1.Property("LastModifiedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("ObjectiveId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("Id"); - - b1.HasIndex("CompletedBy"); - - b1.HasIndex("ObjectiveId"); - - b1.ToTable("ObjectiveTask", "Participant"); - - b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") - .WithMany() - .HasForeignKey("CompletedBy"); - - b1.WithOwner() - .HasForeignKey("ObjectiveId"); - - b1.Navigation("CompletedByUser"); - }); - - b.Navigation("Tasks"); - }); - - 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.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.Navigation("Consents"); - - b.Navigation("CurrentLocation"); - - b.Navigation("Editor"); - - b.Navigation("EnrolmentLocation"); - - b.Navigation("Notes"); - - b.Navigation("Owner"); - - b.Navigation("RightToWorks"); - }); - - 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/20240813134025_Objectives_v2.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.Designer.cs deleted file mode 100644 index f879b52f..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.Designer.cs +++ /dev/null @@ -1,2429 +0,0 @@ -// -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("20240813134025_Objectives_v2")] - partial class Objectives_v2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .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("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.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.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Document", "Document"); - }); - - 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.Objective", 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.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ParticipantId"); - - b.ToTable("Objective", "Participant"); - }); - - modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => - { - b.Property("Id") - .HasMaxLength(9) - .HasColumnType("nvarchar(9)"); - - b.Property("ConsentStatus") - .HasColumnType("int"); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("DateOfBirth") - .IsRequired() - .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("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.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("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.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.Objective", b => - { - b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b1.Property("Cancelled") - .HasColumnType("datetime2"); - - b1.Property("CancelledBy") - .HasColumnType("nvarchar(max)"); - - b1.Property("CancelledReason") - .HasColumnType("nvarchar(max)"); - - b1.Property("Completed") - .HasColumnType("datetime2"); - - b1.Property("CompletedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("Created") - .HasColumnType("datetime2"); - - b1.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("Due") - .HasColumnType("datetime2"); - - b1.Property("LastModified") - .HasColumnType("datetime2"); - - b1.Property("LastModifiedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("ObjectiveId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("Id"); - - b1.HasIndex("CompletedBy"); - - b1.HasIndex("ObjectiveId"); - - b1.ToTable("ObjectiveTask", "Participant"); - - b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") - .WithMany() - .HasForeignKey("CompletedBy"); - - b1.WithOwner() - .HasForeignKey("ObjectiveId"); - - b1.Navigation("CompletedByUser"); - }); - - b.Navigation("Tasks"); - }); - - 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.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.Navigation("Consents"); - - b.Navigation("CurrentLocation"); - - b.Navigation("Editor"); - - b.Navigation("EnrolmentLocation"); - - b.Navigation("Notes"); - - b.Navigation("Owner"); - - b.Navigation("RightToWorks"); - }); - - 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/20240813134025_Objectives_v2.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.cs deleted file mode 100644 index 4e2878e6..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240813134025_Objectives_v2.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Cfo.Cats.Migrators.MSSQL.Migrations -{ - /// - public partial class Objectives_v2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Due", - schema: "Participant", - table: "ObjectiveTask", - type: "datetime2", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - oldClrType: typeof(DateTime), - oldType: "datetime2", - oldNullable: true); - - migrationBuilder.AddColumn( - name: "Cancelled", - schema: "Participant", - table: "ObjectiveTask", - type: "datetime2", - nullable: true); - - migrationBuilder.AddColumn( - name: "CancelledBy", - schema: "Participant", - table: "ObjectiveTask", - type: "nvarchar(max)", - nullable: true); - - migrationBuilder.AddColumn( - name: "CancelledReason", - schema: "Participant", - table: "ObjectiveTask", - type: "nvarchar(max)", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Cancelled", - schema: "Participant", - table: "ObjectiveTask"); - - migrationBuilder.DropColumn( - name: "CancelledBy", - schema: "Participant", - table: "ObjectiveTask"); - - migrationBuilder.DropColumn( - name: "CancelledReason", - schema: "Participant", - table: "ObjectiveTask"); - - migrationBuilder.AlterColumn( - name: "Due", - schema: "Participant", - table: "ObjectiveTask", - type: "datetime2", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "datetime2"); - } - } -} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.Designer.cs deleted file mode 100644 index ca1172f6..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.Designer.cs +++ /dev/null @@ -1,2429 +0,0 @@ -// -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("20240813163959_Objectives_v3")] - partial class Objectives_v3 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .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("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.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.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Document", "Document"); - }); - - 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.Objective", 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.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ParticipantId"); - - b.ToTable("Objective", "Participant"); - }); - - modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => - { - b.Property("Id") - .HasMaxLength(9) - .HasColumnType("nvarchar(9)"); - - b.Property("ConsentStatus") - .HasColumnType("int"); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("DateOfBirth") - .IsRequired() - .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("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.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("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.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.Objective", b => - { - b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b1.Property("Closed") - .HasColumnType("datetime2"); - - b1.Property("ClosedBy") - .HasColumnType("nvarchar(max)"); - - b1.Property("Completed") - .HasColumnType("datetime2"); - - b1.Property("CompletedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("Created") - .HasColumnType("datetime2"); - - b1.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("Due") - .HasColumnType("datetime2"); - - b1.Property("Justification") - .HasColumnType("nvarchar(max)"); - - b1.Property("LastModified") - .HasColumnType("datetime2"); - - b1.Property("LastModifiedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("ObjectiveId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("Id"); - - b1.HasIndex("CompletedBy"); - - b1.HasIndex("ObjectiveId"); - - b1.ToTable("ObjectiveTask", "Participant"); - - b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") - .WithMany() - .HasForeignKey("CompletedBy"); - - b1.WithOwner() - .HasForeignKey("ObjectiveId"); - - b1.Navigation("CompletedByUser"); - }); - - b.Navigation("Tasks"); - }); - - 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.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.Navigation("Consents"); - - b.Navigation("CurrentLocation"); - - b.Navigation("Editor"); - - b.Navigation("EnrolmentLocation"); - - b.Navigation("Notes"); - - b.Navigation("Owner"); - - b.Navigation("RightToWorks"); - }); - - 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/20240813163959_Objectives_v3.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.cs deleted file mode 100644 index 8b3c1931..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240813163959_Objectives_v3.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Cfo.Cats.Migrators.MSSQL.Migrations -{ - /// - public partial class Objectives_v3 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "CancelledReason", - schema: "Participant", - table: "ObjectiveTask", - newName: "Justification"); - - migrationBuilder.RenameColumn( - name: "CancelledBy", - schema: "Participant", - table: "ObjectiveTask", - newName: "ClosedBy"); - - migrationBuilder.RenameColumn( - name: "Cancelled", - schema: "Participant", - table: "ObjectiveTask", - newName: "Closed"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Justification", - schema: "Participant", - table: "ObjectiveTask", - newName: "CancelledReason"); - - migrationBuilder.RenameColumn( - name: "ClosedBy", - schema: "Participant", - table: "ObjectiveTask", - newName: "CancelledBy"); - - migrationBuilder.RenameColumn( - name: "Closed", - schema: "Participant", - table: "ObjectiveTask", - newName: "Cancelled"); - } - } -} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.Designer.cs deleted file mode 100644 index e9ae6da0..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.Designer.cs +++ /dev/null @@ -1,2426 +0,0 @@ -// -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("20240813182343_Objectives_v4")] - partial class Objectives_v4 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .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("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.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.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Document", "Document"); - }); - - 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.Objective", 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.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ParticipantId"); - - b.ToTable("Objective", "Participant"); - }); - - modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => - { - b.Property("Id") - .HasMaxLength(9) - .HasColumnType("nvarchar(9)"); - - b.Property("ConsentStatus") - .HasColumnType("int"); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("DateOfBirth") - .IsRequired() - .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("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.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("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.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.Objective", b => - { - b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", 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("Due") - .HasColumnType("datetime2"); - - b1.Property("Justification") - .HasColumnType("nvarchar(max)"); - - b1.Property("LastModified") - .HasColumnType("datetime2"); - - b1.Property("LastModifiedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("ObjectiveId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("Id"); - - b1.HasIndex("CompletedBy"); - - b1.HasIndex("ObjectiveId"); - - b1.ToTable("ObjectiveTask", "Participant"); - - b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") - .WithMany() - .HasForeignKey("CompletedBy"); - - b1.WithOwner() - .HasForeignKey("ObjectiveId"); - - b1.Navigation("CompletedByUser"); - }); - - b.Navigation("Tasks"); - }); - - 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.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.Navigation("Consents"); - - b.Navigation("CurrentLocation"); - - b.Navigation("Editor"); - - b.Navigation("EnrolmentLocation"); - - b.Navigation("Notes"); - - b.Navigation("Owner"); - - b.Navigation("RightToWorks"); - }); - - 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/20240813182343_Objectives_v4.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.cs deleted file mode 100644 index ee51bebf..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240813182343_Objectives_v4.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Cfo.Cats.Migrators.MSSQL.Migrations -{ - /// - public partial class Objectives_v4 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Closed", - schema: "Participant", - table: "ObjectiveTask"); - - migrationBuilder.DropColumn( - name: "ClosedBy", - schema: "Participant", - table: "ObjectiveTask"); - - migrationBuilder.AddColumn( - name: "CompletedStatus", - schema: "Participant", - table: "ObjectiveTask", - type: "int", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CompletedStatus", - schema: "Participant", - table: "ObjectiveTask"); - - migrationBuilder.AddColumn( - name: "Closed", - schema: "Participant", - table: "ObjectiveTask", - type: "datetime2", - nullable: true); - - migrationBuilder.AddColumn( - name: "ClosedBy", - schema: "Participant", - table: "ObjectiveTask", - type: "nvarchar(max)", - nullable: true); - } - } -} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.Designer.cs deleted file mode 100644 index e53e9314..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.Designer.cs +++ /dev/null @@ -1,2432 +0,0 @@ -// -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("20240815084514_Objectives_v5")] - partial class Objectives_v5 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .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("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.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.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Document", "Document"); - }); - - 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.Objective", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Completed") - .HasColumnType("datetime2"); - - b.Property("CompletedStatus") - .HasColumnType("int"); - - 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("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ParticipantId"); - - b.ToTable("Objective", "Participant"); - }); - - modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => - { - b.Property("Id") - .HasMaxLength(9) - .HasColumnType("nvarchar(9)"); - - b.Property("ConsentStatus") - .HasColumnType("int"); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("DateOfBirth") - .IsRequired() - .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("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.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("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.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.Objective", b => - { - b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", 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("Due") - .HasColumnType("datetime2"); - - b1.Property("Justification") - .HasColumnType("nvarchar(max)"); - - b1.Property("LastModified") - .HasColumnType("datetime2"); - - b1.Property("LastModifiedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("ObjectiveId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("Id"); - - b1.HasIndex("CompletedBy"); - - b1.HasIndex("ObjectiveId"); - - b1.ToTable("ObjectiveTask", "Participant"); - - b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") - .WithMany() - .HasForeignKey("CompletedBy"); - - b1.WithOwner() - .HasForeignKey("ObjectiveId"); - - b1.Navigation("CompletedByUser"); - }); - - b.Navigation("Tasks"); - }); - - 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.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.Navigation("Consents"); - - b.Navigation("CurrentLocation"); - - b.Navigation("Editor"); - - b.Navigation("EnrolmentLocation"); - - b.Navigation("Notes"); - - b.Navigation("Owner"); - - b.Navigation("RightToWorks"); - }); - - 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/20240815084514_Objectives_v5.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.cs deleted file mode 100644 index e5506d0b..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240815084514_Objectives_v5.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Cfo.Cats.Migrators.MSSQL.Migrations -{ - /// - public partial class Objectives_v5 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Completed", - schema: "Participant", - table: "Objective", - type: "datetime2", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AddColumn( - name: "CompletedStatus", - schema: "Participant", - table: "Objective", - type: "int", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Completed", - schema: "Participant", - table: "Objective"); - - migrationBuilder.DropColumn( - name: "CompletedStatus", - schema: "Participant", - table: "Objective"); - } - } -} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.Designer.cs deleted file mode 100644 index 716dc440..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.Designer.cs +++ /dev/null @@ -1,2432 +0,0 @@ -// -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("20240815085352_Objectives_v6")] - partial class Objectives_v6 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .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("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.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.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Document", "Document"); - }); - - 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.Objective", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Completed") - .HasColumnType("datetime2"); - - b.Property("CompletedStatus") - .HasColumnType("int"); - - 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("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ParticipantId"); - - b.ToTable("Objective", "Participant"); - }); - - modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => - { - b.Property("Id") - .HasMaxLength(9) - .HasColumnType("nvarchar(9)"); - - b.Property("ConsentStatus") - .HasColumnType("int"); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("DateOfBirth") - .IsRequired() - .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("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.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("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.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.Objective", b => - { - b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", 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("Due") - .HasColumnType("datetime2"); - - b1.Property("Justification") - .HasColumnType("nvarchar(max)"); - - b1.Property("LastModified") - .HasColumnType("datetime2"); - - b1.Property("LastModifiedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("ObjectiveId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("Id"); - - b1.HasIndex("CompletedBy"); - - b1.HasIndex("ObjectiveId"); - - b1.ToTable("ObjectiveTask", "Participant"); - - b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") - .WithMany() - .HasForeignKey("CompletedBy"); - - b1.WithOwner() - .HasForeignKey("ObjectiveId"); - - b1.Navigation("CompletedByUser"); - }); - - b.Navigation("Tasks"); - }); - - 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.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.Navigation("Consents"); - - b.Navigation("CurrentLocation"); - - b.Navigation("Editor"); - - b.Navigation("EnrolmentLocation"); - - b.Navigation("Notes"); - - b.Navigation("Owner"); - - b.Navigation("RightToWorks"); - }); - - 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/20240815085352_Objectives_v6.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.cs deleted file mode 100644 index c4ab472f..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240815085352_Objectives_v6.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Cfo.Cats.Migrators.MSSQL.Migrations -{ - /// - public partial class Objectives_v6 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Completed", - schema: "Participant", - table: "Objective", - type: "datetime2", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "datetime2"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Completed", - schema: "Participant", - table: "Objective", - type: "datetime2", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - oldClrType: typeof(DateTime), - oldType: "datetime2", - oldNullable: true); - } - } -} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.Designer.cs deleted file mode 100644 index 3ec92a95..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.Designer.cs +++ /dev/null @@ -1,2435 +0,0 @@ -// -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("20240815090249_Objectives_v7")] - partial class Objectives_v7 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .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("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.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.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Document", "Document"); - }); - - 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.Objective", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Completed") - .HasColumnType("datetime2"); - - b.Property("CompletedStatus") - .HasColumnType("int"); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("Justification") - .HasColumnType("nvarchar(max)"); - - b.Property("LastModified") - .HasColumnType("datetime2"); - - b.Property("LastModifiedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("ParticipantId") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("nvarchar(9)"); - - b.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ParticipantId"); - - b.ToTable("Objective", "Participant"); - }); - - modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => - { - b.Property("Id") - .HasMaxLength(9) - .HasColumnType("nvarchar(9)"); - - b.Property("ConsentStatus") - .HasColumnType("int"); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("DateOfBirth") - .IsRequired() - .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("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.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("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.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.Objective", b => - { - b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", 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("Due") - .HasColumnType("datetime2"); - - b1.Property("Justification") - .HasColumnType("nvarchar(max)"); - - b1.Property("LastModified") - .HasColumnType("datetime2"); - - b1.Property("LastModifiedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b1.Property("ObjectiveId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("Id"); - - b1.HasIndex("CompletedBy"); - - b1.HasIndex("ObjectiveId"); - - b1.ToTable("ObjectiveTask", "Participant"); - - b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") - .WithMany() - .HasForeignKey("CompletedBy"); - - b1.WithOwner() - .HasForeignKey("ObjectiveId"); - - b1.Navigation("CompletedByUser"); - }); - - b.Navigation("Tasks"); - }); - - 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.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.Navigation("Consents"); - - b.Navigation("CurrentLocation"); - - b.Navigation("Editor"); - - b.Navigation("EnrolmentLocation"); - - b.Navigation("Notes"); - - b.Navigation("Owner"); - - b.Navigation("RightToWorks"); - }); - - 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/20240815090249_Objectives_v7.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.cs deleted file mode 100644 index f09309c5..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240815090249_Objectives_v7.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Cfo.Cats.Migrators.MSSQL.Migrations -{ - /// - public partial class Objectives_v7 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Justification", - schema: "Participant", - table: "Objective", - type: "nvarchar(max)", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Justification", - schema: "Participant", - table: "Objective"); - } - } -} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.Designer.cs deleted file mode 100644 index cdbf3eb6..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.Designer.cs +++ /dev/null @@ -1,2505 +0,0 @@ -// -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("20240815140110_Objectives_v8")] - partial class Objectives_v8 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .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("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.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.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("LastModifiedBy"); - - b.HasIndex("TenantId"); - - b.ToTable("Document", "Document"); - }); - - 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("ConsentStatus") - .HasColumnType("int"); - - b.Property("Created") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - b.Property("DateOfBirth") - .IsRequired() - .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("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("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.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.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.Navigation("Consents"); - - b.Navigation("CurrentLocation"); - - b.Navigation("Editor"); - - b.Navigation("EnrolmentLocation"); - - b.Navigation("Notes"); - - b.Navigation("Owner"); - - b.Navigation("RightToWorks"); - }); - - 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("CompletedStatus") - .HasColumnType("int"); - - b1.Property("Created") - .HasColumnType("datetime2"); - - b1.Property("CreatedBy") - .HasMaxLength(36) - .HasColumnType("nvarchar(36)"); - - 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.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("Id"); - - b1.HasIndex("PathwayPlanId"); - - b1.ToTable("Objective", "Participant"); - - 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("Due") - .HasColumnType("datetime2"); - - 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.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - 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("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/20240815140110_Objectives_v8.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.cs deleted file mode 100644 index 9d56304f..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240815140110_Objectives_v8.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Cfo.Cats.Migrators.MSSQL.Migrations -{ - /// - public partial class Objectives_v8 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_Objective_ParticipantId", - schema: "Participant", - table: "Objective"); - - migrationBuilder.DropColumn( - name: "ParticipantId", - schema: "Participant", - table: "Objective"); - - migrationBuilder.AddColumn( - name: "PathwayPlanId", - schema: "Participant", - table: "Objective", - type: "uniqueidentifier", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - migrationBuilder.CreateTable( - name: "PathwayPlan", - schema: "Participant", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - ParticipantId = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false), - Created = table.Column(type: "datetime2", nullable: true), - CreatedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), - LastModified = table.Column(type: "datetime2", nullable: true), - LastModifiedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PathwayPlan", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "PathwayPlanReviewHistory", - schema: "Participant", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - PathwayPlanId = table.Column(type: "uniqueidentifier", nullable: false), - Created = table.Column(type: "datetime2", nullable: true), - CreatedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), - LastModified = table.Column(type: "datetime2", nullable: true), - LastModifiedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PathwayPlanReviewHistory", x => x.Id); - table.ForeignKey( - name: "FK_PathwayPlanReviewHistory_PathwayPlan_PathwayPlanId", - column: x => x.PathwayPlanId, - principalSchema: "Participant", - principalTable: "PathwayPlan", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Objective_PathwayPlanId", - schema: "Participant", - table: "Objective", - column: "PathwayPlanId"); - - migrationBuilder.CreateIndex( - name: "IX_PathwayPlan_ParticipantId", - schema: "Participant", - table: "PathwayPlan", - column: "ParticipantId"); - - migrationBuilder.CreateIndex( - name: "IX_PathwayPlanReviewHistory_PathwayPlanId", - schema: "Participant", - table: "PathwayPlanReviewHistory", - column: "PathwayPlanId"); - - migrationBuilder.AddForeignKey( - name: "FK_Objective_PathwayPlan_PathwayPlanId", - schema: "Participant", - table: "Objective", - column: "PathwayPlanId", - principalSchema: "Participant", - principalTable: "PathwayPlan", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Objective_PathwayPlan_PathwayPlanId", - schema: "Participant", - table: "Objective"); - - migrationBuilder.DropTable( - name: "PathwayPlanReviewHistory", - schema: "Participant"); - - migrationBuilder.DropTable( - name: "PathwayPlan", - schema: "Participant"); - - migrationBuilder.DropIndex( - name: "IX_Objective_PathwayPlanId", - schema: "Participant", - table: "Objective"); - - migrationBuilder.DropColumn( - name: "PathwayPlanId", - schema: "Participant", - table: "Objective"); - - migrationBuilder.AddColumn( - name: "ParticipantId", - schema: "Participant", - table: "Objective", - type: "nvarchar(9)", - maxLength: 9, - nullable: false, - defaultValue: ""); - - migrationBuilder.CreateIndex( - name: "IX_Objective_ParticipantId", - schema: "Participant", - table: "Objective", - column: "ParticipantId"); - } - } -} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.cs deleted file mode 100644 index 116e272e..00000000 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Cfo.Cats.Migrators.MSSQL.Migrations -{ - /// - public partial class Objectives_v9 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Index", - schema: "Participant", - table: "ObjectiveTask", - type: "int", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "Index", - schema: "Participant", - table: "Objective", - type: "int", - nullable: false, - defaultValue: 0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Index", - schema: "Participant", - table: "ObjectiveTask"); - - migrationBuilder.DropColumn( - name: "Index", - schema: "Participant", - table: "Objective"); - } - } -} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240816141136_PathwayPlan.Designer.cs similarity index 98% rename from src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.Designer.cs rename to src/Migrators/Migrators.MSSQL/Migrations/20240816141136_PathwayPlan.Designer.cs index 68326e44..db163a32 100644 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240816124115_Objectives_v9.Designer.cs +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240816141136_PathwayPlan.Designer.cs @@ -12,8 +12,8 @@ namespace Cfo.Cats.Migrators.MSSQL.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20240816124115_Objectives_v9")] - partial class Objectives_v9 + [Migration("20240816141136_PathwayPlan")] + partial class PathwayPlan { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -278,6 +278,45 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) 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("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") @@ -1474,6 +1513,15 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) 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") diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240816141136_PathwayPlan.cs similarity index 50% rename from src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.cs rename to src/Migrators/Migrators.MSSQL/Migrations/20240816141136_PathwayPlan.cs index 0e719cab..dfa145a4 100644 --- a/src/Migrators/Migrators.MSSQL/Migrations/20240809101015_Objectives.cs +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240816141136_PathwayPlan.cs @@ -6,19 +6,40 @@ namespace Cfo.Cats.Migrators.MSSQL.Migrations { /// - public partial class Objectives : Migration + public partial class PathwayPlan : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( - name: "Objective", + name: "PathwayPlan", schema: "Participant", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), ParticipantId = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false), + Created = table.Column(type: "datetime2", nullable: true), + CreatedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), + LastModified = table.Column(type: "datetime2", nullable: true), + LastModifiedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PathwayPlan", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Objective", + schema: "Participant", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Completed = table.Column(type: "datetime2", nullable: true), + CompletedStatus = table.Column(type: "int", nullable: true), + Index = table.Column(type: "int", nullable: false), + PathwayPlanId = table.Column(type: "uniqueidentifier", nullable: false), Title = table.Column(type: "nvarchar(max)", nullable: false), + Justification = table.Column(type: "nvarchar(max)", nullable: true), Created = table.Column(type: "datetime2", nullable: true), CreatedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), @@ -27,6 +48,37 @@ protected override void Up(MigrationBuilder migrationBuilder) constraints: table => { table.PrimaryKey("PK_Objective", x => x.Id); + table.ForeignKey( + name: "FK_Objective_PathwayPlan_PathwayPlanId", + column: x => x.PathwayPlanId, + principalSchema: "Participant", + principalTable: "PathwayPlan", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "PathwayPlanReviewHistory", + schema: "Participant", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + PathwayPlanId = table.Column(type: "uniqueidentifier", nullable: false), + Created = table.Column(type: "datetime2", nullable: true), + CreatedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), + LastModified = table.Column(type: "datetime2", nullable: true), + LastModifiedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PathwayPlanReviewHistory", x => x.Id); + table.ForeignKey( + name: "FK_PathwayPlanReviewHistory_PathwayPlan_PathwayPlanId", + column: x => x.PathwayPlanId, + principalSchema: "Participant", + principalTable: "PathwayPlan", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( @@ -35,11 +87,14 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - Due = table.Column(type: "datetime2", nullable: true), + Due = table.Column(type: "datetime2", nullable: false), Completed = table.Column(type: "datetime2", nullable: true), CompletedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), - Title = table.Column(type: "nvarchar(max)", nullable: false), + CompletedStatus = table.Column(type: "int", nullable: true), + Index = table.Column(type: "int", nullable: false), + Justification = table.Column(type: "nvarchar(max)", nullable: true), ObjectiveId = table.Column(type: "uniqueidentifier", nullable: false), + Title = table.Column(type: "nvarchar(max)", nullable: false), Created = table.Column(type: "datetime2", nullable: true), CreatedBy = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), @@ -64,10 +119,10 @@ protected override void Up(MigrationBuilder migrationBuilder) }); migrationBuilder.CreateIndex( - name: "IX_Objective_ParticipantId", + name: "IX_Objective_PathwayPlanId", schema: "Participant", table: "Objective", - column: "ParticipantId"); + column: "PathwayPlanId"); migrationBuilder.CreateIndex( name: "IX_ObjectiveTask_CompletedBy", @@ -80,6 +135,18 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "Participant", table: "ObjectiveTask", column: "ObjectiveId"); + + migrationBuilder.CreateIndex( + name: "IX_PathwayPlan_ParticipantId", + schema: "Participant", + table: "PathwayPlan", + column: "ParticipantId"); + + migrationBuilder.CreateIndex( + name: "IX_PathwayPlanReviewHistory_PathwayPlanId", + schema: "Participant", + table: "PathwayPlanReviewHistory", + column: "PathwayPlanId"); } /// @@ -89,9 +156,17 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "ObjectiveTask", schema: "Participant"); + migrationBuilder.DropTable( + name: "PathwayPlanReviewHistory", + schema: "Participant"); + migrationBuilder.DropTable( name: "Objective", schema: "Participant"); + + migrationBuilder.DropTable( + name: "PathwayPlan", + schema: "Participant"); } } } From 90a9c84f1e757ea8d663c46ca3a8fa4134954fac Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Fri, 16 Aug 2024 15:21:26 +0100 Subject: [PATCH 27/35] Allow a less restrictive character set for objective/task titles --- .../Features/PathwayPlans/Commands/AddObjective.cs | 4 ++-- src/Application/Features/PathwayPlans/Commands/AddTask.cs | 4 ++-- .../Features/PathwayPlans/Commands/EditObjective.cs | 4 ++-- src/Application/Features/PathwayPlans/Commands/EditTask.cs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Application/Features/PathwayPlans/Commands/AddObjective.cs b/src/Application/Features/PathwayPlans/Commands/AddObjective.cs index edf30673..7593d1a3 100644 --- a/src/Application/Features/PathwayPlans/Commands/AddObjective.cs +++ b/src/Application/Features/PathwayPlans/Commands/AddObjective.cs @@ -53,8 +53,8 @@ public Validator() RuleFor(x => x.Title) .NotEmpty() .WithMessage("You must provide a title") - .Matches(ValidationConstants.LettersSpacesCommaApostrophe) - .WithMessage(string.Format(ValidationConstants.LettersSpacesCommaApostropheMessage, "Title")); + .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) + .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); } } diff --git a/src/Application/Features/PathwayPlans/Commands/AddTask.cs b/src/Application/Features/PathwayPlans/Commands/AddTask.cs index 028304fe..82b4793f 100644 --- a/src/Application/Features/PathwayPlans/Commands/AddTask.cs +++ b/src/Application/Features/PathwayPlans/Commands/AddTask.cs @@ -63,8 +63,8 @@ public Validator() RuleFor(x => x.Title) .NotEmpty() .WithMessage("You must provide a title") - .Matches(ValidationConstants.LettersSpacesCommaApostrophe) - .WithMessage(string.Format(ValidationConstants.LettersSpacesCommaApostropheMessage, "Title")); + .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) + .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); RuleFor(x => x.Due) .Must(x => x.HasValue) diff --git a/src/Application/Features/PathwayPlans/Commands/EditObjective.cs b/src/Application/Features/PathwayPlans/Commands/EditObjective.cs index 0e03d50c..2511fd59 100644 --- a/src/Application/Features/PathwayPlans/Commands/EditObjective.cs +++ b/src/Application/Features/PathwayPlans/Commands/EditObjective.cs @@ -50,8 +50,8 @@ public Validator() RuleFor(x => x.Title) .NotEmpty() .WithMessage("You must provide a title") - .Matches(ValidationConstants.LettersSpacesCommaApostrophe) - .WithMessage(string.Format(ValidationConstants.LettersSpacesCommaApostropheMessage, "Title")); + .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) + .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); } } diff --git a/src/Application/Features/PathwayPlans/Commands/EditTask.cs b/src/Application/Features/PathwayPlans/Commands/EditTask.cs index 771384b9..71f4ac13 100644 --- a/src/Application/Features/PathwayPlans/Commands/EditTask.cs +++ b/src/Application/Features/PathwayPlans/Commands/EditTask.cs @@ -70,8 +70,8 @@ public Validator() RuleFor(x => x.Title) .NotEmpty() .WithMessage("You must provide a title") - .Matches(ValidationConstants.LettersSpacesCommaApostrophe) - .WithMessage(string.Format(ValidationConstants.LettersSpacesCommaApostropheMessage, "Title")); + .Matches(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDot) + .WithMessage(string.Format(ValidationConstants.AlphabetsDigitsSpaceSlashHyphenDotMessage, "Title")); RuleFor(x => x.Due) .Must(x => x.HasValue) From 44b99c0f53126e1207ea27e9473778ee75205184 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Mon, 19 Aug 2024 11:40:30 +0100 Subject: [PATCH 28/35] Hide action buttons when not available --- .../Pages/Objectives/Objective.razor | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/Server.UI/Pages/Objectives/Objective.razor b/src/Server.UI/Pages/Objectives/Objective.razor index 0b0f7cb3..5b4155fd 100644 --- a/src/Server.UI/Pages/Objectives/Objective.razor +++ b/src/Server.UI/Pages/Objectives/Objective.razor @@ -49,18 +49,26 @@ }
- - - - - - + @if(Model.IsCompleted is false) + { + + + + + + + } + - - - + + @if(Model.IsCompleted is false) + { + + + + }
From 7a4c8346cbfe53f9856d0daee84a509309918e19 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Mon, 19 Aug 2024 12:09:43 +0100 Subject: [PATCH 29/35] 'Completed by' for objectives and tasks --- .../PathwayPlans/Commands/ReviewObjective.cs | 6 +- .../PathwayPlans/DTOs/ObjectiveDto.cs | 1 + .../PathwayPlans/DTOs/ObjectiveTaskDto.cs | 1 + src/Domain/Entities/Participants/Objective.cs | 9 +- .../Entities/Participants/ObjectiveTask.cs | 3 +- .../PathwayPlanEntityTypeConfiguration.cs | 9 +- ...19110423_Objective_CompletedBy.Designer.cs | 2571 +++++++++++++++++ .../20240819110423_Objective_CompletedBy.cs | 56 + .../ApplicationDbContextModelSnapshot.cs | 14 +- .../Objectives/ExpandObjectiveDialog.razor | 2 +- .../Objectives/Tasks/ExpandTaskDialog.razor | 2 +- 11 files changed, 2665 insertions(+), 9 deletions(-) create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240819110423_Objective_CompletedBy.Designer.cs create mode 100644 src/Migrators/Migrators.MSSQL/Migrations/20240819110423_Objective_CompletedBy.cs diff --git a/src/Application/Features/PathwayPlans/Commands/ReviewObjective.cs b/src/Application/Features/PathwayPlans/Commands/ReviewObjective.cs index 5523de2f..a0778f08 100644 --- a/src/Application/Features/PathwayPlans/Commands/ReviewObjective.cs +++ b/src/Application/Features/PathwayPlans/Commands/ReviewObjective.cs @@ -19,7 +19,9 @@ public class Command : IRequest public string? Justification { get; set; } } - public class Handler(IUnitOfWork unitOfWork) : IRequestHandler + public class Handler( + IUnitOfWork unitOfWork, + ICurrentUserService currentUserService) : IRequestHandler { public async Task Handle(Command request, CancellationToken cancellationToken) { @@ -29,7 +31,7 @@ public async Task Handle(Command request, CancellationToken cancellation var objective = pathwayPlan.Objectives.FirstOrDefault(o => o.Id == request.ObjectiveId) ?? throw new NotFoundException("Cannot find objective", request.ObjectiveId); - objective.Review(request.Reason, request.Justification); + objective.Review(request.Reason, currentUserService.UserId!, request.Justification); return Result.Success(); } diff --git a/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs b/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs index fb1e2cb6..9f6ceacb 100644 --- a/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs +++ b/src/Application/Features/PathwayPlans/DTOs/ObjectiveDto.cs @@ -8,6 +8,7 @@ public class ObjectiveDto public required Guid PathwayPlanId { get; set; } public required string Title { get; set; } public DateTime? Completed { get; set; } + public string? CompletedBy { get; set; } public CompletionStatus? CompletedStatus { get; set; } public required DateTime Created { get; set; } public required string CreatedBy { get; set; } diff --git a/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs b/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs index 69ec7fa2..815156e0 100644 --- a/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs +++ b/src/Application/Features/PathwayPlans/DTOs/ObjectiveTaskDto.cs @@ -11,6 +11,7 @@ public class ObjectiveTaskDto public required DateTime Created { get; set; } public required string CreatedBy { get; set; } public DateTime? Completed { get; set; } + public string? CompletedBy { get; set; } public CompletionStatus? CompletedStatus { get; set; } public required int Index { get; set; } public string? Justification { get; set; } diff --git a/src/Domain/Entities/Participants/Objective.cs b/src/Domain/Entities/Participants/Objective.cs index 1aa8ad9d..bb47914d 100644 --- a/src/Domain/Entities/Participants/Objective.cs +++ b/src/Domain/Entities/Participants/Objective.cs @@ -1,6 +1,7 @@ using Cfo.Cats.Domain.Common.Entities; using Cfo.Cats.Domain.Common.Enums; using Cfo.Cats.Domain.Events; +using Cfo.Cats.Domain.Identity; namespace Cfo.Cats.Domain.Entities.Participants; @@ -15,6 +16,7 @@ private Objective() private List _tasks = new(); public DateTime? Completed { get; private set; } + public string? CompletedBy { get; private set; } public CompletionStatus? CompletedStatus { get; private set; } public int Index { get; private set; } @@ -45,15 +47,16 @@ public void Rename(string title) Title = title; } - public void Review(CompletionStatus status, string? justification) + public void Review(CompletionStatus status, string completedBy, string? justification) { foreach (var task in _tasks.Where(task => task.Completed is null)) { - task.Review(status, justification); + task.Review(status, completedBy, justification); } CompletedStatus = status; Completed = DateTime.UtcNow; + CompletedBy = completedBy; Justification = justification; // AddDomainEvent } @@ -70,4 +73,6 @@ public static Objective Create(string title, Guid pathwayPlanId) return objective; } + public virtual ApplicationUser? CompletedByUser { get; set; } + } diff --git a/src/Domain/Entities/Participants/ObjectiveTask.cs b/src/Domain/Entities/Participants/ObjectiveTask.cs index cc42eed1..89188c8a 100644 --- a/src/Domain/Entities/Participants/ObjectiveTask.cs +++ b/src/Domain/Entities/Participants/ObjectiveTask.cs @@ -13,11 +13,12 @@ private ObjectiveTask() } #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. - public void Review(CompletionStatus status, string? justification = null) + public void Review(CompletionStatus status, string completedBy, string? justification = null) { Completed = DateTime.UtcNow; Justification = justification; CompletedStatus = status; + CompletedBy = completedBy; AddDomainEvent(new ObjectiveTaskCompletedDomainEvent(this)); } diff --git a/src/Infrastructure/Persistence/Configurations/Participants/PathwayPlanEntityTypeConfiguration.cs b/src/Infrastructure/Persistence/Configurations/Participants/PathwayPlanEntityTypeConfiguration.cs index 8bb80944..eb2025bf 100644 --- a/src/Infrastructure/Persistence/Configurations/Participants/PathwayPlanEntityTypeConfiguration.cs +++ b/src/Infrastructure/Persistence/Configurations/Participants/PathwayPlanEntityTypeConfiguration.cs @@ -1,4 +1,4 @@ -using Cfo.Cats.Domain.Common.Enums; +using Cfo.Cats.Domain.Common.Enums; using Cfo.Cats.Domain.Entities.Participants; using Cfo.Cats.Infrastructure.Constants.Database; using Microsoft.EntityFrameworkCore.Metadata.Builders; @@ -69,6 +69,13 @@ public void Configure(EntityTypeBuilder builder) objective.Property(objective => objective.LastModifiedBy) .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + objective.Property(objective => objective.CompletedBy) + .HasMaxLength(DatabaseConstants.FieldLengths.GuidId); + + objective.HasOne(task => task.CompletedByUser) + .WithMany() + .HasForeignKey(task => task.CompletedBy); + objective.Property(objective => objective.CompletedStatus) .HasConversion( x => x!.Value, diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20240819110423_Objective_CompletedBy.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240819110423_Objective_CompletedBy.Designer.cs new file mode 100644 index 00000000..19731d42 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240819110423_Objective_CompletedBy.Designer.cs @@ -0,0 +1,2571 @@ +// +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("20240819110423_Objective_CompletedBy")] + partial class Objective_CompletedBy + { + /// + 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("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("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.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + 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("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .IsRequired() + .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("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("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.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.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + }); + + 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("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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + 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("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.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + 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/20240819110423_Objective_CompletedBy.cs b/src/Migrators/Migrators.MSSQL/Migrations/20240819110423_Objective_CompletedBy.cs new file mode 100644 index 00000000..5f6386b7 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20240819110423_Objective_CompletedBy.cs @@ -0,0 +1,56 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Objective_CompletedBy : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CompletedBy", + schema: "Participant", + table: "Objective", + type: "nvarchar(36)", + maxLength: 36, + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Objective_CompletedBy", + schema: "Participant", + table: "Objective", + column: "CompletedBy"); + + migrationBuilder.AddForeignKey( + name: "FK_Objective_User_CompletedBy", + schema: "Participant", + table: "Objective", + column: "CompletedBy", + principalSchema: "Identity", + principalTable: "User", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Objective_User_CompletedBy", + schema: "Participant", + table: "Objective"); + + migrationBuilder.DropIndex( + name: "IX_Objective_CompletedBy", + schema: "Participant", + table: "Objective"); + + migrationBuilder.DropColumn( + name: "CompletedBy", + schema: "Participant", + table: "Objective"); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs index 7d8c98de..889d99db 100644 --- a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") + .HasAnnotation("ProductVersion", "8.0.8") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -2189,6 +2189,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b1.Property("Completed") .HasColumnType("datetime2"); + b1.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + b1.Property("CompletedStatus") .HasColumnType("int"); @@ -2221,10 +2225,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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"); @@ -2292,6 +2302,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b2.Navigation("CompletedByUser"); }); + b1.Navigation("CompletedByUser"); + b1.Navigation("Tasks"); }); diff --git a/src/Server.UI/Pages/Objectives/ExpandObjectiveDialog.razor b/src/Server.UI/Pages/Objectives/ExpandObjectiveDialog.razor index f8437a08..74aade40 100644 --- a/src/Server.UI/Pages/Objectives/ExpandObjectiveDialog.razor +++ b/src/Server.UI/Pages/Objectives/ExpandObjectiveDialog.razor @@ -11,7 +11,7 @@ @if (Model.IsCompleted) { - Marked as @Model.CompletedStatus!.Name on @Model.Completed!.Value.ToLocalTime() + Marked as @Model.CompletedStatus!.Name on @Model.Completed!.Value.ToLocalTime() by @UserService.GetDisplayName(Model.CompletedBy!) Marked as @Model.CompletedStatus!.Name on @Model.Completed!.Value.ToLocalTime() + Marked as @Model.CompletedStatus!.Name on @Model.Completed!.Value.ToLocalTime() by @UserService.GetDisplayName(Model.CompletedBy!) Date: Mon, 19 Aug 2024 12:46:49 +0100 Subject: [PATCH 30/35] Persist completed by to task review --- .../Features/PathwayPlans/Commands/ReviewTask.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Application/Features/PathwayPlans/Commands/ReviewTask.cs b/src/Application/Features/PathwayPlans/Commands/ReviewTask.cs index 89cb1096..74c75c97 100644 --- a/src/Application/Features/PathwayPlans/Commands/ReviewTask.cs +++ b/src/Application/Features/PathwayPlans/Commands/ReviewTask.cs @@ -25,7 +25,9 @@ public class Command : IRequest public string Justification { get; set; } = string.Empty; } - public class Handler(IUnitOfWork unitOfWork) : IRequestHandler + public class Handler( + IUnitOfWork unitOfWork, + ICurrentUserService currentUserService) : IRequestHandler { public async Task Handle(Command request, CancellationToken cancellationToken) { @@ -38,7 +40,7 @@ public async Task Handle(Command request, CancellationToken cancellation var task = objective.Tasks.FirstOrDefault(x => x.Id == request.TaskId) ?? throw new NotFoundException("Cannot find task", request.TaskId); - task.Review(request.Reason, request.Justification); + task.Review(request.Reason, currentUserService.UserId!, request.Justification); return Result.Success(); } From fd79dbc44fb4c0dd07e5ce5962773aaebd723eeb Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Mon, 19 Aug 2024 14:57:38 +0100 Subject: [PATCH 31/35] WIP: Timeline events - pathway plan --- .../PathwayPlanCreatedDomainEventHandler.cs | 12 ++++++++++++ src/Domain/Common/Enums/TimelineEventType.cs | 3 ++- src/Domain/Entities/Participants/PathwayPlan.cs | 2 ++ .../{ObjectiveEvents.cs => PathwayPlanEvents.cs} | 5 +++++ .../Pages/Participants/Components/CaseTimeline.razor | 1 + 5 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/Application/Features/Timelines/EventHandlers/PathwayPlanCreatedDomainEventHandler.cs rename src/Domain/Events/{ObjectiveEvents.cs => PathwayPlanEvents.cs} (83%) diff --git a/src/Application/Features/Timelines/EventHandlers/PathwayPlanCreatedDomainEventHandler.cs b/src/Application/Features/Timelines/EventHandlers/PathwayPlanCreatedDomainEventHandler.cs new file mode 100644 index 00000000..1307d5f9 --- /dev/null +++ b/src/Application/Features/Timelines/EventHandlers/PathwayPlanCreatedDomainEventHandler.cs @@ -0,0 +1,12 @@ +using Cfo.Cats.Domain.Events; + +namespace Cfo.Cats.Application.Features.Timelines.EventHandlers; + +public class PathwayPlanCreatedDomainEventHandler(ICurrentUserService currentUserService, IUnitOfWork unitOfWork) : TimelineNotificationHandler(currentUserService, unitOfWork) +{ + protected override TimelineEventType GetEventType() => TimelineEventType.PathwayPlan; + + protected override string GetLine1(PathwayPlanCreatedDomainEvent notification) => "Pathway Plan created."; + + protected override string GetParticipantId(PathwayPlanCreatedDomainEvent notification) => notification.Item.ParticipantId; +} diff --git a/src/Domain/Common/Enums/TimelineEventType.cs b/src/Domain/Common/Enums/TimelineEventType.cs index 755a307c..f97ff2b3 100644 --- a/src/Domain/Common/Enums/TimelineEventType.cs +++ b/src/Domain/Common/Enums/TimelineEventType.cs @@ -9,7 +9,8 @@ public class TimelineEventType : SmartEnum public static readonly TimelineEventType Enrolment = new(nameof(Enrolment), 1); public static readonly TimelineEventType Consent = new(nameof(Consent), 2); public static readonly TimelineEventType Assessment = new(nameof(Assessment), 3); - + public static readonly TimelineEventType PathwayPlan = new(nameof(PathwayPlan), 4); + private TimelineEventType(string name, int value) : base(name, value) { } diff --git a/src/Domain/Entities/Participants/PathwayPlan.cs b/src/Domain/Entities/Participants/PathwayPlan.cs index 4558f5de..53367a09 100644 --- a/src/Domain/Entities/Participants/PathwayPlan.cs +++ b/src/Domain/Entities/Participants/PathwayPlan.cs @@ -37,6 +37,8 @@ public static PathwayPlan Create(string participantId) ParticipantId = participantId }; + pathwayPlan.AddDomainEvent(new PathwayPlanCreatedDomainEvent(pathwayPlan)); + return pathwayPlan; } diff --git a/src/Domain/Events/ObjectiveEvents.cs b/src/Domain/Events/PathwayPlanEvents.cs similarity index 83% rename from src/Domain/Events/ObjectiveEvents.cs rename to src/Domain/Events/PathwayPlanEvents.cs index 06a09007..60ee2bf2 100644 --- a/src/Domain/Events/ObjectiveEvents.cs +++ b/src/Domain/Events/PathwayPlanEvents.cs @@ -2,6 +2,11 @@ namespace Cfo.Cats.Domain.Events; +public sealed class PathwayPlanCreatedDomainEvent(PathwayPlan pathwayPlan) : DomainEvent +{ + public PathwayPlan Item { get; set; } = pathwayPlan; +} + public sealed class ObjectiveCreatedDomainEvent(Objective objective) : DomainEvent { public Objective Item { get; set; } = objective; diff --git a/src/Server.UI/Pages/Participants/Components/CaseTimeline.razor b/src/Server.UI/Pages/Participants/Components/CaseTimeline.razor index 6fdf5ec6..169ddb29 100644 --- a/src/Server.UI/Pages/Participants/Components/CaseTimeline.razor +++ b/src/Server.UI/Pages/Participants/Components/CaseTimeline.razor @@ -67,6 +67,7 @@ nameof(TimelineEventType.Enrolment) => Color.Success, nameof(TimelineEventType.Consent) => Color.Secondary, nameof(TimelineEventType.Assessment) => Color.Info, + nameof(TimelineEventType.PathwayPlan) => Color.Warning, _ => Color.Primary }; } From d9ece49e916cc07615aa672f6e167481b1aefe2d Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Mon, 19 Aug 2024 14:59:21 +0100 Subject: [PATCH 32/35] Remove reoccurrence frequency --- src/Domain/Common/Enums/ReoccurrenceFrequency.cs | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 src/Domain/Common/Enums/ReoccurrenceFrequency.cs diff --git a/src/Domain/Common/Enums/ReoccurrenceFrequency.cs b/src/Domain/Common/Enums/ReoccurrenceFrequency.cs deleted file mode 100644 index fd7adb94..00000000 --- a/src/Domain/Common/Enums/ReoccurrenceFrequency.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Ardalis.SmartEnum; - -namespace Cfo.Cats.Domain.Common.Enums; - -public class ReoccurrenceFrequency : SmartEnum -{ - public static readonly ReoccurrenceFrequency Daily = new("Daily", 0); - public static readonly ReoccurrenceFrequency Weekly = new("Weekly", 1); - public static readonly ReoccurrenceFrequency Monthly = new("Monthly", 2); - public static readonly ReoccurrenceFrequency Yearly = new("Yearly", 3); - - private ReoccurrenceFrequency(string name, int value) - : base(name, value) { } -} From 5e5d97e981af49a33ea300c0170ee4083850e55c Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Tue, 20 Aug 2024 07:47:42 +0100 Subject: [PATCH 33/35] Objective completed domain event --- src/Domain/Entities/Participants/Objective.cs | 6 ++++-- src/Domain/Entities/Participants/ObjectiveTask.cs | 2 ++ src/Domain/Events/PathwayPlanEvents.cs | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Domain/Entities/Participants/Objective.cs b/src/Domain/Entities/Participants/Objective.cs index bb47914d..556f6adf 100644 --- a/src/Domain/Entities/Participants/Objective.cs +++ b/src/Domain/Entities/Participants/Objective.cs @@ -29,6 +29,8 @@ private Objective() public IReadOnlyCollection Tasks => _tasks.AsReadOnly(); + public bool IsCompleted => Completed is not null; + public Objective AddTask(ObjectiveTask task) { _tasks.Add(task.AtIndex(_tasks.Count + 1)); @@ -49,7 +51,7 @@ public void Rename(string title) public void Review(CompletionStatus status, string completedBy, string? justification) { - foreach (var task in _tasks.Where(task => task.Completed is null)) + foreach (var task in _tasks.Where(task => task.IsCompleted is false)) { task.Review(status, completedBy, justification); } @@ -58,7 +60,7 @@ public void Review(CompletionStatus status, string completedBy, string? justific Completed = DateTime.UtcNow; CompletedBy = completedBy; Justification = justification; - // AddDomainEvent + AddDomainEvent(new ObjectiveCompletedDomainEvent(this)); } public static Objective Create(string title, Guid pathwayPlanId) diff --git a/src/Domain/Entities/Participants/ObjectiveTask.cs b/src/Domain/Entities/Participants/ObjectiveTask.cs index 89188c8a..c235a4f7 100644 --- a/src/Domain/Entities/Participants/ObjectiveTask.cs +++ b/src/Domain/Entities/Participants/ObjectiveTask.cs @@ -59,5 +59,7 @@ public ObjectiveTask AtIndex(int index) public Guid ObjectiveId { get; private set; } public string Title { get; private set; } + public bool IsCompleted => Completed is not null; + public virtual ApplicationUser? CompletedByUser { get; set; } } diff --git a/src/Domain/Events/PathwayPlanEvents.cs b/src/Domain/Events/PathwayPlanEvents.cs index 60ee2bf2..240aba48 100644 --- a/src/Domain/Events/PathwayPlanEvents.cs +++ b/src/Domain/Events/PathwayPlanEvents.cs @@ -12,6 +12,11 @@ public sealed class ObjectiveCreatedDomainEvent(Objective objective) : DomainEve public Objective Item { get; set; } = objective; } +public sealed class ObjectiveCompletedDomainEvent(Objective objective) : DomainEvent +{ + public Objective Item { get; set; } = objective; +} + public sealed class ObjectiveTaskAddedToObjectiveDomainEvent(Objective objective, ObjectiveTask task) : DomainEvent { public Objective Item { get; set; } = objective; From 0876133bb3358949bde1409613c83da4de9a9e27 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Tue, 20 Aug 2024 14:12:44 +0100 Subject: [PATCH 34/35] Feedback re wording --- src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor | 2 +- src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor b/src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor index 32ec01a4..985d3ee2 100644 --- a/src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor +++ b/src/Server.UI/Pages/Objectives/ReviewObjectiveDialog.razor @@ -22,7 +22,7 @@ Class="mt-4" /> diff --git a/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor index 65cfd185..b1b5cefd 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor @@ -80,9 +80,9 @@
- New Activity - New ETE - New PSF + New Activity (Coming Soon) + New ETE (Coming Soon) + New PSF (Coming Soon) From 5e05a17883b4488a2785a1ab687ccdfe9126ce6b Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Wed, 21 Aug 2024 08:46:14 +0100 Subject: [PATCH 35/35] Rename 'Extend date' to 'Adjust date' --- ...endDateTaskDialog.razor => AdjustDateTaskDialog.razor} | 0 src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) rename src/Server.UI/Pages/Objectives/Tasks/{ExtendDateTaskDialog.razor => AdjustDateTaskDialog.razor} (100%) diff --git a/src/Server.UI/Pages/Objectives/Tasks/ExtendDateTaskDialog.razor b/src/Server.UI/Pages/Objectives/Tasks/AdjustDateTaskDialog.razor similarity index 100% rename from src/Server.UI/Pages/Objectives/Tasks/ExtendDateTaskDialog.razor rename to src/Server.UI/Pages/Objectives/Tasks/AdjustDateTaskDialog.razor diff --git a/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor index b1b5cefd..8b8097a3 100644 --- a/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor +++ b/src/Server.UI/Pages/Objectives/Tasks/ObjectiveTask.razor @@ -74,7 +74,7 @@
- Extend date + Adjust date Rename @@ -158,7 +158,7 @@ }); } - public async Task ExtendDate() + public async Task AdjustDate() { var command = new EditTask.Command() { @@ -169,13 +169,13 @@ PathwayPlanId = PathwayPlanId }; - var parameters = new DialogParameters() + var parameters = new DialogParameters() { { x => x.Model, command } }; var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; - var dialog = DialogService.Show("Extend date", parameters, options); + var dialog = DialogService.Show("Adjust date", parameters, options); var state = await dialog.Result;