diff --git a/.github/workflows/continuous-integration-terraform.yml b/.github/workflows/continuous-integration-terraform.yml index fcd6c80b..2b7e3129 100644 --- a/.github/workflows/continuous-integration-terraform.yml +++ b/.github/workflows/continuous-integration-terraform.yml @@ -1,13 +1,17 @@ -name: Validate terraform +name: Continuous Integration / Terraform on: push: branches: main + paths: + - 'terraform/**.tf' pull_request: + paths: + - 'terraform/**.tf' jobs: terraform-validate: - name: Terraform Validate + name: Validate runs-on: ubuntu-latest steps: - name: Check out code @@ -23,41 +27,46 @@ jobs: exit 1 fi + - name: Validate Terraform docs + uses: terraform-docs/gh-actions@v1.0.0 + with: + working-dir: terraform + config-file: .terraform-docs.yml + output-file: README.md + output-method: inject + fail-on-diff: true + - name: Remove azure backend run: rm ./terraform/backend.tf - name: Run a Terraform init - uses: docker://hashicorp/terraform:1.5.5 + uses: docker://hashicorp/terraform:1.5.6 with: entrypoint: terraform args: -chdir=terraform init - name: Run a Terraform validate - uses: docker://hashicorp/terraform:1.5.5 + uses: docker://hashicorp/terraform:1.5.6 with: entrypoint: terraform args: -chdir=terraform validate - name: Run a Terraform format check - uses: docker://hashicorp/terraform:1.5.5 + uses: docker://hashicorp/terraform:1.5.6 with: entrypoint: terraform args: -chdir=terraform fmt -check=true -diff=true - terraform-docs-validation: - name: Terraform Docs validation - needs: terraform-validate - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v3 + + - name: Setup TFLint + uses: terraform-linters/setup-tflint@v3 with: - ref: ${{ github.event.pull_request.head.ref }} + tflint_version: v0.44.1 - - name: Generate Terraform docs - uses: terraform-docs/gh-actions@v1.0.0 + - name: Run TFLint + working-directory: terraform + run: tflint -f compact + + - name: Run TFSec + uses: aquasecurity/tfsec-pr-commenter-action@v1.3.1 with: - working-dir: terraform - config-file: .terraform-docs.yml - output-file: README.md - output-method: inject - fail-on-diff: true + github_token: ${{ github.token }} diff --git a/.github/workflows/continuous-integration-tflint.yml b/.github/workflows/continuous-integration-tflint.yml deleted file mode 100644 index 69b2cf8a..00000000 --- a/.github/workflows/continuous-integration-tflint.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Terraform Lint - -on: - pull_request: - -jobs: - tflint: - name: tflint - runs-on: ubuntu-latest - defaults: - run: - working-directory: terraform - steps: - - name: Clone repo - uses: actions/checkout@v3 - - - name: Setup TFLint - uses: terraform-linters/setup-tflint@v3 - with: - tflint_version: v0.44.1 - - - name: Run TFLint - run: tflint -f compact diff --git a/.github/workflows/continuous-integration-tfsec.yml b/.github/workflows/continuous-integration-tfsec.yml deleted file mode 100644 index 8bee0ac7..00000000 --- a/.github/workflows/continuous-integration-tfsec.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Terraform security scan -on: - pull_request: -jobs: - tfsec-pr-commenter: - name: tfsec PR commenter - runs-on: ubuntu-latest - steps: - - name: Clone repo - uses: actions/checkout@v3 - - name: tfsec - uses: aquasecurity/tfsec-pr-commenter-action@v1.2.0 - with: - github_token: ${{ github.token }} diff --git a/Dfe.Academies.Academisation.Data/Migrations/20230904135623_SponsoredGrantAmountChangedBool.Designer.cs b/Dfe.Academies.Academisation.Data/Migrations/20230904135623_SponsoredGrantAmountChangedBool.Designer.cs new file mode 100644 index 00000000..eab16b31 --- /dev/null +++ b/Dfe.Academies.Academisation.Data/Migrations/20230904135623_SponsoredGrantAmountChangedBool.Designer.cs @@ -0,0 +1,1701 @@ +// +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("20230904135623_SponsoredGrantAmountChangedBool")] + partial class SponsoredGrantAmountChangedBool + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.ConversionAdvisoryBoardDecisionDeclinedReasonState", 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.ConversionAdvisoryBoardDecisionDeferredReasonState", 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.ConversionAdvisoryBoardDecisionState", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + 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.HasKey("Id"); + + b.ToTable("ConversionAdvisoryBoardDecision", "academisation"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ProjectAggregate.ProjectNoteState", 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.Data.ProjectAggregate.ProjectState", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AcademyOrderRequired") + .HasColumnType("nvarchar(max)"); + + b.Property("AcademyTypeAndRoute") + .HasColumnType("nvarchar(max)"); + + b.Property("ActualPupilNumbers") + .HasColumnType("int"); + + b.Property("AgeRange") + .HasColumnType("nvarchar(max)"); + + b.Property("AnnexBFormReceived") + .HasColumnType("bit"); + + b.Property("AnnexBFormUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ApplicationReceivedDate") + .HasColumnType("datetime2"); + + b.Property("ApplicationReferenceNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("AssignedDate") + .HasColumnType("datetime2"); + + 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("BaselineDate") + .HasColumnType("datetime2"); + + b.Property("Capacity") + .HasColumnType("int"); + + b.Property("CapitalCarryForwardAtEndMarchCurrentYear") + .HasColumnType("decimal(18,2)"); + + b.Property("CapitalCarryForwardAtEndMarchNextYear") + .HasColumnType("decimal(18,2)"); + + b.Property("ClearedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("Consultation") + .HasColumnType("nvarchar(max)"); + + b.Property("ConversionSupportGrantAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("ConversionSupportGrantAmountChanged") + .HasColumnType("bit"); + + b.Property("ConversionSupportGrantChangeReason") + .HasColumnType("nvarchar(max)"); + + b.Property("ConversionSupportGrantEnvironmentalImprovementGrant") + .HasColumnType("nvarchar(max)"); + + b.Property("ConversionSupportGrantType") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DaoPackSentDate") + .HasColumnType("datetime2"); + + b.Property("DiocesanConsent") + .HasColumnType("nvarchar(max)"); + + b.Property("DiocesanTrust") + .HasColumnType("nvarchar(max)"); + + b.Property("DistanceFromSchoolToTrustHeadquarters") + .HasColumnType("decimal(18,2)"); + + b.Property("DistanceFromSchoolToTrustHeadquartersAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("EndOfCurrentFinancialYear") + .HasColumnType("datetime2"); + + b.Property("EndOfNextFinancialYear") + .HasColumnType("datetime2"); + + b.Property("FinancialDeficit") + .HasColumnType("nvarchar(max)"); + + b.Property("Form7Received") + .HasColumnType("nvarchar(max)"); + + b.Property("Form7ReceivedDate") + .HasColumnType("datetime2"); + + b.Property("FoundationConsent") + .HasColumnType("nvarchar(max)"); + + b.Property("GoverningBodyResolution") + .HasColumnType("nvarchar(max)"); + + b.Property("HeadTeacherBoardDate") + .HasColumnType("datetime2"); + + b.Property("IfdPipelineId") + .HasColumnType("int"); + + b.Property("KeyStage2PerformanceAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("KeyStage4PerformanceAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("KeyStage5PerformanceAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModifiedOn") + .HasColumnType("datetime2"); + + b.Property("LegalRequirementsSectionComplete") + .HasColumnType("bit"); + + b.Property("LocalAuthority") + .HasColumnType("nvarchar(max)"); + + b.Property("LocalAuthorityInformationTemplateComments") + .HasColumnType("nvarchar(max)"); + + b.Property("LocalAuthorityInformationTemplateLink") + .HasColumnType("nvarchar(max)"); + + b.Property("LocalAuthorityInformationTemplateReturnedDate") + .HasColumnType("datetime2"); + + b.Property("LocalAuthorityInformationTemplateSectionComplete") + .HasColumnType("bit"); + + b.Property("LocalAuthorityInformationTemplateSentDate") + .HasColumnType("datetime2"); + + b.Property("MemberOfParliamentNameAndParty") + .HasColumnType("nvarchar(max)"); + + b.Property("NameOfTrust") + .HasColumnType("nvarchar(max)"); + + b.Property("PartOfPfiScheme") + .HasColumnType("nvarchar(max)"); + + b.Property("PercentageFreeSchoolMeals") + .HasColumnType("decimal(18,2)"); + + b.Property("PercentageOfGoodOrOutstandingSchoolsInTheDiocesanTrust") + .HasColumnType("decimal(18,2)"); + + b.Property("PfiSchemeDetails") + .HasColumnType("nvarchar(max)"); + + b.Property("PreviousHeadTeacherBoardDate") + .HasColumnType("datetime2"); + + b.Property("PreviousHeadTeacherBoardDateQuestion") + .HasColumnType("nvarchar(max)"); + + b.Property("PreviousHeadTeacherBoardLink") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectStatus") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectedRevenueBalanceAtEndMarchNextYear") + .HasColumnType("decimal(18,2)"); + + b.Property("ProposedAcademyOpeningDate") + .HasColumnType("datetime2"); + + b.Property("PublishedAdmissionNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("RationaleForProject") + .HasColumnType("nvarchar(max)"); + + b.Property("RationaleForTrust") + .HasColumnType("nvarchar(max)"); + + b.Property("RationaleSectionComplete") + .HasColumnType("bit"); + + b.Property("RecommendationForProject") + .HasColumnType("nvarchar(max)"); + + b.Property("Region") + .HasColumnType("nvarchar(max)"); + + b.Property("RevenueCarryForwardAtEndMarchCurrentYear") + .HasColumnType("decimal(18,2)"); + + b.Property("RisksAndIssues") + .HasColumnType("nvarchar(max)"); + + b.Property("RisksAndIssuesSectionComplete") + .HasColumnType("bit"); + + b.Property("SchoolAndTrustInformationSectionComplete") + .HasColumnType("bit"); + + b.Property("SchoolBudgetInformationAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("SchoolBudgetInformationSectionComplete") + .HasColumnType("bit"); + + b.Property("SchoolName") + .HasColumnType("nvarchar(max)"); + + b.Property("SchoolOverviewSectionComplete") + .HasColumnType("bit"); + + b.Property("SchoolPerformanceAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("SchoolPhase") + .HasColumnType("nvarchar(max)"); + + b.Property("SchoolPupilForecastsAdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("SchoolType") + .HasColumnType("nvarchar(max)"); + + b.Property("SponsorName") + .HasColumnType("nvarchar(max)"); + + b.Property("SponsorReferenceNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("TrustReferenceNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("Urn") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("nvarchar(max)"); + + b.Property("ViabilityIssues") + .HasColumnType("nvarchar(max)"); + + b.Property("YearOneProjectedCapacity") + .HasColumnType("int"); + + b.Property("YearOneProjectedPupilNumbers") + .HasColumnType("int"); + + b.Property("YearThreeProjectedCapacity") + .HasColumnType("int"); + + b.Property("YearThreeProjectedPupilNumbers") + .HasColumnType("int"); + + b.Property("YearTwoProjectedCapacity") + .HasColumnType("int"); + + b.Property("YearTwoProjectedPupilNumbers") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Project", "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.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("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("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("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("IncomingTrustUkprn") + .IsRequired() + .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.ConversionAdvisoryBoardDecisionDeclinedReasonState", b => + { + b.HasOne("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.ConversionAdvisoryBoardDecisionState", null) + .WithMany("DeclinedReasons") + .HasForeignKey("AdvisoryBoardDecisionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.ConversionAdvisoryBoardDecisionDeferredReasonState", b => + { + b.HasOne("Dfe.Academies.Academisation.Data.ConversionAdvisoryBoardDecisionAggregate.ConversionAdvisoryBoardDecisionState", null) + .WithMany("DeferredReasons") + .HasForeignKey("AdvisoryBoardDecisionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ProjectAggregate.ProjectNoteState", b => + { + b.HasOne("Dfe.Academies.Academisation.Data.ProjectAggregate.ProjectState", null) + .WithMany("Notes") + .HasForeignKey("ProjectId") + .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.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.ConversionAdvisoryBoardDecisionState", b => + { + b.Navigation("DeclinedReasons"); + + b.Navigation("DeferredReasons"); + }); + + modelBuilder.Entity("Dfe.Academies.Academisation.Data.ProjectAggregate.ProjectState", b => + { + b.Navigation("Notes"); + }); + + 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.TransferProjectAggregate.TransferProject", b => + { + b.Navigation("IntendedTransferBenefits"); + + b.Navigation("TransferringAcademies"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Dfe.Academies.Academisation.Data/Migrations/20230904135623_SponsoredGrantAmountChangedBool.cs b/Dfe.Academies.Academisation.Data/Migrations/20230904135623_SponsoredGrantAmountChangedBool.cs new file mode 100644 index 00000000..e6dc1ecd --- /dev/null +++ b/Dfe.Academies.Academisation.Data/Migrations/20230904135623_SponsoredGrantAmountChangedBool.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Dfe.Academies.Academisation.Data.Migrations +{ + /// + public partial class SponsoredGrantAmountChangedBool : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ConversionSupportGrantAmountChanged", + schema: "academisation", + table: "Project", + type: "bit", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ConversionSupportGrantAmountChanged", + schema: "academisation", + table: "Project"); + } + } +} diff --git a/Dfe.Academies.Academisation.Data/Migrations/AcademisationContextModelSnapshot.cs b/Dfe.Academies.Academisation.Data/Migrations/AcademisationContextModelSnapshot.cs index 0cff6159..479f2ce1 100644 --- a/Dfe.Academies.Academisation.Data/Migrations/AcademisationContextModelSnapshot.cs +++ b/Dfe.Academies.Academisation.Data/Migrations/AcademisationContextModelSnapshot.cs @@ -223,6 +223,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ConversionSupportGrantAmount") .HasColumnType("decimal(18,2)"); + b.Property("ConversionSupportGrantAmountChanged") + .HasColumnType("bit"); + b.Property("ConversionSupportGrantChangeReason") .HasColumnType("nvarchar(max)"); diff --git a/Dfe.Academies.Academisation.Data/ProjectAggregate/ProjectState.cs b/Dfe.Academies.Academisation.Data/ProjectAggregate/ProjectState.cs index ebb7fb0b..3bee9b08 100644 --- a/Dfe.Academies.Academisation.Data/ProjectAggregate/ProjectState.cs +++ b/Dfe.Academies.Academisation.Data/ProjectAggregate/ProjectState.cs @@ -50,6 +50,7 @@ public class ProjectState : BaseEntity public string? ConversionSupportGrantChangeReason { get; set; } public string? ConversionSupportGrantType { get; set; } public string? ConversionSupportGrantEnvironmentalImprovementGrant { get; set; } + public bool? ConversionSupportGrantAmountChanged { get; set; } public string? Region { get; set; } // School Overview @@ -171,6 +172,7 @@ public Project MapToDomain() ConversionSupportGrantChangeReason = ConversionSupportGrantChangeReason, ConversionSupportGrantType = ConversionSupportGrantType, ConversionSupportGrantEnvironmentalImprovementGrant = ConversionSupportGrantEnvironmentalImprovementGrant, + ConversionSupportGrantAmountChanged = ConversionSupportGrantAmountChanged, Region = Region, // School Overview @@ -252,6 +254,7 @@ public Project MapToDomain() return new Project(Id, projectDetails); } + public static ProjectState MapFromDomain(IProject project) { return new ProjectState @@ -298,6 +301,7 @@ public static ProjectState MapFromDomain(IProject project) ConversionSupportGrantChangeReason = project.Details.ConversionSupportGrantChangeReason, ConversionSupportGrantType = project.Details.ConversionSupportGrantType, ConversionSupportGrantEnvironmentalImprovementGrant = project.Details.ConversionSupportGrantEnvironmentalImprovementGrant, + ConversionSupportGrantAmountChanged = project.Details.ConversionSupportGrantAmountChanged, Region = project.Details.Region, // School Overview diff --git a/Dfe.Academies.Academisation.Domain.Core/ProjectAggregate/ProjectDetails.cs b/Dfe.Academies.Academisation.Domain.Core/ProjectAggregate/ProjectDetails.cs index edffdf59..f1f0fc64 100644 --- a/Dfe.Academies.Academisation.Domain.Core/ProjectAggregate/ProjectDetails.cs +++ b/Dfe.Academies.Academisation.Domain.Core/ProjectAggregate/ProjectDetails.cs @@ -47,6 +47,7 @@ public sealed class ProjectDetails : IEquatable public string? ConversionSupportGrantChangeReason { get; init; } public string? ConversionSupportGrantType { get; init; } public string? ConversionSupportGrantEnvironmentalImprovementGrant { get; init; } + public bool? ConversionSupportGrantAmountChanged { get; init; } public string? Region { get; init; } public string? SchoolPhase { get; init; } public string? AgeRange { get; init; } @@ -97,6 +98,7 @@ public sealed class ProjectDetails : IEquatable public User? AssignedUser { get; init; } public ICollection Notes { get; init; } = new List(); public DateTime CreatedOn { get; set; } + public bool Equals(ProjectDetails? other) { @@ -162,6 +164,7 @@ public bool Equals(ProjectDetails? other) StringComparison.InvariantCultureIgnoreCase) && string.Equals(ConversionSupportGrantEnvironmentalImprovementGrant, other.ConversionSupportGrantEnvironmentalImprovementGrant, StringComparison.InvariantCultureIgnoreCase) && + ConversionSupportGrantAmountChanged == other.ConversionSupportGrantAmountChanged && string.Equals(Region, other.Region, StringComparison.InvariantCultureIgnoreCase) && string.Equals(SchoolPhase, other.SchoolPhase, StringComparison.InvariantCultureIgnoreCase) && string.Equals(AgeRange, other.AgeRange, StringComparison.InvariantCultureIgnoreCase) && @@ -280,6 +283,7 @@ public override int GetHashCode() hashCode.Add(ConversionSupportGrantChangeReason, StringComparer.InvariantCultureIgnoreCase); hashCode.Add(ConversionSupportGrantType, StringComparer.InvariantCultureIgnoreCase); hashCode.Add(ConversionSupportGrantEnvironmentalImprovementGrant, StringComparer.InvariantCultureIgnoreCase); + hashCode.Add(ConversionSupportGrantAmountChanged); hashCode.Add(Region, StringComparer.InvariantCultureIgnoreCase); hashCode.Add(SchoolPhase, StringComparer.InvariantCultureIgnoreCase); hashCode.Add(AgeRange, StringComparer.InvariantCultureIgnoreCase); diff --git a/Dfe.Academies.Academisation.Domain.UnitTest/ProjectAggregate/ProjectUpdateTests.cs b/Dfe.Academies.Academisation.Domain.UnitTest/ProjectAggregate/ProjectUpdateTests.cs index 76f8934e..808dbdd3 100644 --- a/Dfe.Academies.Academisation.Domain.UnitTest/ProjectAggregate/ProjectUpdateTests.cs +++ b/Dfe.Academies.Academisation.Domain.UnitTest/ProjectAggregate/ProjectUpdateTests.cs @@ -1,8 +1,10 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; using AutoFixture; using Dfe.Academies.Academisation.Core; using Dfe.Academies.Academisation.Domain.Core.ProjectAggregate; using Dfe.Academies.Academisation.Domain.ProjectAggregate; +using FluentAssertions; using Xunit; namespace Dfe.Academies.Academisation.Domain.UnitTest.ProjectAggregate; @@ -50,4 +52,89 @@ public void Update_WithDifferentUrn__ReturnsCommandValidationErrorResult_AndDoes () => Assert.Equivalent(existingProject, sut.Details) ); } + public static IEnumerable TypeChangedData => new List + { + new object[] { "fast track", "intermediate", 70000m, 90000m }, + new object[] { "fast track", "full", 70000m, 110000m }, + new object[] { "intermediate", "full", 90000m, 110000m } + }; + + [Theory] + [MemberData(nameof(TypeChangedData))] + public void CalculateDefaultSponsoredGrant_TypeChanged_ReturnsNewDefault(string existingType, string newType, decimal? currentAmount, decimal? expected) + { + var result = Project.CalculateDefaultSponsoredGrant(existingType, newType, currentAmount); + result.Should().Be(expected); + } + + public static IEnumerable TypeUnchangedData => new List + { + new object[] { "fast track", "fast track", 70000m, 70000m }, + new object[] { "intermediate", "intermediate", 90000m, 90000m }, + new object[] { "full", "full", 110000m, 110000m } + }; + + [Theory] + [MemberData(nameof(TypeUnchangedData))] + public void CalculateDefaultSponsoredGrant_TypeUnchanged_ReturnsCurrentAmount(string existingType, string newType, decimal? currentAmount, decimal? expected) + { + var result = Project.CalculateDefaultSponsoredGrant(existingType, newType, currentAmount); + result.Should().Be(expected); + } + + public static IEnumerable EmptyExistingTypeData => new List + { + new object[] { null, "fast track", null, 70000m }, + new object[] { null, "intermediate", null, 90000m }, + new object[] { null, "full", null, 110000m } + }; + + [Theory] + [MemberData(nameof(EmptyExistingTypeData))] + public void CalculateDefaultSponsoredGrant_EmptyExistingType_ReturnsNewDefault(string existingType, string newType, decimal? currentAmount, decimal? expected) + { + var result = Project.CalculateDefaultSponsoredGrant(existingType, newType, currentAmount); + result.Should().Be(expected); + } + + public static IEnumerable NullNewTypeData => new List + { + new object[] { "fast track", null, 70000m, 70000m }, + new object[] { "intermediate", null, 90000m, 90000m }, + new object[] { "full", null, 110000m, 110000m } + }; + + [Theory] + [MemberData(nameof(NullNewTypeData))] + public void CalculateDefaultSponsoredGrant_NullNewType_ReturnsCurrentAmount(string existingType, string newType, decimal? currentAmount, decimal? expected) + { + var result = Project.CalculateDefaultSponsoredGrant(existingType, newType, currentAmount); + result.Should().Be(expected); + } + + public static IEnumerable InvalidNewTypeData => new List + { + new object[] { "fast track", "invalid", 70000m, 70000m } + }; + + [Theory] + [MemberData(nameof(InvalidNewTypeData))] + public void CalculateDefaultSponsoredGrant_InvalidNewType_ReturnsCurrentAmount(string existingType, string newType, decimal? currentAmount, decimal? expected) + { + var result = Project.CalculateDefaultSponsoredGrant(existingType, newType, currentAmount); + result.Should().Be(expected); + } + + public static IEnumerable NullExistingAndNewTypeData => new List + { + new object[] { null, null, 50000m, 50000m } + }; + + [Theory] + [MemberData(nameof(NullExistingAndNewTypeData))] + public void CalculateDefaultSponsoredGrant_NullExistingAndNewType_ReturnsCurrentAmount(string existingType, string newType, decimal? currentAmount, decimal? expected) + { + var result = Project.CalculateDefaultSponsoredGrant(existingType, newType, currentAmount); + result.Should().Be(expected); + } } diff --git a/Dfe.Academies.Academisation.Domain/ProjectAggregate/Project.cs b/Dfe.Academies.Academisation.Domain/ProjectAggregate/Project.cs index 50147b85..b7ae5d78 100644 --- a/Dfe.Academies.Academisation.Domain/ProjectAggregate/Project.cs +++ b/Dfe.Academies.Academisation.Domain/ProjectAggregate/Project.cs @@ -198,10 +198,11 @@ public CommandResult Update(ProjectDetails detailsToUpdate) Form7ReceivedDate = detailsToUpdate.Form7ReceivedDate, ProposedAcademyOpeningDate = detailsToUpdate.ProposedAcademyOpeningDate, SchoolAndTrustInformationSectionComplete = detailsToUpdate.SchoolAndTrustInformationSectionComplete, - ConversionSupportGrantAmount = detailsToUpdate.ConversionSupportGrantAmount, - ConversionSupportGrantChangeReason = detailsToUpdate.ConversionSupportGrantChangeReason, + ConversionSupportGrantAmount = CalculateDefaultSponsoredGrant(Details.ConversionSupportGrantType, detailsToUpdate.ConversionSupportGrantType, detailsToUpdate.ConversionSupportGrantAmount), + ConversionSupportGrantChangeReason = NullifyGrantChangeReasonIfNeeded(detailsToUpdate.ConversionSupportGrantAmountChanged, detailsToUpdate.ConversionSupportGrantChangeReason), ConversionSupportGrantType = detailsToUpdate.ConversionSupportGrantType, ConversionSupportGrantEnvironmentalImprovementGrant = detailsToUpdate.ConversionSupportGrantEnvironmentalImprovementGrant, + ConversionSupportGrantAmountChanged = detailsToUpdate.ConversionSupportGrantAmountChanged, Region = detailsToUpdate.Region, // Annex B @@ -305,6 +306,54 @@ public CommandResult Update(ProjectDetails detailsToUpdate) if (user == null) return null; return new User(user.Id, user.FullName, user.EmailAddress); } -} + // Sponsored grant logic + private const string FastTrackGrantType = "fast track"; + private const string IntermediateGrantType = "intermediate"; + private const string FullGrantType = "full"; + const decimal FastTrackDefault = 70000; + const decimal IntermediateDefault = 90000; + const decimal FullDefault = 110000; + public static decimal? CalculateDefaultSponsoredGrant(string? existingConversionSupportGrantType, + string? newConversionSupportGrantType, decimal? currentGrantAmount) + { + // if it's empty and now becoming a type, set the default + if (string.IsNullOrEmpty(existingConversionSupportGrantType)) + { + return DetermineValueFromType(newConversionSupportGrantType, currentGrantAmount); + } + // if it's changed type set the new default + if (existingConversionSupportGrantType != newConversionSupportGrantType) + { + return DetermineValueFromType(newConversionSupportGrantType, currentGrantAmount); + } + + // if it's the same type remain unchanged + if (existingConversionSupportGrantType == newConversionSupportGrantType) + { + return currentGrantAmount; + } + + return currentGrantAmount; + } + + private static decimal? DetermineValueFromType(string? grantType, decimal? currentAmount) + { + return grantType?.ToLower() switch + { + FastTrackGrantType => FastTrackDefault, + IntermediateGrantType => IntermediateDefault, + FullGrantType => FullDefault, + _ => currentAmount + }; + } + protected string? NullifyGrantChangeReasonIfNeeded(bool? grantAmountChanged, string? reason) + { + return grantAmountChanged switch + { + true => reason, + false => null + }; + } +} diff --git a/Dfe.Academies.Academisation.IService/ServiceModels/Legacy/ProjectAggregate/LegacyProjectServiceModel.cs b/Dfe.Academies.Academisation.IService/ServiceModels/Legacy/ProjectAggregate/LegacyProjectServiceModel.cs index 33197701..ce42022e 100644 --- a/Dfe.Academies.Academisation.IService/ServiceModels/Legacy/ProjectAggregate/LegacyProjectServiceModel.cs +++ b/Dfe.Academies.Academisation.IService/ServiceModels/Legacy/ProjectAggregate/LegacyProjectServiceModel.cs @@ -51,6 +51,7 @@ public LegacyProjectServiceModel(int id, int urn) public string? ConversionSupportGrantChangeReason { get; init; } public string? ConversionSupportGrantType { get; init; } public string? ConversionSupportGrantEnvironmentalImprovementGrant { get; init; } + public bool? ConversionSupportGrantAmountChanged { get; init; } public string? Region { get; init; } [JsonIgnore] public string? SchoolPhase { get; init; } [JsonIgnore] public string? AgeRange { get; init; } diff --git a/Dfe.Academies.Academisation.Service/Commands/CypressData/CyAddSponsoredProjectCommandHandler.cs b/Dfe.Academies.Academisation.Service/Commands/CypressData/CyAddSponsoredProjectCommandHandler.cs index 2352469c..3ece98fa 100644 --- a/Dfe.Academies.Academisation.Service/Commands/CypressData/CyAddSponsoredProjectCommandHandler.cs +++ b/Dfe.Academies.Academisation.Service/Commands/CypressData/CyAddSponsoredProjectCommandHandler.cs @@ -30,7 +30,7 @@ public CyAddSponsoredProjectCommandHandler(AcademisationContext dbContext) : bas public async Task Handle(CyAddSponsoredProjectCommand request, CancellationToken cancellationToken) { // Define the project name - const string projectName = "Cypress Project"; + const string projectName = "Sponsored Cypress Project"; // Find the project var existingProject = await DbContext.Projects diff --git a/Dfe.Academies.Academisation.Service/Mappers/Legacy/ProjectAggregate/LegacyProjectDetailsMapper.cs b/Dfe.Academies.Academisation.Service/Mappers/Legacy/ProjectAggregate/LegacyProjectDetailsMapper.cs index a7e7525d..f5830e39 100644 --- a/Dfe.Academies.Academisation.Service/Mappers/Legacy/ProjectAggregate/LegacyProjectDetailsMapper.cs +++ b/Dfe.Academies.Academisation.Service/Mappers/Legacy/ProjectAggregate/LegacyProjectDetailsMapper.cs @@ -57,6 +57,7 @@ internal static ProjectDetails MapNonEmptyFields(this LegacyProjectServiceModel ConversionSupportGrantChangeReason = detailsToUpdate.ConversionSupportGrantChangeReason ?? existingProject.Details.ConversionSupportGrantChangeReason, ConversionSupportGrantType = detailsToUpdate.ConversionSupportGrantType ?? existingProject.Details.ConversionSupportGrantType, ConversionSupportGrantEnvironmentalImprovementGrant = detailsToUpdate.ConversionSupportGrantEnvironmentalImprovementGrant ?? existingProject.Details.ConversionSupportGrantEnvironmentalImprovementGrant, + ConversionSupportGrantAmountChanged = detailsToUpdate.ConversionSupportGrantAmountChanged ?? existingProject.Details.ConversionSupportGrantAmountChanged, Region = detailsToUpdate.Region ?? existingProject.Details.Region, // Annex B diff --git a/Dfe.Academies.Academisation.Service/Mappers/Legacy/ProjectAggregate/LegacyProjectServiceModelMapper.cs b/Dfe.Academies.Academisation.Service/Mappers/Legacy/ProjectAggregate/LegacyProjectServiceModelMapper.cs index dfdd9046..3993d52e 100644 --- a/Dfe.Academies.Academisation.Service/Mappers/Legacy/ProjectAggregate/LegacyProjectServiceModelMapper.cs +++ b/Dfe.Academies.Academisation.Service/Mappers/Legacy/ProjectAggregate/LegacyProjectServiceModelMapper.cs @@ -52,6 +52,7 @@ internal static LegacyProjectServiceModel MapToServiceModel(this IProject projec ConversionSupportGrantChangeReason = project.Details.ConversionSupportGrantChangeReason, ConversionSupportGrantType = project.Details.ConversionSupportGrantType, ConversionSupportGrantEnvironmentalImprovementGrant = project.Details.ConversionSupportGrantEnvironmentalImprovementGrant, + ConversionSupportGrantAmountChanged = project.Details.ConversionSupportGrantAmountChanged, Region = project.Details.Region, // School Overview diff --git a/Dfe.Academies.Academisation.Service/Queries/TransferProjectQueryService.cs b/Dfe.Academies.Academisation.Service/Queries/TransferProjectQueryService.cs index 78d34408..8b88ce7d 100644 --- a/Dfe.Academies.Academisation.Service/Queries/TransferProjectQueryService.cs +++ b/Dfe.Academies.Academisation.Service/Queries/TransferProjectQueryService.cs @@ -52,10 +52,7 @@ public async Task> Ge //the logic retrieving the trust data goes here IEnumerable projects = - FilterByIncomingTrust(title, AcademyTransferProjectSummaryResponse(transferProjects)); - - //this is placeholder code - var recordTotal = projects.Count(); + FilterByIncomingTrust(title, AcademyTransferProjectSummaryResponse(transferProjects)); projects = projects // remove any projects without an incoming or outgoing trust. @@ -65,6 +62,7 @@ public async Task> Ge .OrderByDescending(atp => atp.ProjectUrn) .Skip((page - 1) * count).Take(count).ToList(); + var recordTotal = projects.Count(); return await Task.FromResult(new PagedResultResponse(projects, recordTotal)); } diff --git a/Dfe.Academies.Academisation.SubcutaneousTest/ProjectAggregate/LegacyProjectUpdateTests.cs b/Dfe.Academies.Academisation.SubcutaneousTest/ProjectAggregate/LegacyProjectUpdateTests.cs index ce21ac59..5c330a94 100644 --- a/Dfe.Academies.Academisation.SubcutaneousTest/ProjectAggregate/LegacyProjectUpdateTests.cs +++ b/Dfe.Academies.Academisation.SubcutaneousTest/ProjectAggregate/LegacyProjectUpdateTests.cs @@ -184,6 +184,7 @@ public async Task ProjectExists___PartialProjectIsUpdated() () => Assert.Equal(existingProject.ConversionSupportGrantChangeReason, getProject.ConversionSupportGrantChangeReason), () => Assert.Equal(existingProject.ConversionSupportGrantType, getProject.ConversionSupportGrantType), () => Assert.Equal(existingProject.ConversionSupportGrantEnvironmentalImprovementGrant, getProject.ConversionSupportGrantEnvironmentalImprovementGrant), + () => Assert.Equal(existingProject.ConversionSupportGrantAmountChanged, getProject.ConversionSupportGrantAmountChanged), () => Assert.Equal(existingProject.ProjectStatus, getProject.ProjectStatus) ); } diff --git a/terraform/.terraform.lock.hcl b/terraform/.terraform.lock.hcl index df52930f..3a196552 100644 --- a/terraform/.terraform.lock.hcl +++ b/terraform/.terraform.lock.hcl @@ -2,22 +2,21 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/azure/azapi" { - version = "1.7.0" - constraints = ">= 1.5.0, >= 1.6.0" + version = "1.8.0" + constraints = ">= 1.5.0" hashes = [ - "h1:EmX0mG99yoDK1Axglpet/xGLVAV6QHOadcklDdlaU0I=", - "zh:39713f9aa01824a6db818dffcb2fff9175cf888c70c6805e1dced17d42dd0d24", - "zh:4bb38a1861491ea380d5fe65062b73299aab49ec5baf58ad55edd9c99b2f5072", - "zh:4d572e30973b8dd1936ee60a2fd3dab201ec55ea16521905b06ac7e8e41ecc57", - "zh:78200e4e0a0f515a0c5752cb79954a4cd06b9eb2c70241cebff7372c212e5d94", - "zh:78675e6345890d0e04041abd2c14cc5f4f011e9482484a45856f2ac7a9931e76", - "zh:a4e8ade7559febda858b406116595d8fab27290751c4b09817bbd56af79c146f", - "zh:a7761ed0fb78dfb773a81af953ba4a552642bbe76e9ad7e373e1a98875b9206f", - "zh:aaa8da2ead6eb3b37a74e4a123788c099635ee8ef6236b26a4eb6f27c1626f0b", - "zh:b1e146bee793751ee432e5eb538feda225e78c63cd79e1f3ef05ef7a5dd02b5d", - "zh:d415471c445eada01a7bedf5fe3132b937488b80d99454403991b3f96e092f85", - "zh:dc984774af24948ffe1f1611f443380e204a465e3512045b5c1e6c8e845a8d3f", - "zh:eb95f8d87116bc8b3a8b2be2d80216da21d4274329fbc69033d3c0062c3345cc", + "h1:3p6LGnTfsUvFGkxNe5M+na2cuhG0iYvPHK5/pzHVQoo=", + "h1:66wcpJVFTtT5cjri/MBL2k7CtIa0BCf4W/mAqcqZ270=", + "h1:FTJmhSy+PRKv0QKqeOje6LyzeNeNVT2omBjAb+msGLM=", + "h1:MePG5WUMw8n7qgxsZ6s8ku+wiSirffGJRQmolQucYH8=", + "h1:NMaaL/sDeIL1yT6mU0mbZAFOdJ96ll830VBfnoalrZ4=", + "h1:VBGMFCzcEfzJ0yA7ZOlihFbozBjHQ5+t+FON7ZhS/II=", + "h1:bJAfhdipsPIkhAumt8f6wbHJPLuTvlWT20shbaycG7U=", + "h1:c/b8qcU4hwWh6vHF/MyS2l4uMkAGcQzDNO1TeaKPoJo=", + "h1:eycnHz0+0SPwuBHpVyGGldPUDimfa14lEmTM0g0azs0=", + "h1:h6fJwnaQJMxaXJhWdfgDC8OUGfo2uRiVT1Hq+iiUjVg=", + "h1:tx6sAGdQTzovvCZudCzhBPx7uWT8Ka1seK7zFwVhHJg=", + "h1:yIp0ToKt+t64spKj5Vhqo7wihrQ29uHP7qCWpMZ0R/s=", ] }