diff --git a/Dfe.Academies.Academisation.Data/Migrations/20240412110945_nullableIncomingTrustName.Designer.cs b/Dfe.Academies.Academisation.Data/Migrations/20240412110945_nullableIncomingTrustName.Designer.cs new file mode 100644 index 00000000..e9735e69 --- /dev/null +++ b/Dfe.Academies.Academisation.Data/Migrations/20240412110945_nullableIncomingTrustName.Designer.cs @@ -0,0 +1,2002 @@ +// +using System; +using Dfe.Academies.Academisation.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Dfe.Academies.Academisation.Data.Migrations +{ + [DbContext(typeof(AcademisationContext))] + [Migration("20240412110945_nullableIncomingTrustName")] + partial class nullableIncomingTrustName + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.AdvisoryBoardDecisionDeclinedReasonState", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AdvisoryBoardDecisionId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Details") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("Reason") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AdvisoryBoardDecisionId"); + + b.ToTable("ConversionAdvisoryBoardDecisionDeclinedReason", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.AdvisoryBoardDecisionDeferredReasonState", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AdvisoryBoardDecisionId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Details") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("Reason") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AdvisoryBoardDecisionId"); + + b.ToTable("ConversionAdvisoryBoardDecisionDeferredReason", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.AdvisoryBoardDecisionState", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AcademyOrderDate") + .HasColumnType("datetime2"); + + b.Property("AdvisoryBoardDecisionDate") + .HasColumnType("datetime2"); + + b.Property("ApprovedConditionsDetails") + .HasColumnType("nvarchar(max)"); + + b.Property("ApprovedConditionsSet") + .HasColumnType("bit"); + + b.Property("ConversionProjectId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Decision") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DecisionMadeBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("TransferProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("ConversionAdvisoryBoardDecision", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.AdvisoryBoardDecisionWithdrawnReasonState", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AdvisoryBoardDecisionId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Details") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("Reason") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AdvisoryBoardDecisionId"); + + b.ToTable("AdvisoryBoardDecisionWithdrawnReason", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Application", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ApplicationReference") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("nvarchar(max)") + .HasComputedColumnSql("'A2B_' + CAST([Id] AS NVARCHAR(255))", true); + + b.Property("ApplicationStatus") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ApplicationSubmittedDate") + .HasColumnType("datetime2"); + + b.Property("ApplicationType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DeletedAt") + .HasColumnType("datetime2"); + + b.Property("DynamicsApplicationId") + .HasColumnType("uniqueidentifier"); + + b.Property("FormTrustId") + .HasColumnType("int"); + + b.Property("JoinTrustId") + .HasColumnType("int"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("FormTrustId") + .IsUnique() + .HasFilter("[FormTrustId] IS NOT NULL"); + + b.HasIndex("JoinTrustId") + .IsUnique() + .HasFilter("[JoinTrustId] IS NOT NULL"); + + b.ToTable("ConversionApplication", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Contributor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ConversionApplicationId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DynamicsApplicationId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ConversionApplicationId"); + + b.ToTable("ConversionApplicationContributor", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Schools.Lease", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ApplicationSchoolId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DynamicsSchoolLeaseId") + .HasColumnType("uniqueidentifier"); + + b.Property("InterestRate") + .HasColumnType("decimal(18,2)"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("LeaseTerm") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PaymentsToDate") + .HasColumnType("decimal(18,2)"); + + b.Property("Purpose") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RepaymentAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("ResponsibleForAssets") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ValueOfAssets") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationSchoolId"); + + b.ToTable("ApplicationSchoolLease", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Schools.Loan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("ApplicationSchoolId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DynamicsSchoolLoanId") + .HasColumnType("uniqueidentifier"); + + b.Property("InterestRate") + .HasColumnType("decimal(18,2)"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("Provider") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Purpose") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Schedule") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationSchoolId"); + + b.ToTable("ApplicationSchoolLoan", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Schools.School", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ConversionApplicationId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DioceseFolderIdentifier") + .HasColumnType("nvarchar(max)"); + + b.Property("DioceseName") + .HasColumnType("nvarchar(max)"); + + b.Property("DynamicsApplyingSchoolId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExemptionEndDate") + .HasColumnType("datetimeoffset"); + + b.Property("FoundationConsentFolderIdentifier") + .HasColumnType("nvarchar(max)"); + + b.Property("FoundationTrustOrBodyName") + .HasColumnType("nvarchar(max)"); + + b.Property("FurtherInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("HasLeases") + .HasColumnType("bit"); + + b.Property("HasLoans") + .HasColumnType("bit"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("LocalAuthorityClosurePlanDetails") + .HasColumnType("nvarchar(max)"); + + b.Property("LocalAuthorityReorganisationDetails") + .HasColumnType("nvarchar(max)"); + + b.Property("MainFeederSchools") + .HasColumnType("nvarchar(max)"); + + b.Property("OfstedInspectionDetails") + .HasColumnType("nvarchar(max)"); + + b.Property("PartOfFederation") + .HasColumnType("bit"); + + b.Property("ProtectedCharacteristics") + .HasColumnType("int"); + + b.Property("ResolutionConsentFolderIdentifier") + .HasColumnType("nvarchar(max)"); + + b.Property("Safeguarding") + .HasColumnType("bit"); + + b.Property("TrustBenefitDetails") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ConversionApplicationId"); + + b.ToTable("ApplicationSchool", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.FormTrust", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DynamicsApplicationId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("ApplicationFormTrust", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.JoinTrust", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ChangesToLaGovernance") + .HasColumnType("bit"); + + b.Property("ChangesToLaGovernanceExplained") + .HasColumnType("nvarchar(max)"); + + b.Property("ChangesToTrust") + .HasColumnType("int"); + + b.Property("ChangesToTrustExplained") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DynamicsApplicationId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("TrustName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TrustReference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UKPRN") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("ApplicationJoinTrust", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.TrustKeyPerson", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ApplicationFormTrustId") + .HasColumnType("int"); + + b.Property("Biography") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DateOfBirth") + .HasColumnType("datetime2"); + + b.Property("DynamicsKeyPersonId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationFormTrustId"); + + b.ToTable("ApplicationFormTrustKeyPerson", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.TrustKeyPersonRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ApplicationFormTrustKeyPersonRoleId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("Role") + .HasColumnType("int"); + + b.Property("TimeInRole") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationFormTrustKeyPersonRoleId"); + + b.ToTable("ApplicationFormTrustKeyPersonRole", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.Core.ProjectAggregate.ProjectNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Author") + .HasColumnType("nvarchar(max)"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Subject") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectNotes", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.FormAMatProjectAggregate.FormAMatProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ApplicationReference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("ProposedTrustName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ReferenceNumber") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("FormAMatProject", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ProjectAggregate.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedOn") + .HasColumnType("datetime2") + .HasColumnName("CreatedOn"); + + b.Property("DeletedAt") + .HasColumnType("datetime2"); + + b.Property("FormAMatProjectId") + .HasColumnType("int") + .HasColumnName("FormAMatProjectId"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("Project", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.TransferProjectAggregate.IntendedTransferBenefit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("SelectedBenefit") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransferProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TransferProjectId"); + + b.ToTable("IntendedTransferBenefit", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.TransferProjectAggregate.TransferProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 10003000L); + + b.Property("AnyRisks") + .HasColumnType("bit"); + + b.Property("AssignedUserEmailAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("AssignedUserFullName") + .HasColumnType("nvarchar(max)"); + + b.Property("AssignedUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Author") + .HasColumnType("nvarchar(max)"); + + b.Property("BenefitsSectionIsCompleted") + .HasColumnType("bit"); + + b.Property("ComplexLandAndBuildingFurtherSpecification") + .HasColumnType("nvarchar(max)"); + + b.Property("ComplexLandAndBuildingShouldBeConsidered") + .HasColumnType("bit"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DiocesanConsent") + .HasColumnType("nvarchar(max)"); + + b.Property("EqualitiesImpactAssessmentConsidered") + .HasColumnType("bit"); + + b.Property("FeatureSectionIsCompleted") + .HasColumnType("bit"); + + b.Property("FinanceAndDebtFurtherSpecification") + .HasColumnType("nvarchar(max)"); + + b.Property("FinanceAndDebtShouldBeConsidered") + .HasColumnType("bit"); + + b.Property("HasHtbDate") + .HasColumnType("bit"); + + b.Property("HasTargetDateForTransfer") + .HasColumnType("bit"); + + b.Property("HasTransferFirstDiscussedDate") + .HasColumnType("bit"); + + b.Property("HighProfileFurtherSpecification") + .HasColumnType("nvarchar(max)"); + + b.Property("HighProfileShouldBeConsidered") + .HasColumnType("bit"); + + b.Property("HtbDate") + .HasColumnType("datetime2"); + + b.Property("IncomingTrustAgreement") + .HasColumnType("nvarchar(max)"); + + b.Property("IsFormAMat") + .HasColumnType("bit"); + + b.Property("LegalRequirementsSectionIsCompleted") + .HasColumnType("bit"); + + b.Property("OtherBenefitValue") + .HasColumnType("nvarchar(max)"); + + b.Property("OtherRisksFurtherSpecification") + .HasMaxLength(20000) + .HasColumnType("nvarchar(max)"); + + b.Property("OtherRisksShouldBeConsidered") + .HasColumnType("bit"); + + b.Property("OtherTransferTypeDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("OutgoingTrustConsent") + .HasColumnType("nvarchar(max)"); + + b.Property("OutgoingTrustName") + .HasColumnType("nvarchar(max)"); + + b.Property("OutgoingTrustUkprn") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectRationale") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectReference") + .HasColumnType("nvarchar(max)"); + + b.Property("RationaleSectionIsCompleted") + .HasColumnType("bit"); + + b.Property("RddOrEsfaIntervention") + .HasColumnType("bit"); + + b.Property("RddOrEsfaInterventionDetail") + .HasColumnType("nvarchar(max)"); + + b.Property("Recommendation") + .HasColumnType("nvarchar(max)"); + + b.Property("SpecificReasonsForTransfer") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("State") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("nvarchar(max)"); + + b.Property("TargetDateForTransfer") + .HasColumnType("datetime2"); + + b.Property("TransferFirstDiscussed") + .HasColumnType("datetime2"); + + b.Property("TrustSponsorRationale") + .HasColumnType("nvarchar(max)"); + + b.Property("TypeOfTransfer") + .HasColumnType("nvarchar(max)"); + + b.Property("Urn") + .HasColumnType("int"); + + b.Property("WhoInitiatedTheTransfer") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("TransferProject", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.TransferProjectAggregate.TransferringAcademy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("IncomingTrustName") + .HasColumnType("nvarchar(max)"); + + b.Property("IncomingTrustUkprn") + .HasColumnType("nvarchar(max)"); + + b.Property("KeyStage2PerformanceAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("KeyStage4PerformanceAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("KeyStage5PerformanceAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("LatestOfstedReportAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("OutgoingAcademyUkprn") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PupilNumbersAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("TransferProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TransferProjectId"); + + b.ToTable("TransferringAcademy", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.AdvisoryBoardDecisionDeclinedReasonState", b => + { + b.HasOne("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.AdvisoryBoardDecisionState", null) + .WithMany("DeclinedReasons") + .HasForeignKey("AdvisoryBoardDecisionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.AdvisoryBoardDecisionDeferredReasonState", b => + { + b.HasOne("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.AdvisoryBoardDecisionState", null) + .WithMany("DeferredReasons") + .HasForeignKey("AdvisoryBoardDecisionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.AdvisoryBoardDecisionWithdrawnReasonState", b => + { + b.HasOne("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.AdvisoryBoardDecisionState", null) + .WithMany("WithdrawnReasons") + .HasForeignKey("AdvisoryBoardDecisionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Application", b => + { + b.HasOne("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.FormTrust", "FormTrust") + .WithOne() + .HasForeignKey("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Application", "FormTrustId"); + + b.HasOne("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.JoinTrust", "JoinTrust") + .WithOne() + .HasForeignKey("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Application", "JoinTrustId"); + + b.Navigation("FormTrust"); + + b.Navigation("JoinTrust"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Contributor", b => + { + b.HasOne("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Application", null) + .WithMany("Contributors") + .HasForeignKey("ConversionApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Dfe.Academies.Academisation.Domain.Core.ApplicationAggregate.ContributorDetails", "Details", b1 => + { + b1.Property("ContributorId") + .HasColumnType("int"); + + b1.Property("EmailAddress") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("EmailAddress"); + + b1.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("FirstName"); + + b1.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("LastName"); + + b1.Property("OtherRoleName") + .HasColumnType("nvarchar(max)") + .HasColumnName("OtherRoleName"); + + b1.Property("Role") + .HasColumnType("int") + .HasColumnName("Role"); + + b1.HasKey("ContributorId"); + + b1.ToTable("ConversionApplicationContributor", "academisation"); + + b1.WithOwner() + .HasForeignKey("ContributorId"); + }); + + b.Navigation("Details") + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Schools.Lease", b => + { + b.HasOne("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Schools.School", null) + .WithMany("Leases") + .HasForeignKey("ApplicationSchoolId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Schools.Loan", b => + { + b.HasOne("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Schools.School", null) + .WithMany("Loans") + .HasForeignKey("ApplicationSchoolId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Schools.School", b => + { + b.HasOne("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Application", null) + .WithMany("Schools") + .HasForeignKey("ConversionApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Dfe.Academies.Academisation.Domain.Core.ApplicationAggregate.SchoolDetails", "Details", b1 => + { + b1.Property("SchoolId") + .HasColumnType("int"); + + b1.Property("ApplicationJoinTrustReason") + .HasColumnType("nvarchar(max)") + .HasColumnName("JoinTrustReason"); + + b1.Property("ApproverContactEmail") + .HasColumnType("nvarchar(max)") + .HasColumnName("ApproverContactEmail"); + + b1.Property("ApproverContactName") + .HasColumnType("nvarchar(max)") + .HasColumnName("ApproverContactName"); + + b1.Property("CapacityAssumptions") + .HasColumnType("nvarchar(max)") + .HasColumnName("CapacityAssumptions"); + + b1.Property("CapacityPublishedAdmissionsNumber") + .HasColumnType("int") + .HasColumnName("CapacityPublishedAdmissionsNumber"); + + b1.Property("ConfirmPaySupportGrantToSchool") + .HasColumnType("bit") + .HasColumnName("ConfirmPaySupportGrantToSchool"); + + b1.Property("ContactChairEmail") + .HasColumnType("nvarchar(max)") + .HasColumnName("ContactChairEmail"); + + b1.Property("ContactChairName") + .HasColumnType("nvarchar(max)") + .HasColumnName("ContactChairName"); + + b1.Property("ContactHeadEmail") + .HasColumnType("nvarchar(max)") + .HasColumnName("ContactHeadEmail"); + + b1.Property("ContactHeadName") + .HasColumnType("nvarchar(max)") + .HasColumnName("ContactHeadName"); + + b1.Property("ContactRole") + .HasColumnType("nvarchar(max)") + .HasColumnName("ContactRole"); + + b1.Property("ConversionChangeNamePlanned") + .HasColumnType("bit") + .HasColumnName("ConversionChangeNamePlanned"); + + b1.Property("ConversionTargetDate") + .HasColumnType("datetime2") + .HasColumnName("ConversionTargetDate"); + + b1.Property("ConversionTargetDateExplained") + .HasColumnType("nvarchar(max)") + .HasColumnName("ConversionTargetDateExplained"); + + b1.Property("ConversionTargetDateSpecified") + .HasColumnType("bit") + .HasColumnName("ConversionTargetDateSpecified"); + + b1.Property("DeclarationBodyAgree") + .HasColumnType("bit") + .HasColumnName("DeclarationBodyAgree"); + + b1.Property("DeclarationIAmTheChairOrHeadteacher") + .HasColumnType("bit") + .HasColumnName("DeclarationIAmTheChairOrHeadteacher"); + + b1.Property("DeclarationSignedByName") + .HasColumnType("nvarchar(max)") + .HasColumnName("DeclarationSignedByName"); + + b1.Property("FinanceOngoingInvestigations") + .HasColumnType("bit") + .HasColumnName("FinanceOngoingInvestigations"); + + b1.Property("FinancialInvestigationsExplain") + .HasColumnType("nvarchar(max)") + .HasColumnName("FinancialInvestigationsExplain"); + + b1.Property("FinancialInvestigationsTrustAware") + .HasColumnType("bit") + .HasColumnName("FinancialInvestigationsTrustAware"); + + b1.Property("MainContactOtherEmail") + .HasColumnType("nvarchar(max)") + .HasColumnName("MainContactOtherEmail"); + + b1.Property("MainContactOtherName") + .HasColumnType("nvarchar(max)") + .HasColumnName("MainContactOtherName"); + + b1.Property("MainContactOtherRole") + .HasColumnType("nvarchar(max)") + .HasColumnName("MainContactOtherRole"); + + b1.Property("ProjectedPupilNumbersYear1") + .HasColumnType("int") + .HasColumnName("ProjectedPupilNumbersYear1"); + + b1.Property("ProjectedPupilNumbersYear2") + .HasColumnType("int") + .HasColumnName("ProjectedPupilNumbersYear2"); + + b1.Property("ProjectedPupilNumbersYear3") + .HasColumnType("int") + .HasColumnName("ProjectedPupilNumbersYear3"); + + b1.Property("ProposedNewSchoolName") + .HasColumnType("nvarchar(max)") + .HasColumnName("ProposedNewSchoolName"); + + b1.Property("SchoolConversionReasonsForJoining") + .HasColumnType("nvarchar(max)") + .HasColumnName("SchoolConversionReasonsForJoining"); + + b1.Property("SchoolHasConsultedStakeholders") + .HasColumnType("bit") + .HasColumnName("SchoolHasConsultedStakeholders"); + + b1.Property("SchoolName") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("SchoolName"); + + b1.Property("SchoolPlanToConsultStakeholders") + .HasColumnType("nvarchar(max)") + .HasColumnName("SchoolPlanToConsultStakeholders"); + + b1.Property("SchoolSupportGrantFundsPaidTo") + .HasColumnType("int") + .HasColumnName("SupportGrantFundsPaidTo"); + + b1.Property("Urn") + .HasColumnType("int") + .HasColumnName("Urn"); + + b1.HasKey("SchoolId"); + + b1.ToTable("ApplicationSchool", "academisation"); + + b1.WithOwner() + .HasForeignKey("SchoolId"); + + b1.OwnsOne("Dfe.Academies.Academisation.Domain.Core.ApplicationAggregate.LandAndBuildings", "LandAndBuildings", b2 => + { + b2.Property("SchoolDetailsSchoolId") + .HasColumnType("int"); + + b2.Property("FacilitiesShared") + .HasColumnType("bit") + .HasColumnName("FacilitiesShared"); + + b2.Property("FacilitiesSharedExplained") + .HasColumnType("nvarchar(max)") + .HasColumnName("FacilitiesSharedExplained"); + + b2.Property("Grants") + .HasColumnType("bit") + .HasColumnName("Grants"); + + b2.Property("GrantsAwardingBodies") + .HasColumnType("nvarchar(max)") + .HasColumnName("GrantsAwardingBodies"); + + b2.Property("OwnerExplained") + .HasColumnType("nvarchar(max)") + .HasColumnName("OwnerExplained"); + + b2.Property("PartOfBuildingSchoolsForFutureProgramme") + .HasColumnType("bit") + .HasColumnName("PartOfBuildingSchoolsForFutureProgramme"); + + b2.Property("PartOfPfiScheme") + .HasColumnType("bit") + .HasColumnName("PartOfPfiScheme"); + + b2.Property("PartOfPfiSchemeType") + .HasColumnType("nvarchar(max)") + .HasColumnName("PartOfPfiSchemeType"); + + b2.Property("PartOfPrioritySchoolsBuildingProgramme") + .HasColumnType("bit") + .HasColumnName("PartOfPrioritySchoolsBuildingProgramme"); + + b2.Property("WorksPlanned") + .HasColumnType("bit") + .HasColumnName("WorksPlanned"); + + b2.Property("WorksPlannedDate") + .HasColumnType("datetime2") + .HasColumnName("WorksPlannedDate"); + + b2.Property("WorksPlannedExplained") + .HasColumnType("nvarchar(max)") + .HasColumnName("WorksPlannedExplained"); + + b2.HasKey("SchoolDetailsSchoolId"); + + b2.ToTable("ApplicationSchool", "academisation"); + + b2.WithOwner() + .HasForeignKey("SchoolDetailsSchoolId"); + }); + + b1.OwnsOne("Dfe.Academies.Academisation.Domain.Core.ApplicationAggregate.FinancialYear", "CurrentFinancialYear", b2 => + { + b2.Property("SchoolDetailsSchoolId") + .HasColumnType("int"); + + b2.Property("CapitalCarryForward") + .HasColumnType("decimal(18,2)") + .HasColumnName("CurrentFinancialYearCapitalCarryForward"); + + b2.Property("CapitalCarryForwardExplained") + .HasColumnType("nvarchar(max)") + .HasColumnName("CurrentFinancialYearCapitalCarryForwardExplained"); + + b2.Property("CapitalCarryForwardFileLink") + .HasColumnType("nvarchar(max)") + .HasColumnName("CurrentFinancialYearCapitalCarryForwardFileLink"); + + b2.Property("CapitalCarryForwardStatus") + .HasColumnType("int") + .HasColumnName("CurrentFinancialYearCapitalCarryForwardStatus"); + + b2.Property("FinancialYearEndDate") + .HasColumnType("datetime2") + .HasColumnName("CurrentFinancialYearEndDate"); + + b2.Property("Revenue") + .HasColumnType("decimal(18,2)") + .HasColumnName("CurrentFinancialYearRevenue"); + + b2.Property("RevenueStatus") + .HasColumnType("int") + .HasColumnName("CurrentFinancialYearRevenueStatus"); + + b2.Property("RevenueStatusExplained") + .HasColumnType("nvarchar(max)") + .HasColumnName("CurrentFinancialYearRevenueStatusExplained"); + + b2.Property("RevenueStatusFileLink") + .HasColumnType("nvarchar(max)") + .HasColumnName("CurrentFinancialYearRevenueStatusFileLink"); + + b2.HasKey("SchoolDetailsSchoolId"); + + b2.ToTable("ApplicationSchool", "academisation"); + + b2.WithOwner() + .HasForeignKey("SchoolDetailsSchoolId"); + }); + + b1.OwnsOne("Dfe.Academies.Academisation.Domain.Core.ApplicationAggregate.FinancialYear", "NextFinancialYear", b2 => + { + b2.Property("SchoolDetailsSchoolId") + .HasColumnType("int"); + + b2.Property("CapitalCarryForward") + .HasColumnType("decimal(18,2)") + .HasColumnName("NextFinancialYearCapitalCarryForward"); + + b2.Property("CapitalCarryForwardExplained") + .HasColumnType("nvarchar(max)") + .HasColumnName("NextFinancialYearCapitalCarryForwardExplained"); + + b2.Property("CapitalCarryForwardFileLink") + .HasColumnType("nvarchar(max)") + .HasColumnName("NextFinancialYearCapitalCarryForwardFileLink"); + + b2.Property("CapitalCarryForwardStatus") + .HasColumnType("int") + .HasColumnName("NextFinancialYearCapitalCarryForwardStatus"); + + b2.Property("FinancialYearEndDate") + .HasColumnType("datetime2") + .HasColumnName("NextFinancialYearEndDate"); + + b2.Property("Revenue") + .HasColumnType("decimal(18,2)") + .HasColumnName("NextFinancialYearRevenue"); + + b2.Property("RevenueStatus") + .HasColumnType("int") + .HasColumnName("NextFinancialYearRevenueStatus"); + + b2.Property("RevenueStatusExplained") + .HasColumnType("nvarchar(max)") + .HasColumnName("NextFinancialYearRevenueStatusExplained"); + + b2.Property("RevenueStatusFileLink") + .HasColumnType("nvarchar(max)") + .HasColumnName("NextFinancialYearRevenueStatusFileLink"); + + b2.HasKey("SchoolDetailsSchoolId"); + + b2.ToTable("ApplicationSchool", "academisation"); + + b2.WithOwner() + .HasForeignKey("SchoolDetailsSchoolId"); + }); + + b1.OwnsOne("Dfe.Academies.Academisation.Domain.Core.ApplicationAggregate.FinancialYear", "PreviousFinancialYear", b2 => + { + b2.Property("SchoolDetailsSchoolId") + .HasColumnType("int"); + + b2.Property("CapitalCarryForward") + .HasColumnType("decimal(18,2)") + .HasColumnName("PreviousFinancialYearCapitalCarryForward"); + + b2.Property("CapitalCarryForwardExplained") + .HasColumnType("nvarchar(max)") + .HasColumnName("PreviousFinancialYearCapitalCarryForwardExplained"); + + b2.Property("CapitalCarryForwardFileLink") + .HasColumnType("nvarchar(max)") + .HasColumnName("PreviousFinancialYearCapitalCarryForwardFileLink"); + + b2.Property("CapitalCarryForwardStatus") + .HasColumnType("int") + .HasColumnName("PreviousFinancialYearCapitalCarryForwardStatus"); + + b2.Property("FinancialYearEndDate") + .HasColumnType("datetime2") + .HasColumnName("PreviousFinancialYearEndDate"); + + b2.Property("Revenue") + .HasColumnType("decimal(18,2)") + .HasColumnName("PreviousFinancialYearRevenue"); + + b2.Property("RevenueStatus") + .HasColumnType("int") + .HasColumnName("PreviousFinancialYearRevenueStatus"); + + b2.Property("RevenueStatusExplained") + .HasColumnType("nvarchar(max)") + .HasColumnName("PreviousFinancialYearRevenueStatusExplained"); + + b2.Property("RevenueStatusFileLink") + .HasColumnType("nvarchar(max)") + .HasColumnName("PreviousFinancialYearRevenueStatusFileLink"); + + b2.HasKey("SchoolDetailsSchoolId"); + + b2.ToTable("ApplicationSchool", "academisation"); + + b2.WithOwner() + .HasForeignKey("SchoolDetailsSchoolId"); + }); + + b1.Navigation("CurrentFinancialYear"); + + b1.Navigation("LandAndBuildings"); + + b1.Navigation("NextFinancialYear"); + + b1.Navigation("PreviousFinancialYear"); + }); + + b.Navigation("Details") + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.FormTrust", b => + { + b.OwnsOne("Dfe.Academies.Academisation.Domain.Core.ApplicationAggregate.FormTrustDetails", "TrustDetails", b1 => + { + b1.Property("FormTrustId") + .HasColumnType("int"); + + b1.Property("FormTrustGrowthPlansYesNo") + .HasColumnType("bit") + .HasColumnName("FormTrustGrowthPlansYesNo"); + + b1.Property("FormTrustImprovementApprovedSponsor") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustImprovementApprovedSponsor"); + + b1.Property("FormTrustImprovementStrategy") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustImprovementStrategy"); + + b1.Property("FormTrustImprovementSupport") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustImprovementSupport"); + + b1.Property("FormTrustOpeningDate") + .HasColumnType("datetime2") + .HasColumnName("FormTrustOpeningDate"); + + b1.Property("FormTrustPlanForGrowth") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustPlanForGrowth"); + + b1.Property("FormTrustPlansForNoGrowth") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustPlansForNoGrowth"); + + b1.Property("FormTrustProposedNameOfTrust") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustProposedNameOfTrust"); + + b1.Property("FormTrustReasonApprovaltoConvertasSAT") + .HasColumnType("bit") + .HasColumnName("FormTrustReasonApprovaltoConvertasSAT"); + + b1.Property("FormTrustReasonApprovedPerson") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustReasonApprovedPerson"); + + b1.Property("FormTrustReasonForming") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustReasonForming"); + + b1.Property("FormTrustReasonFreedom") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustReasonFreedom"); + + b1.Property("FormTrustReasonGeoAreas") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustReasonGeoAreas"); + + b1.Property("FormTrustReasonImproveTeaching") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustReasonImproveTeaching"); + + b1.Property("FormTrustReasonVision") + .HasColumnType("nvarchar(max)") + .HasColumnName("FormTrustReasonVision"); + + b1.Property("TrustApproverEmail") + .HasColumnType("nvarchar(max)") + .HasColumnName("TrustApproverEmail"); + + b1.Property("TrustApproverName") + .HasColumnType("nvarchar(max)") + .HasColumnName("TrustApproverName"); + + b1.HasKey("FormTrustId"); + + b1.ToTable("ApplicationFormTrust", "academisation"); + + b1.WithOwner() + .HasForeignKey("FormTrustId"); + }); + + b.Navigation("TrustDetails") + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.TrustKeyPerson", b => + { + b.HasOne("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.FormTrust", null) + .WithMany("KeyPeople") + .HasForeignKey("ApplicationFormTrustId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.TrustKeyPersonRole", b => + { + b.HasOne("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.TrustKeyPerson", null) + .WithMany("Roles") + .HasForeignKey("ApplicationFormTrustKeyPersonRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.Core.ProjectAggregate.ProjectNote", b => + { + b.HasOne("Dfe.Academies.Academisation.Domain.ProjectAggregate.Project", null) + .WithMany("Notes") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.FormAMatProjectAggregate.FormAMatProject", b => + { + b.OwnsOne("Dfe.Academies.Academisation.Domain.Core.ProjectAggregate.User", "AssignedUser", b1 => + { + b1.Property("FormAMatProjectId") + .HasColumnType("int"); + + b1.Property("EmailAddress") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("AssignedUserEmailAddress"); + + b1.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("AssignedUserFullName"); + + b1.Property("Id") + .HasColumnType("uniqueidentifier") + .HasColumnName("AssignedUserId"); + + b1.HasKey("FormAMatProjectId"); + + b1.ToTable("FormAMatProject", "academisation"); + + b1.WithOwner() + .HasForeignKey("FormAMatProjectId"); + }); + + b.Navigation("AssignedUser"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ProjectAggregate.Project", b => + { + b.OwnsOne("Dfe.Academies.Academisation.Domain.Core.ProjectAggregate.ProjectDetails", "Details", b1 => + { + b1.Property("ProjectId") + .HasColumnType("int"); + + b1.Property("AcademyTypeAndRoute") + .HasColumnType("nvarchar(max)") + .HasColumnName("AcademyTypeAndRoute"); + + b1.Property("ActualPupilNumbers") + .HasColumnType("int") + .HasColumnName("ActualPupilNumbers"); + + b1.Property("AgeRange") + .HasColumnType("nvarchar(max)") + .HasColumnName("AgeRange"); + + b1.Property("AnnexBFormReceived") + .HasColumnType("bit") + .HasColumnName("AnnexBFormReceived"); + + b1.Property("AnnexBFormUrl") + .HasColumnType("nvarchar(max)") + .HasColumnName("AnnexBFormUrl"); + + b1.Property("ApplicationReceivedDate") + .HasColumnType("datetime2") + .HasColumnName("ApplicationReceivedDate"); + + b1.Property("ApplicationReferenceNumber") + .HasColumnType("nvarchar(max)") + .HasColumnName("ApplicationReferenceNumber"); + + b1.Property("AssignedDate") + .HasColumnType("datetime2") + .HasColumnName("AssignedDate"); + + b1.Property("Author") + .HasColumnType("nvarchar(max)") + .HasColumnName("Author"); + + b1.Property("BaselineDate") + .HasColumnType("datetime2") + .HasColumnName("BaselineDate"); + + b1.Property("Capacity") + .HasColumnType("int") + .HasColumnName("Capacity"); + + b1.Property("CapitalCarryForwardAtEndMarchCurrentYear") + .HasColumnType("decimal(18,2)") + .HasColumnName("CapitalCarryForwardAtEndMarchCurrentYear"); + + b1.Property("CapitalCarryForwardAtEndMarchNextYear") + .HasColumnType("decimal(18,2)") + .HasColumnName("CapitalCarryForwardAtEndMarchNextYear"); + + b1.Property("ClearedBy") + .HasColumnType("nvarchar(max)") + .HasColumnName("ClearedBy"); + + b1.Property("Consultation") + .HasColumnType("nvarchar(max)") + .HasColumnName("Consultation"); + + b1.Property("ConversionSupportGrantAmount") + .HasColumnType("decimal(18,2)") + .HasColumnName("ConversionSupportGrantAmount"); + + b1.Property("ConversionSupportGrantAmountChanged") + .HasColumnType("bit") + .HasColumnName("ConversionSupportGrantAmountChanged"); + + b1.Property("ConversionSupportGrantChangeReason") + .HasColumnType("nvarchar(max)") + .HasColumnName("ConversionSupportGrantChangeReason"); + + b1.Property("ConversionSupportGrantEnvironmentalImprovementGrant") + .HasColumnType("nvarchar(max)") + .HasColumnName("ConversionSupportGrantEnvironmentalImprovementGrant"); + + b1.Property("ConversionSupportGrantNumberOfSites") + .HasColumnType("nvarchar(max)"); + + b1.Property("ConversionSupportGrantType") + .HasColumnType("nvarchar(max)") + .HasColumnName("ConversionSupportGrantType"); + + b1.Property("DaoPackSentDate") + .HasColumnType("datetime2") + .HasColumnName("DaoPackSentDate"); + + b1.Property("DiocesanConsent") + .HasColumnType("nvarchar(max)") + .HasColumnName("DiocesanConsent"); + + b1.Property("DiocesanTrust") + .HasColumnType("nvarchar(max)") + .HasColumnName("DiocesanTrust"); + + b1.Property("DistanceFromSchoolToTrustHeadquarters") + .HasColumnType("decimal(18,2)") + .HasColumnName("DistanceFromSchoolToTrustHeadquarters"); + + b1.Property("DistanceFromSchoolToTrustHeadquartersAdditionalInformation") + .HasColumnType("nvarchar(max)") + .HasColumnName("DistanceFromSchoolToTrustHeadquartersAdditionalInformation"); + + b1.Property("EducationalAttendanceAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b1.Property("EndOfCurrentFinancialYear") + .HasColumnType("datetime2") + .HasColumnName("EndOfCurrentFinancialYear"); + + b1.Property("EndOfNextFinancialYear") + .HasColumnType("datetime2") + .HasColumnName("EndOfNextFinancialYear"); + + b1.Property("ExternalApplicationFormSaved") + .HasColumnType("bit") + .HasColumnName("ExternalApplicationFormSaved"); + + b1.Property("ExternalApplicationFormUrl") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExternalApplicationFormUrl"); + + b1.Property("FinancialDeficit") + .HasColumnType("nvarchar(max)") + .HasColumnName("FinancialDeficit"); + + b1.Property("Form7Received") + .HasColumnType("nvarchar(max)") + .HasColumnName("Form7Received"); + + b1.Property("Form7ReceivedDate") + .HasColumnType("datetime2") + .HasColumnName("Form7ReceivedDate"); + + b1.Property("FoundationConsent") + .HasColumnType("nvarchar(max)") + .HasColumnName("FoundationConsent"); + + b1.Property("GoverningBodyResolution") + .HasColumnType("nvarchar(max)") + .HasColumnName("GoverningBodyResolution"); + + b1.Property("HeadTeacherBoardDate") + .HasColumnType("datetime2") + .HasColumnName("HeadTeacherBoardDate"); + + b1.Property("IfdPipelineId") + .HasColumnType("int") + .HasColumnName("IfdPipelineId"); + + b1.Property("IsFormAMat") + .HasColumnType("bit") + .HasColumnName("IsFormAMat"); + + b1.Property("KeyStage2PerformanceAdditionalInformation") + .HasColumnType("nvarchar(max)") + .HasColumnName("KeyStage2PerformanceAdditionalInformation"); + + b1.Property("KeyStage4PerformanceAdditionalInformation") + .HasColumnType("nvarchar(max)") + .HasColumnName("KeyStage4PerformanceAdditionalInformation"); + + b1.Property("KeyStage5PerformanceAdditionalInformation") + .HasColumnType("nvarchar(max)") + .HasColumnName("KeyStage5PerformanceAdditionalInformation"); + + b1.Property("LegalRequirementsSectionComplete") + .HasColumnType("bit") + .HasColumnName("LegalRequirementsSectionComplete"); + + b1.Property("LocalAuthority") + .HasColumnType("nvarchar(max)") + .HasColumnName("LocalAuthority"); + + b1.Property("LocalAuthorityInformationTemplateComments") + .HasColumnType("nvarchar(max)") + .HasColumnName("LocalAuthorityInformationTemplateComments"); + + b1.Property("LocalAuthorityInformationTemplateLink") + .HasColumnType("nvarchar(max)") + .HasColumnName("LocalAuthorityInformationTemplateLink"); + + b1.Property("LocalAuthorityInformationTemplateReturnedDate") + .HasColumnType("datetime2") + .HasColumnName("LocalAuthorityInformationTemplateReturnedDate"); + + b1.Property("LocalAuthorityInformationTemplateSectionComplete") + .HasColumnType("bit") + .HasColumnName("LocalAuthorityInformationTemplateSectionComplete"); + + b1.Property("LocalAuthorityInformationTemplateSentDate") + .HasColumnType("datetime2") + .HasColumnName("LocalAuthorityInformationTemplateSentDate"); + + b1.Property("MemberOfParliamentNameAndParty") + .HasColumnType("nvarchar(max)") + .HasColumnName("MemberOfParliamentNameAndParty"); + + b1.Property("NameOfTrust") + .HasColumnType("nvarchar(max)") + .HasColumnName("NameOfTrust"); + + b1.Property("NumberOfAlternativeProvisionPlaces") + .HasColumnType("int"); + + b1.Property("NumberOfFundedResidentialPlaces") + .HasColumnType("decimal(18,2)"); + + b1.Property("NumberOfMedicalPlaces") + .HasColumnType("int"); + + b1.Property("NumberOfPlacesFundedFor") + .HasColumnType("decimal(18,2)"); + + b1.Property("NumberOfPost16Places") + .HasColumnType("int"); + + b1.Property("NumberOfResidentialPlaces") + .HasColumnType("decimal(18,2)"); + + b1.Property("NumberOfSENUnitPlaces") + .HasColumnType("int"); + + b1.Property("PartOfPfiScheme") + .HasColumnType("nvarchar(max)") + .HasColumnName("PartOfPfiScheme"); + + b1.Property("PercentageFreeSchoolMeals") + .HasColumnType("decimal(18,2)") + .HasColumnName("PercentageFreeSchoolMeals"); + + b1.Property("PercentageOfGoodOrOutstandingSchoolsInTheDiocesanTrust") + .HasColumnType("decimal(18,2)") + .HasColumnName("PercentageOfGoodOrOutstandingSchoolsInTheDiocesanTrust"); + + b1.Property("PfiSchemeDetails") + .HasColumnType("nvarchar(max)") + .HasColumnName("PfiSchemeDetails"); + + b1.Property("PreviousHeadTeacherBoardDate") + .HasColumnType("datetime2") + .HasColumnName("PreviousHeadTeacherBoardDate"); + + b1.Property("PreviousHeadTeacherBoardDateQuestion") + .HasColumnType("nvarchar(max)") + .HasColumnName("PreviousHeadTeacherBoardDateQuestion"); + + b1.Property("PreviousHeadTeacherBoardLink") + .HasColumnType("nvarchar(max)") + .HasColumnName("PreviousHeadTeacherBoardLink"); + + b1.Property("ProjectStatus") + .HasColumnType("nvarchar(max)") + .HasColumnName("ProjectStatus"); + + b1.Property("ProjectedRevenueBalanceAtEndMarchNextYear") + .HasColumnType("decimal(18,2)") + .HasColumnName("ProjectedRevenueBalanceAtEndMarchNextYear"); + + b1.Property("ProposedAcademyOpeningDate") + .HasColumnType("datetime2") + .HasColumnName("ProposedAcademyOpeningDate"); + + b1.Property("PublishedAdmissionNumber") + .HasColumnType("nvarchar(max)") + .HasColumnName("PublishedAdmissionNumber"); + + b1.Property("PupilsAttendingGroupMedicalAndHealthNeeds") + .HasColumnType("bit"); + + b1.Property("PupilsAttendingGroupPermanentlyExcluded") + .HasColumnType("bit"); + + b1.Property("PupilsAttendingGroupTeenageMums") + .HasColumnType("bit"); + + b1.Property("RationaleForProject") + .HasColumnType("nvarchar(max)") + .HasColumnName("RationaleForProject"); + + b1.Property("RationaleForTrust") + .HasColumnType("nvarchar(max)") + .HasColumnName("RationaleForTrust"); + + b1.Property("RationaleSectionComplete") + .HasColumnType("bit") + .HasColumnName("RationaleSectionComplete"); + + b1.Property("RecommendationForProject") + .HasColumnType("nvarchar(max)") + .HasColumnName("RecommendationForProject"); + + b1.Property("Region") + .HasColumnType("nvarchar(max)") + .HasColumnName("Region"); + + b1.Property("RevenueCarryForwardAtEndMarchCurrentYear") + .HasColumnType("decimal(18,2)") + .HasColumnName("RevenueCarryForwardAtEndMarchCurrentYear"); + + b1.Property("RisksAndIssues") + .HasColumnType("nvarchar(max)") + .HasColumnName("RisksAndIssues"); + + b1.Property("RisksAndIssuesSectionComplete") + .HasColumnType("bit") + .HasColumnName("RisksAndIssuesSectionComplete"); + + b1.Property("SchoolAndTrustInformationSectionComplete") + .HasColumnType("bit") + .HasColumnName("SchoolAndTrustInformationSectionComplete"); + + b1.Property("SchoolBudgetInformationAdditionalInformation") + .HasColumnType("nvarchar(max)") + .HasColumnName("SchoolBudgetInformationAdditionalInformation"); + + b1.Property("SchoolBudgetInformationSectionComplete") + .HasColumnType("bit") + .HasColumnName("SchoolBudgetInformationSectionComplete"); + + b1.Property("SchoolName") + .HasColumnType("nvarchar(max)") + .HasColumnName("SchoolName"); + + b1.Property("SchoolOverviewSectionComplete") + .HasColumnType("bit") + .HasColumnName("SchoolOverviewSectionComplete"); + + b1.Property("SchoolPerformanceAdditionalInformation") + .HasColumnType("nvarchar(max)") + .HasColumnName("SchoolPerformanceAdditionalInformation"); + + b1.Property("SchoolPhase") + .HasColumnType("nvarchar(max)") + .HasColumnName("SchoolPhase"); + + b1.Property("SchoolPupilForecastsAdditionalInformation") + .HasColumnType("nvarchar(max)") + .HasColumnName("SchoolPupilForecastsAdditionalInformation"); + + b1.Property("SchoolType") + .HasColumnType("nvarchar(max)") + .HasColumnName("SchoolType"); + + b1.Property("SponsorName") + .HasColumnType("nvarchar(max)") + .HasColumnName("SponsorName"); + + b1.Property("SponsorReferenceNumber") + .HasColumnType("nvarchar(max)") + .HasColumnName("SponsorReferenceNumber"); + + b1.Property("TrustReferenceNumber") + .HasColumnType("nvarchar(max)") + .HasColumnName("TrustReferenceNumber"); + + b1.Property("Urn") + .HasColumnType("int") + .HasColumnName("Urn"); + + b1.Property("Version") + .HasColumnType("nvarchar(max)") + .HasColumnName("Version"); + + b1.Property("ViabilityIssues") + .HasColumnType("nvarchar(max)") + .HasColumnName("ViabilityIssues"); + + b1.Property("YearOneProjectedCapacity") + .HasColumnType("int") + .HasColumnName("YearOneProjectedCapacity"); + + b1.Property("YearOneProjectedPupilNumbers") + .HasColumnType("int") + .HasColumnName("YearOneProjectedPupilNumbers"); + + b1.Property("YearThreeProjectedCapacity") + .HasColumnType("int") + .HasColumnName("YearThreeProjectedCapacity"); + + b1.Property("YearThreeProjectedPupilNumbers") + .HasColumnType("int") + .HasColumnName("YearThreeProjectedPupilNumbers"); + + b1.Property("YearTwoProjectedCapacity") + .HasColumnType("int") + .HasColumnName("YearTwoProjectedCapacity"); + + b1.Property("YearTwoProjectedPupilNumbers") + .HasColumnType("int") + .HasColumnName("YearTwoProjectedPupilNumbers"); + + b1.HasKey("ProjectId"); + + b1.ToTable("Project", "academisation"); + + b1.WithOwner() + .HasForeignKey("ProjectId"); + + b1.OwnsOne("Dfe.Academies.Academisation.Domain.Core.ProjectAggregate.User", "AssignedUser", b2 => + { + b2.Property("ProjectDetailsProjectId") + .HasColumnType("int"); + + b2.Property("EmailAddress") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("AssignedUserEmailAddress"); + + b2.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasColumnName("AssignedUserFullName"); + + b2.Property("Id") + .HasColumnType("uniqueidentifier") + .HasColumnName("AssignedUserId"); + + b2.HasKey("ProjectDetailsProjectId"); + + b2.ToTable("Project", "academisation"); + + b2.WithOwner() + .HasForeignKey("ProjectDetailsProjectId"); + }); + + b1.Navigation("AssignedUser"); + }); + + b.Navigation("Details") + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.TransferProjectAggregate.IntendedTransferBenefit", b => + { + b.HasOne("Dfe.Academies.Academisation.Domain.TransferProjectAggregate.TransferProject", null) + .WithMany("IntendedTransferBenefits") + .HasForeignKey("TransferProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.TransferProjectAggregate.TransferringAcademy", b => + { + b.HasOne("Dfe.Academies.Academisation.Domain.TransferProjectAggregate.TransferProject", null) + .WithMany("TransferringAcademies") + .HasForeignKey("TransferProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.AdvisoryBoardDecisionState", b => + { + b.Navigation("DeclinedReasons"); + + b.Navigation("DeferredReasons"); + + b.Navigation("WithdrawnReasons"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Application", b => + { + b.Navigation("Contributors"); + + b.Navigation("Schools"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Schools.School", b => + { + b.Navigation("Leases"); + + b.Navigation("Loans"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.FormTrust", b => + { + b.Navigation("KeyPeople"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ApplicationAggregate.Trusts.TrustKeyPerson", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.ProjectAggregate.Project", b => + { + b.Navigation("Notes"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Domain.TransferProjectAggregate.TransferProject", b => + { + b.Navigation("IntendedTransferBenefits"); + + b.Navigation("TransferringAcademies"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Dfe.Academies.Academisation.Data/Migrations/20240412110945_nullableIncomingTrustName.cs b/Dfe.Academies.Academisation.Data/Migrations/20240412110945_nullableIncomingTrustName.cs new file mode 100644 index 00000000..9888b7b2 --- /dev/null +++ b/Dfe.Academies.Academisation.Data/Migrations/20240412110945_nullableIncomingTrustName.cs @@ -0,0 +1,38 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Dfe.Academies.Academisation.Data.Migrations +{ + /// + public partial class nullableIncomingTrustName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "IncomingTrustName", + schema: "academisation", + table: "TransferringAcademy", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "IncomingTrustName", + schema: "academisation", + table: "TransferringAcademy", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + } + } +} diff --git a/Dfe.Academies.Academisation.Data/Migrations/AcademisationContextModelSnapshot.cs b/Dfe.Academies.Academisation.Data/Migrations/AcademisationContextModelSnapshot.cs index bb05d991..12299703 100644 --- a/Dfe.Academies.Academisation.Data/Migrations/AcademisationContextModelSnapshot.cs +++ b/Dfe.Academies.Academisation.Data/Migrations/AcademisationContextModelSnapshot.cs @@ -825,7 +825,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("IncomingTrustName") - .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("IncomingTrustUkprn") diff --git a/Dfe.Academies.Academisation.Domain.UnitTest/TransferProjectAggregate/TransferProjectTests.cs b/Dfe.Academies.Academisation.Domain.UnitTest/TransferProjectAggregate/TransferProjectTests.cs index 70580192..8b0b75e7 100644 --- a/Dfe.Academies.Academisation.Domain.UnitTest/TransferProjectAggregate/TransferProjectTests.cs +++ b/Dfe.Academies.Academisation.Domain.UnitTest/TransferProjectAggregate/TransferProjectTests.cs @@ -17,6 +17,7 @@ public class TransferProjectTests private readonly string _incomingTrustUkprn = "23456789"; private readonly string _incomingTrustName = "_incomingTrustName"; private readonly List _academyUkprns = new() { "academy1", "academy2" }; + private readonly bool _isFormAMat = true; private readonly DateTime _createdOn = DateTime.Now; public TransferProjectTests() { @@ -32,6 +33,7 @@ public void GenerateUrn_WithMultipleAcademies_GivesAMATBasedReference() string incomingTrustUkprn = "11110000"; string incomingTrustName = "incomingTrustName"; List academyUkprns = new List() { "22221111", "33331111" }; + bool isFormAMat = true; DateTime createdOn = DateTime.Now; // Act @@ -41,6 +43,7 @@ public void GenerateUrn_WithMultipleAcademies_GivesAMATBasedReference() incomingTrustUkprn, incomingTrustName, academyUkprns, + isFormAMat, createdOn); // Act @@ -59,6 +62,7 @@ public void GenerateUrn_WithOneAcademy_GivesASATBasedReference() string incomingTrustUkprn = "11110000"; string incomingTrustName = "incomingTrustName"; List academyUkprns = new List() { "22221111" }; + bool isFormAMat = true; DateTime createdOn = DateTime.Now; // Act @@ -68,6 +72,7 @@ public void GenerateUrn_WithOneAcademy_GivesASATBasedReference() incomingTrustUkprn, incomingTrustName, academyUkprns, + isFormAMat, createdOn); // Act @@ -86,6 +91,7 @@ public void CreateTransferProject_WithValidParameters_CreatesTransferProject() string incomingTrustUkprn = "11110000"; string incomingTrustName = "incomingTrustName"; List academyUkprns = new List() { "22221111", "33331111" }; + bool isFormAMat = false; DateTime createdOn = DateTime.Now; // Act @@ -95,6 +101,7 @@ public void CreateTransferProject_WithValidParameters_CreatesTransferProject() incomingTrustUkprn, incomingTrustName, academyUkprns, + isFormAMat, createdOn); // Assert @@ -114,6 +121,7 @@ public void CreateTransferProject_WithNullOutgoingTrustUkprn_ThrowsArgumentNullE string incomingTrustUkprn = "11110000"; string incomingTrustName = "incomingTrustName"; List academyUkprns = new List() { "22221111", "33331111" }; + bool isFormAMat = true; DateTime createdOn = DateTime.Now; // Act @@ -123,6 +131,7 @@ public void CreateTransferProject_WithNullOutgoingTrustUkprn_ThrowsArgumentNullE incomingTrustUkprn, incomingTrustName, academyUkprns, + isFormAMat, createdOn)); } @@ -242,6 +251,7 @@ private static TransferProject CreateValidTransferProject() string incomingTrustUkprn = "11110000"; string incomingTrustName = "incomingTrustName"; List academyUkprns = new List() { "22221111", "33331111" }; + bool isFormAMat = true; DateTime createdOn = DateTime.Now; // Act @@ -251,13 +261,14 @@ private static TransferProject CreateValidTransferProject() incomingTrustUkprn, incomingTrustName, academyUkprns, + isFormAMat, createdOn); return result; } [Theory] [ClassData(typeof(CreationArgumentExceptionTestData))] - public void CreateTransferProject_WithTestData_ThrowsArgumentExceptions(string outgoingTrustUkprn, string outgoingTrustName, string incomingTrustUkprn, string incomingTrustName, List academyUkprns, DateTime createdOn, Type exType) + public void CreateTransferProject_WithTestData_ThrowsArgumentExceptions(string outgoingTrustUkprn, string outgoingTrustName, string? incomingTrustUkprn, string? incomingTrustName, List academyUkprns, bool? isFormAMat, DateTime createdOn, Type exType) { // Arrange dynamic exception; @@ -270,6 +281,7 @@ public void CreateTransferProject_WithTestData_ThrowsArgumentExceptions(string o incomingTrustUkprn, incomingTrustName, academyUkprns, + isFormAMat, createdOn)); } @@ -281,6 +293,7 @@ public void CreateTransferProject_WithTestData_ThrowsArgumentExceptions(string o incomingTrustUkprn, incomingTrustName, academyUkprns, + isFormAMat, createdOn)); } @@ -292,6 +305,7 @@ public void CreateTransferProject_WithTestData_ThrowsArgumentExceptions(string o incomingTrustUkprn, incomingTrustName, academyUkprns, + isFormAMat, createdOn)); } } @@ -302,7 +316,7 @@ public void CreateTransferProject_WithTestData_ThrowsArgumentExceptions(string o public void SetFeatures_WithValidParameters_SetsPropertiesCorrectly(string whoInitiated, string specficReasons, string transferType, bool isCompleted) { // Arrange - var transferProject = TransferProject.Create(_outgoingTrustUkprn, _outgoingTrusName, _incomingTrustUkprn, _incomingTrustName, _academyUkprns, _createdOn); + var transferProject = TransferProject.Create(_outgoingTrustUkprn, _outgoingTrusName, _incomingTrustUkprn, _incomingTrustName, _academyUkprns, _isFormAMat, _createdOn); var reasons = new List() { specficReasons }; // Act transferProject.SetFeatures(whoInitiated, reasons, transferType, isCompleted); @@ -318,7 +332,7 @@ public void SetFeatures_WithValidParameters_SetsPropertiesCorrectly(string whoIn public void SetLegalRequirements_WithValidParameters_SetsPropertiesCorrectly(string outgoingTrustResolution, string incomingTrustAgreement, string diocesanConsent, bool isCompleted) { // Arrange - var transferProject = TransferProject.Create(_outgoingTrustUkprn, _outgoingTrusName, _incomingTrustUkprn, _incomingTrustName, _academyUkprns, _createdOn); + var transferProject = TransferProject.Create(_outgoingTrustUkprn, _outgoingTrusName, _incomingTrustUkprn, _incomingTrustName, _academyUkprns, _isFormAMat, _createdOn); // Act transferProject.SetLegalRequirements(outgoingTrustResolution, incomingTrustAgreement, diocesanConsent, isCompleted); @@ -333,7 +347,7 @@ public void SetLegalRequirements_WithValidParameters_SetsPropertiesCorrectly(str public void SetTransferDates_WithValidParameters_SetsPropertiesCorrectly() { // Arrange - var transferProject = TransferProject.Create(_outgoingTrustUkprn, _outgoingTrusName, _incomingTrustUkprn, _incomingTrustName, _academyUkprns, _createdOn); + var transferProject = TransferProject.Create(_outgoingTrustUkprn, _outgoingTrusName, _incomingTrustUkprn, _incomingTrustName, _academyUkprns, _isFormAMat, _createdOn); var advisoryBoardDate = DateTime.UtcNow; var expectedDateForTransfer = DateTime.UtcNow.AddMonths(1); // Act @@ -350,7 +364,7 @@ public void SetTransferDates_WithValidParameters_SetsPropertiesCorrectly() public void SetStatus_WithValidParameters_SetsPropertiesCorrectly(string status) { // Arrange - var transferProject = TransferProject.Create(_outgoingTrustUkprn, _outgoingTrusName, _incomingTrustUkprn, _incomingTrustName, _academyUkprns, _createdOn); + var transferProject = TransferProject.Create(_outgoingTrustUkprn, _outgoingTrusName, _incomingTrustUkprn, _incomingTrustName, _academyUkprns, _isFormAMat, _createdOn); // Act transferProject.SetStatus(status); @@ -363,18 +377,15 @@ public class CreationArgumentExceptionTestData : IEnumerable { public IEnumerator GetEnumerator() { - yield return new object[] { null, "out trust", "11110000", "in trust", new List() { "22221111", "33331111" }, DateTime.Now, typeof(ArgumentNullException) }; - yield return new object[] { string.Empty, "out trust", "11110000", "in trust", new List() { "22221111", "33331111" }, DateTime.Now, typeof(ArgumentException) }; + yield return new object[] { null, "out trust", "11110000", "in trust", new List() { "22221111", "33331111" }, false, DateTime.Now, typeof(ArgumentNullException) }; + yield return new object[] { string.Empty, "out trust", "11110000", "in trust", new List() { "22221111", "33331111" }, false, DateTime.Now, typeof(ArgumentException) }; - yield return new object[] { "11112222", "out trust", "11110000", null, new List() { "22221111", "33331111" }, DateTime.Now, typeof(ArgumentNullException) }; - yield return new object[] { "11112222", "out trust", "11110000", string.Empty, new List() { "22221111", "33331111" }, DateTime.Now, typeof(ArgumentException) }; + yield return new object[] { "11112222", "out trust", "11110000", "in trust", null, false, DateTime.Now, typeof(ArgumentNullException) }; + yield return new object[] { "11112222", "out trust", "11110000", "in trust", new List(), false, DateTime.Now, typeof(ArgumentException) }; - yield return new object[] { "11112222", "out trust", "11110000", "in trust", null, DateTime.Now, typeof(ArgumentNullException) }; - yield return new object[] { "11112222", "out trust", "11110000", "in trust", new List(), DateTime.Now, typeof(ArgumentException) }; - - yield return new object[] { "11112222", "out trust", "11110000", "in trust", new List() { "22221111", "33331111" }, DateTime.MinValue, typeof(ArgumentOutOfRangeException) }; - yield return new object[] { "11112222", "out trust", "11110000", "in trust", new List() { "22221111", "33331111" }, DateTime.MaxValue, typeof(ArgumentOutOfRangeException) }; - yield return new object[] { "11112222", "out trust", "11110000", "in trust", new List() { "22221111", "33331111" }, null, typeof(ArgumentOutOfRangeException) }; + yield return new object[] { "11112222", "out trust", "11110000", "in trust", new List() { "22221111", "33331111" }, false, DateTime.MinValue, typeof(ArgumentOutOfRangeException) }; + yield return new object[] { "11112222", "out trust", "11110000", "in trust", new List() { "22221111", "33331111" }, false, DateTime.MaxValue, typeof(ArgumentOutOfRangeException) }; + yield return new object[] { "11112222", "out trust", "11110000", "in trust", new List() { "22221111", "33331111" }, false, null, typeof(ArgumentOutOfRangeException) }; } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); diff --git a/Dfe.Academies.Academisation.Domain/TransferProjectAggregate/TransferProject.cs b/Dfe.Academies.Academisation.Domain/TransferProjectAggregate/TransferProject.cs index 90cbd4c5..61050bc9 100644 --- a/Dfe.Academies.Academisation.Domain/TransferProjectAggregate/TransferProject.cs +++ b/Dfe.Academies.Academisation.Domain/TransferProjectAggregate/TransferProject.cs @@ -8,7 +8,7 @@ namespace Dfe.Academies.Academisation.Domain.TransferProjectAggregate { public class TransferProject : ITransferProject, IAggregateRoot { - private TransferProject(string outgoingTrustUkprn, string outgoingTrustName, string? incomingTrustUkprn, string incomingTrustName, List academyUkprns) + private TransferProject(string outgoingTrustUkprn, string outgoingTrustName, string? incomingTrustUkprn, string? incomingTrustName, List academyUkprns, bool? isFormAMat) { _intendedTransferBenefits = new List(); @@ -19,7 +19,7 @@ private TransferProject(string outgoingTrustUkprn, string outgoingTrustName, str OutgoingTrustUkprn = outgoingTrustUkprn; OutgoingTrustName = outgoingTrustName; //Is form a mat if we have a trust name but no ukprn - IsFormAMat = incomingTrustUkprn == null && !string.IsNullOrEmpty(incomingTrustName); + IsFormAMat = isFormAMat.HasValue && isFormAMat.Value; foreach (var academyUkprn in academyUkprns) { @@ -196,15 +196,14 @@ public void SetStatus(string status) Status = status; } - public static TransferProject Create(string outgoingTrustUkprn, string outgoingTrustName, string? incomingTrustUkprn, string incomingTrustName, List academyUkprns, DateTime createdOn) + public static TransferProject Create(string outgoingTrustUkprn, string outgoingTrustName, string? incomingTrustUkprn, string? incomingTrustName, List academyUkprns, bool? isFormAMat, DateTime createdOn) { Guard.Against.NullOrEmpty(outgoingTrustUkprn); Guard.Against.NullOrEmpty(outgoingTrustName); - Guard.Against.NullOrEmpty(incomingTrustName); Guard.Against.NullOrEmpty(academyUkprns); Guard.Against.OutOfSQLDateRange(createdOn); - return new TransferProject(outgoingTrustUkprn, outgoingTrustName, incomingTrustUkprn, incomingTrustName, academyUkprns) + return new TransferProject(outgoingTrustUkprn, outgoingTrustName, incomingTrustUkprn, incomingTrustName, academyUkprns, isFormAMat) { CreatedOn = createdOn }; diff --git a/Dfe.Academies.Academisation.Domain/TransferProjectAggregate/TransferringAcademy.cs b/Dfe.Academies.Academisation.Domain/TransferProjectAggregate/TransferringAcademy.cs index 9d0cbfdf..cf8b2d73 100644 --- a/Dfe.Academies.Academisation.Domain/TransferProjectAggregate/TransferringAcademy.cs +++ b/Dfe.Academies.Academisation.Domain/TransferProjectAggregate/TransferringAcademy.cs @@ -10,7 +10,7 @@ namespace Dfe.Academies.Academisation.Domain.TransferProjectAggregate { public class TransferringAcademy : ITransferringAcademy { - public TransferringAcademy(string? incomingTrustUkprn, string incomingTrustName, string outgoingAcademyUkprn) + public TransferringAcademy(string? incomingTrustUkprn, string? incomingTrustName, string outgoingAcademyUkprn) { IncomingTrustUkprn = incomingTrustUkprn; IncomingTrustName = incomingTrustName; @@ -21,7 +21,7 @@ public TransferringAcademy(string? incomingTrustUkprn, string incomingTrustName, public int TransferProjectId { get; private set; } public string OutgoingAcademyUkprn { get; private set; } public string? IncomingTrustUkprn { get; private set; } - public string IncomingTrustName { get; private set; } + public string? IncomingTrustName { get; private set; } public string? PupilNumbersAdditionalInformation { get; private set; } public string? LatestOfstedReportAdditionalInformation { get; private set; } diff --git a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/AssignTransferProjectUserCommandHandlerTests.cs b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/AssignTransferProjectUserCommandHandlerTests.cs index ed89ab6c..0ab6fdca 100644 --- a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/AssignTransferProjectUserCommandHandlerTests.cs +++ b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/AssignTransferProjectUserCommandHandlerTests.cs @@ -64,7 +64,7 @@ public async Task Handle_TransferProjectFound_ReturnsCommandSuccessResult() UserFullName = "UserFullName" }; // Create a transfer project to 'SetFeatures' to - var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, DateTime.Now); + var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, false, DateTime.Now); // Mock Unit of work and Repository var unitOfWorkMock = new Mock(); unitOfWorkMock.Setup(u => u.SaveChangesAsync(It.IsAny())) diff --git a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/CreateTransferProjectCommandHandlerTests.cs b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/CreateTransferProjectCommandHandlerTests.cs index 1a32223a..5ca21959 100644 --- a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/CreateTransferProjectCommandHandlerTests.cs +++ b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/CreateTransferProjectCommandHandlerTests.cs @@ -97,8 +97,10 @@ private static CreateTransferProjectCommand CreateValidTransferProjectCommand() string incomingTrustUkprn = "11110000"; string incomingTrusName = "incomingTrusName"; List academyUkprns = new List() { "22221111", "33331111" }; + bool isFormAMat = true; - return new CreateTransferProjectCommand(outgoingTrustUkprn, outgoingTrustName, incomingTrustUkprn, incomingTrusName, academyUkprns); + + return new CreateTransferProjectCommand(outgoingTrustUkprn, outgoingTrustName, incomingTrustUkprn, incomingTrusName, academyUkprns, isFormAMat); } } } diff --git a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectBenefitsCommandHandlerTests.cs b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectBenefitsCommandHandlerTests.cs index 8d229ecb..0b94b238 100644 --- a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectBenefitsCommandHandlerTests.cs +++ b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectBenefitsCommandHandlerTests.cs @@ -51,7 +51,7 @@ public async Task Handle_ValidCommand_PersistsExpectedTransferProject() { this._mockTransferProjectRepository.Setup(x => x.Update(It.IsAny())); - var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, DateTime.Now); + var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, false, DateTime.Now); // Mock GetById to use our Transfer Project from above _mockTransferProjectRepository.Setup(x => x.GetByUrn(It.IsAny())).ReturnsAsync(transferProject); @@ -91,7 +91,7 @@ public async Task Handle_ValidCommand_PersistsExpectedTransferProject() public async Task Handle_ValidCommand_ReturnsCommandSuccessResponse() { this._mockTransferProjectRepository.Setup(x => x.Update(It.IsAny())); - var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, DateTime.Now); + var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, false, DateTime.Now); // Mock GetById to use our Transfer Project from above _mockTransferProjectRepository.Setup(x => x.GetByUrn(It.IsAny())).ReturnsAsync(transferProject); diff --git a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectFeaturesCommandHandlerTests.cs b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectFeaturesCommandHandlerTests.cs index 94599114..277702bf 100644 --- a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectFeaturesCommandHandlerTests.cs +++ b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectFeaturesCommandHandlerTests.cs @@ -64,7 +64,7 @@ public async Task Handle_TransferProjectFound_ReturnsCommandSuccessResult() IsCompleted = true }; // Create a transfer project to 'SetFeatures' to - var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, DateTime.Now); + var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, false, DateTime.Now); // Mock Unit of work and Repository var unitOfWorkMock = new Mock(); unitOfWorkMock.Setup(u => u.SaveChangesAsync(It.IsAny())) diff --git a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectLegalRequirementsCommandHandlerTests.cs b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectLegalRequirementsCommandHandlerTests.cs index a7e3f65f..972b8c59 100644 --- a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectLegalRequirementsCommandHandlerTests.cs +++ b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectLegalRequirementsCommandHandlerTests.cs @@ -66,7 +66,7 @@ public async Task Handle_TransferProjectFound_ReturnsCommandSuccessResult() IsCompleted = true }; // Create a transfer project to 'SetLegalRequirements' to - var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, DateTime.Now); + var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, false, DateTime.Now); // Mock Unit of work and Repository var unitOfWorkMock = new Mock(); unitOfWorkMock.Setup(u => u.SaveChangesAsync(It.IsAny())) diff --git a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectNameCommandHandlerTests.cs b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectNameCommandHandlerTests.cs index e926e173..f3b7a4e2 100644 --- a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectNameCommandHandlerTests.cs +++ b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectNameCommandHandlerTests.cs @@ -61,7 +61,7 @@ public async Task Handle_TransferProjectFound_ReturnsCommandSuccessResult() }; // Create a transfer project to 'SetName' to - var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, DateTime.Now); + var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, false, DateTime.Now); // Mock Unit of work and Repository var unitOfWorkMock = new Mock(); unitOfWorkMock.Setup(u => u.SaveChangesAsync(It.IsAny())) diff --git a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectStatusCommandHandlerTests.cs b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectStatusCommandHandlerTests.cs index e364875a..71c5331f 100644 --- a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectStatusCommandHandlerTests.cs +++ b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectStatusCommandHandlerTests.cs @@ -60,7 +60,7 @@ public async Task Handle_TransferProjectFound_ReturnsCommandSuccessResult() Status = "Withdrawn" }; // Create a transfer project to 'SetStatus' to - var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, DateTime.Now); + var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, false, DateTime.Now); // Mock Unit of work and Repository var unitOfWorkMock = new Mock(); unitOfWorkMock.Setup(u => u.SaveChangesAsync(It.IsAny())) diff --git a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectTransferDatesCommandHandlerTests.cs b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectTransferDatesCommandHandlerTests.cs index 025b6555..34808121 100644 --- a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectTransferDatesCommandHandlerTests.cs +++ b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectTransferDatesCommandHandlerTests.cs @@ -62,7 +62,7 @@ public async Task Handle_TransferProjectFound_ReturnsCommandSuccessResult() TargetDateForTransfer = DateTime.UtcNow.AddMonths(1) }; // Create a transfer project to 'SetTransferDates' to - var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, DateTime.Now); + var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, false, DateTime.Now); // Mock Unit of work and Repository var unitOfWorkMock = new Mock(); unitOfWorkMock.Setup(u => u.SaveChangesAsync(It.IsAny())) diff --git a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectTrustInformationAndProjectDatesCommandHandlerTests.cs b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectTrustInformationAndProjectDatesCommandHandlerTests.cs index 83969c08..33b5f724 100644 --- a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectTrustInformationAndProjectDatesCommandHandlerTests.cs +++ b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferProjectTrustInformationAndProjectDatesCommandHandlerTests.cs @@ -62,7 +62,7 @@ public async Task Handle_TransferProjectFound_ReturnsCommandSuccessResult() Author = "Author" }; // Create a transfer project to 'SetTrustInformationAndProjectDates' to - var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, DateTime.Now); + var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, false, DateTime.Now); // Mock Unit of work and Repository var unitOfWorkMock = new Mock(); unitOfWorkMock.Setup(u => u.SaveChangesAsync(It.IsAny())) diff --git a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferringAcademySchoolAdditionalDataCommandHandlerTests.cs b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferringAcademySchoolAdditionalDataCommandHandlerTests.cs index 445aeb9f..a089475f 100644 --- a/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferringAcademySchoolAdditionalDataCommandHandlerTests.cs +++ b/Dfe.Academies.Academisation.Service.UnitTest/Commands/TransferProject/SetTransferringAcademySchoolAdditionalDataCommandHandlerTests.cs @@ -73,7 +73,7 @@ public async Task Handle_TransferringAcademyFound_ReturnsCommandSuccessResult() }; // Create a transfer project to 'SetSchoolAdditionalData' to - var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, DateTime.Now); + var transferProject = Domain.TransferProjectAggregate.TransferProject.Create("12345678", "out trust", "23456789", "in trust", new List { "34567890" }, false, DateTime.Now); // Mock Unit of work and Repository var unitOfWorkMock = new Mock(); unitOfWorkMock.Setup(u => u.SaveChangesAsync(It.IsAny())) diff --git a/Dfe.Academies.Academisation.Service.UnitTest/Queries/TransferProjectQueryServiceTests.cs b/Dfe.Academies.Academisation.Service.UnitTest/Queries/TransferProjectQueryServiceTests.cs index 2ac4c76b..ae758eb9 100644 --- a/Dfe.Academies.Academisation.Service.UnitTest/Queries/TransferProjectQueryServiceTests.cs +++ b/Dfe.Academies.Academisation.Service.UnitTest/Queries/TransferProjectQueryServiceTests.cs @@ -42,6 +42,7 @@ public async Task GetByUrn_ShouldReturnExpectedResponse() "dummyIncomingTrustUkprn", "in trust", new List { "dummyUkprn1", "dummyUkprn2" }, + false, DateTime.Now ); @@ -75,6 +76,7 @@ public async Task GetById_ShouldReturnExpectedResponse() "dummyIncomingTrustUkprn", "in trust", new List { "dummyUkprn1", "dummyUkprn2" }, + false, DateTime.Now ); diff --git a/Dfe.Academies.Academisation.Service/Commands/TransferProject/CreateTransferProjectCommand.cs b/Dfe.Academies.Academisation.Service/Commands/TransferProject/CreateTransferProjectCommand.cs index 96dc56d0..c0c671c7 100644 --- a/Dfe.Academies.Academisation.Service/Commands/TransferProject/CreateTransferProjectCommand.cs +++ b/Dfe.Academies.Academisation.Service/Commands/TransferProject/CreateTransferProjectCommand.cs @@ -6,18 +6,20 @@ namespace Dfe.Academies.Academisation.Service.Commands.TransferProject; public class CreateTransferProjectCommand : IRequest { - public CreateTransferProjectCommand(string outgoingTrustUkprn, string outgoingTrustName, string? incomingTrustUkprn, string incomingTrustName, List transferringAcademyUkprns) + public CreateTransferProjectCommand(string outgoingTrustUkprn, string outgoingTrustName, string? incomingTrustUkprn, string? incomingTrustName, List transferringAcademyUkprns, bool? isFormAMat) { OutgoingTrustUkprn = outgoingTrustUkprn; OutgoingTrustName = outgoingTrustName; IncomingTrustUkprn = incomingTrustUkprn; IncomingTrustName = incomingTrustName; TransferringAcademyUkprns = transferringAcademyUkprns; + IsFormAMat = isFormAMat; } public List TransferringAcademyUkprns { get; set; } public string OutgoingTrustUkprn { get; set; } public string? IncomingTrustUkprn { get; set; } public string OutgoingTrustName { get; set; } - public string IncomingTrustName { get; set; } + public string? IncomingTrustName { get; set; } + public bool? IsFormAMat { get; set; } } diff --git a/Dfe.Academies.Academisation.Service/Commands/TransferProject/CreateTransferProjectCommandHandler.cs b/Dfe.Academies.Academisation.Service/Commands/TransferProject/CreateTransferProjectCommandHandler.cs index bbb47b36..9f2d0661 100644 --- a/Dfe.Academies.Academisation.Service/Commands/TransferProject/CreateTransferProjectCommandHandler.cs +++ b/Dfe.Academies.Academisation.Service/Commands/TransferProject/CreateTransferProjectCommandHandler.cs @@ -29,6 +29,7 @@ public async Task Handle(CreateTransferProjectCommand request, Can request.IncomingTrustUkprn, request.IncomingTrustName, request.TransferringAcademyUkprns, + request.IsFormAMat, _dateTimeProvider.Now); _transferProjectRepository.Insert(transferProject); diff --git a/Dfe.Academies.Academisation.Service/Queries/TransferProjectQueryService.cs b/Dfe.Academies.Academisation.Service/Queries/TransferProjectQueryService.cs index 85e9b0c3..c9931f1a 100644 --- a/Dfe.Academies.Academisation.Service/Queries/TransferProjectQueryService.cs +++ b/Dfe.Academies.Academisation.Service/Queries/TransferProjectQueryService.cs @@ -48,12 +48,11 @@ public async Task> Ge IEnumerable projects = FilterByIncomingTrust(title, AcademyTransferProjectSummaryResponse(transferProjects)); - // remove any projects without an incoming or outgoing trust. + // remove any projects without an outgoing trust. projects = projects .Where(p => - !string.IsNullOrEmpty(p.OutgoingTrustUkprn) && !string.IsNullOrEmpty(p.OutgoingTrustName) && - // just filtered out by incoming trust name now to allow for form a mat - !p.TransferringAcademies.Any(ta => string.IsNullOrEmpty(ta.IncomingTrustName))).ToList(); + !string.IsNullOrEmpty(p.OutgoingTrustUkprn) && !string.IsNullOrEmpty(p.OutgoingTrustName) + ).ToList(); var recordTotal = projects.Count(); @@ -70,12 +69,10 @@ public async Task> GetExported transferProjects = FilterExportedTransferProjectsByIncomingTrust(title, transferProjects); - // remove any projects without an incoming or outgoing trust. + // remove any projects without an outgoing trust. transferProjects = transferProjects .Where(p => - !string.IsNullOrEmpty(p.OutgoingTrustUkprn) && !string.IsNullOrEmpty(p.OutgoingTrustName) && - // just filtered out by incoming trust name now to allow for form a mat - !p.TransferringAcademies.Any(ta => string.IsNullOrEmpty(ta.IncomingTrustName))).ToList(); + !string.IsNullOrEmpty(p.OutgoingTrustUkprn) && !string.IsNullOrEmpty(p.OutgoingTrustName)).ToList(); var projects = await MapExportedTransferProjectModel(transferProjects);