From 8e92965769d7a172e6bca086efbd2c51d6014b9b Mon Sep 17 00:00:00 2001 From: Dominic NEED Date: Thu, 5 Oct 2023 11:35:16 +0100 Subject: [PATCH 1/2] Remove a2b --- .../A2BApplicationControllerTests.cs | 131 ------ .../Factories/A2BApplicationFactoryTests.cs | 143 ------ .../A2BApplicationKeyPersonsFactoryTests.cs | 64 --- .../A2BApplyingSchoolFactoryTests.cs | 275 ------------ .../Factories/A2BSchoolLeaseFactoryTests.cs | 44 -- .../A2BSchoolLeaseServiceModelFactoryTests.cs | 44 -- .../Factories/A2BSchoolLoanFactoryTests.cs | 42 -- .../A2BSchoolLoanServiceModelFactoryTests.cs | 42 -- .../ApplyToBecomeIntegrationTests.cs | 419 ------------------ .../UseCases/CreateA2BApplicationTests.cs | 136 ------ .../UseCases/GetA2BApplicationTests.cs | 54 --- .../V2/A2BApplicationController.cs | 62 --- TramsDataApi/DatabaseModels/A2BApplication.cs | 56 --- .../A2BApplicationApplyingSchool.cs | 139 ------ .../A2BApplicationKeyPersons.cs | 30 -- TramsDataApi/DatabaseModels/A2BSchoolLease.cs | 33 -- TramsDataApi/DatabaseModels/A2BSchoolLoan.cs | 26 -- TramsDataApi/DatabaseModels/TramsDbContext.cs | 5 - .../A2BApplicationApplyingSchoolFactory.cs | 242 ---------- .../A2BApplicationFactory.cs | 108 ----- .../A2BApplicationKeyPersonsFactory.cs | 42 -- .../A2BSchoolLeaseFactory.cs | 25 -- .../A2BSchoolLeaseServiceModelFactory.cs | 25 -- .../A2BSchoolLoanFactory.cs | 23 - .../A2BSchoolLoanServiceModelFactory.cs | 23 - .../Gateways/A2BApplicationGateway.cs | 58 --- .../Gateways/IA2BApplicationGateway.cs | 10 - .../A2BApplicationCreateRequest.cs | 54 --- .../A2BApplicationStatusCreateRequest.cs | 7 - .../A2BContributorCreateRequest.cs | 10 - .../ApplyToBecome/A2BApplicationResponse.cs | 49 -- .../A2BApplicationStatusResponse.cs | 8 - .../ApplyToBecome/A2BContributorResponse.cs | 10 - ...2BApplicationApplyingSchoolServiceModel.cs | 109 ----- .../A2BApplicationKeyPersonsServiceModel.cs | 18 - .../A2BFinancialYearServiceModel.cs | 18 - .../A2BSchoolLeaseServiceModel.cs | 16 - .../A2BSchoolLoanServiceModel.cs | 14 - TramsDataApi/Startup.cs | 5 +- TramsDataApi/TramsDataApi.csproj | 1 + TramsDataApi/UseCases/CreateA2BApplication.cs | 26 -- TramsDataApi/UseCases/GetA2BApplication.cs | 26 -- .../UseCases/ICreateA2BApplication.cs | 10 - .../UseCases/ICreateA2BApplicationStatus.cs | 10 - .../UseCases/ICreateA2BContributor.cs | 10 - TramsDataApi/UseCases/IGetA2BApplication.cs | 10 - .../UseCases/IGetA2BApplicationStatus.cs | 9 - TramsDataApi/UseCases/IGetA2BContributor.cs | 9 - 48 files changed, 2 insertions(+), 2728 deletions(-) delete mode 100644 TramsDataApi.Test/Controllers/A2BApplicationControllerTests.cs delete mode 100644 TramsDataApi.Test/Factories/A2BApplicationFactoryTests.cs delete mode 100644 TramsDataApi.Test/Factories/A2BApplicationKeyPersonsFactoryTests.cs delete mode 100644 TramsDataApi.Test/Factories/A2BApplyingSchoolFactoryTests.cs delete mode 100644 TramsDataApi.Test/Factories/A2BSchoolLeaseFactoryTests.cs delete mode 100644 TramsDataApi.Test/Factories/A2BSchoolLeaseServiceModelFactoryTests.cs delete mode 100644 TramsDataApi.Test/Factories/A2BSchoolLoanFactoryTests.cs delete mode 100644 TramsDataApi.Test/Factories/A2BSchoolLoanServiceModelFactoryTests.cs delete mode 100644 TramsDataApi.Test/Integration/ApplyToBecomeIntegrationTests.cs delete mode 100644 TramsDataApi.Test/UseCases/CreateA2BApplicationTests.cs delete mode 100644 TramsDataApi.Test/UseCases/GetA2BApplicationTests.cs delete mode 100644 TramsDataApi/Controllers/V2/A2BApplicationController.cs delete mode 100644 TramsDataApi/DatabaseModels/A2BApplication.cs delete mode 100644 TramsDataApi/DatabaseModels/A2BApplicationApplyingSchool.cs delete mode 100644 TramsDataApi/DatabaseModels/A2BApplicationKeyPersons.cs delete mode 100644 TramsDataApi/DatabaseModels/A2BSchoolLease.cs delete mode 100644 TramsDataApi/DatabaseModels/A2BSchoolLoan.cs delete mode 100644 TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationApplyingSchoolFactory.cs delete mode 100644 TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationFactory.cs delete mode 100644 TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationKeyPersonsFactory.cs delete mode 100644 TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLeaseFactory.cs delete mode 100644 TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLeaseServiceModelFactory.cs delete mode 100644 TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLoanFactory.cs delete mode 100644 TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLoanServiceModelFactory.cs delete mode 100644 TramsDataApi/Gateways/A2BApplicationGateway.cs delete mode 100644 TramsDataApi/Gateways/IA2BApplicationGateway.cs delete mode 100644 TramsDataApi/RequestModels/ApplyToBecome/A2BApplicationCreateRequest.cs delete mode 100644 TramsDataApi/RequestModels/ApplyToBecome/A2BApplicationStatusCreateRequest.cs delete mode 100644 TramsDataApi/RequestModels/ApplyToBecome/A2BContributorCreateRequest.cs delete mode 100644 TramsDataApi/ResponseModels/ApplyToBecome/A2BApplicationResponse.cs delete mode 100644 TramsDataApi/ResponseModels/ApplyToBecome/A2BApplicationStatusResponse.cs delete mode 100644 TramsDataApi/ResponseModels/ApplyToBecome/A2BContributorResponse.cs delete mode 100644 TramsDataApi/ServiceModels/ApplyToBecome/A2BApplicationApplyingSchoolServiceModel.cs delete mode 100644 TramsDataApi/ServiceModels/ApplyToBecome/A2BApplicationKeyPersonsServiceModel.cs delete mode 100644 TramsDataApi/ServiceModels/ApplyToBecome/A2BFinancialYearServiceModel.cs delete mode 100644 TramsDataApi/ServiceModels/ApplyToBecome/A2BSchoolLeaseServiceModel.cs delete mode 100644 TramsDataApi/ServiceModels/ApplyToBecome/A2BSchoolLoanServiceModel.cs delete mode 100644 TramsDataApi/UseCases/CreateA2BApplication.cs delete mode 100644 TramsDataApi/UseCases/GetA2BApplication.cs delete mode 100644 TramsDataApi/UseCases/ICreateA2BApplication.cs delete mode 100644 TramsDataApi/UseCases/ICreateA2BApplicationStatus.cs delete mode 100644 TramsDataApi/UseCases/ICreateA2BContributor.cs delete mode 100644 TramsDataApi/UseCases/IGetA2BApplication.cs delete mode 100644 TramsDataApi/UseCases/IGetA2BApplicationStatus.cs delete mode 100644 TramsDataApi/UseCases/IGetA2BContributor.cs diff --git a/TramsDataApi.Test/Controllers/A2BApplicationControllerTests.cs b/TramsDataApi.Test/Controllers/A2BApplicationControllerTests.cs deleted file mode 100644 index 570a5719a..000000000 --- a/TramsDataApi.Test/Controllers/A2BApplicationControllerTests.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using System.Collections.Generic; -using FizzWare.NBuilder; -using Microsoft.Extensions.Logging; -using Moq; -using FluentAssertions; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using TramsDataApi.Controllers.V2; -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ResponseModels; -using TramsDataApi.ResponseModels.ApplyToBecome; -using TramsDataApi.UseCases; -using Xunit; -using TramsDataApi.ServiceModels.ApplyToBecome; - -namespace TramsDataApi.Test.Controllers -{ - public class A2BApplicationControllerTests - { - private readonly Mock> _mockLogger; - - public A2BApplicationControllerTests() - { - _mockLogger = new Mock>(); - } - - [Fact] - public void GetApplicationByApplicationId_ReturnsApiSingleResponseWithApplicationWhenApplicationExists() - { - const string applicationId = "10001"; - var mockUseCase = new Mock(); - - var response = Builder - .CreateNew() - .With(r => r.ApplicationId = applicationId) - .Build(); - - var expectedResponse = new ApiSingleResponseV2(response); - - mockUseCase - .Setup(x => x.Execute(It.IsAny())) - .Returns(response); - - var controller = new A2BApplicationController(_mockLogger.Object, mockUseCase.Object, new Mock().Object); - - var result = controller.GetApplicationByApplicationId(applicationId); - - result.Result.Should().BeEquivalentTo(new OkObjectResult(expectedResponse)); - } - - [Fact] - public void GetApplicationByApplicationId_ReturnsNotFound_WhenApplicationNotFound() - { - - var expectedResponse = new NotFoundResult(); - var mockUseCase = new Mock(); - - var controller = new A2BApplicationController(_mockLogger.Object, mockUseCase.Object, new Mock().Object); - - var result = controller.GetApplicationByApplicationId("10001"); - - result.Result.Should().BeEquivalentTo(expectedResponse); - } - - [Fact] - public void Create_Returns201_WithCreatedObject_WhenApplicationCreated() - { - const string applicationId = "10001"; - - var keyPerson = Builder.CreateNew().Build(); - var applyingSchool = Builder.CreateNew().Build(); - - var request = Builder - .CreateNew() - .With(r => r.ApplicationId = applicationId) - .With(r => r.ApplicationType = "JoinMat") - .With(r => r.KeyPersons = new List {keyPerson}) - .With(r => r.ApplyingSchools = new List {applyingSchool}) - .Build(); - - var expectedApplicationResponse = new A2BApplicationResponse - { - ApplicationId = applicationId, - Name = request.Name, - ApplicationType = request.ApplicationType, - TrustId = request.TrustId, - FormTrustProposedNameOfTrust = request.FormTrustProposedNameOfTrust, - ApplicationSubmitted = request.ApplicationSubmitted, - ApplicationLeadAuthorId = request.ApplicationLeadAuthorId, - ApplicationVersion = request.ApplicationVersion, - ApplicationLeadAuthorName = request.ApplicationLeadAuthorName, - ApplicationRole = request.ApplicationRole, - ApplicationRoleOtherDescription = request.ApplicationRoleOtherDescription, - ChangesToTrust = request.ChangesToTrust, - ChangesToTrustExplained = request.ChangesToTrustExplained, - FormTrustOpeningDate = request.FormTrustOpeningDate, - TrustApproverName = request.TrustApproverName, - TrustApproverEmail = request.TrustApproverEmail, - FormTrustReasonApprovalToConvertAsSat = request.FormTrustReasonApprovalToConvertAsSat, - FormTrustReasonApprovedPerson = request.FormTrustReasonApprovedPerson, - FormTrustReasonForming = request.FormTrustReasonForming, - FormTrustReasonVision = request.FormTrustReasonVision, - FormTrustReasonGeoAreas = request.FormTrustReasonGeoAreas, - FormTrustReasonFreedom = request.FormTrustReasonFreedom, - FormTrustReasonImproveTeaching = request.FormTrustReasonImproveTeaching, - FormTrustPlanForGrowth = request.FormTrustPlanForGrowth, - FormTrustPlansForNoGrowth = request.FormTrustPlansForNoGrowth, - FormTrustGrowthPlansYesNo = request.FormTrustGrowthPlansYesNo, - FormTrustImprovementSupport = request.FormTrustImprovementSupport, - FormTrustImprovementStrategy = request.FormTrustImprovementStrategy, - FormTrustImprovementApprovedSponsor = request.FormTrustImprovementApprovedSponsor, - KeyPersons = request.KeyPersons, - ApplyingSchools = request.ApplyingSchools, - DynamicsApplicationId = request.DynamicsApplicationId - }; - - var expectedResponse = new ApiSingleResponseV2(expectedApplicationResponse); - var expectedResult = new ObjectResult(expectedResponse) {StatusCode = StatusCodes.Status201Created}; - - var mockUseCase = new Mock(); - mockUseCase.Setup(u => u.Execute(It.IsAny())).Returns(expectedApplicationResponse); - - var controller = new A2BApplicationController(_mockLogger.Object, new Mock().Object, mockUseCase.Object); - - var controllerResponse = controller.Create(request); - - controllerResponse.Result.Should().BeEquivalentTo(expectedResult); - } - } -} \ No newline at end of file diff --git a/TramsDataApi.Test/Factories/A2BApplicationFactoryTests.cs b/TramsDataApi.Test/Factories/A2BApplicationFactoryTests.cs deleted file mode 100644 index cb8795e52..000000000 --- a/TramsDataApi.Test/Factories/A2BApplicationFactoryTests.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using FluentAssertions; -using FizzWare.NBuilder; -using TramsDataApi.DatabaseModels; -using TramsDataApi.Factories.A2BApplicationFactories; -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ResponseModels.ApplyToBecome; -using Xunit; -using TramsDataApi.ServiceModels.ApplyToBecome; - -namespace TramsDataApi.Test.Factories -{ - public class A2BApplicationFactoryTests - { - [Fact] - public void Create_ReturnsExpectedA2BApplication_WhenA2BApplicationCreateRequestIsProvided() - { - var keyPerson = Builder.CreateNew().Build(); - var financialYear = Builder.CreateNew().Build(); - var applyingSchool = Builder - .CreateNew() - .With(r => r.PreviousFinancialYear = financialYear) - .With(r => r.CurrentFinancialYear = financialYear) - .With(r => r.NextFinancialYear = financialYear) - .Build(); - var applicationCreateRequest = Builder - .CreateNew() - .With(r => r.ApplicationType = "JoinMat") - .With(r => r.KeyPersons = new List { keyPerson }) - .With(r => r.ApplyingSchools = new List { applyingSchool }) - .Build(); - - var expectedApplication = new A2BApplication - { - ApplicationId = applicationCreateRequest.ApplicationId, - Name = applicationCreateRequest.Name, - TrustName = applicationCreateRequest.TrustName, - ApplicationType = applicationCreateRequest.ApplicationType, - FormTrustProposedNameOfTrust = applicationCreateRequest.FormTrustProposedNameOfTrust, - ApplicationSubmitted = applicationCreateRequest.ApplicationSubmitted, - ApplicationLeadAuthorId = applicationCreateRequest.ApplicationLeadAuthorId, - ApplicationVersion = applicationCreateRequest.ApplicationVersion, - ApplicationLeadAuthorName = applicationCreateRequest.ApplicationLeadAuthorName, - ApplicationLeadEmail = applicationCreateRequest.ApplicationLeadEmail, - ApplicationRole = applicationCreateRequest.ApplicationRole, - ApplicationRoleOtherDescription = applicationCreateRequest.ApplicationRoleOtherDescription, - ChangesToTrust = applicationCreateRequest.ChangesToTrust, - ChangesToTrustExplained = applicationCreateRequest.ChangesToTrustExplained, - ChangesToLaGovernance = applicationCreateRequest.ChangesToLaGovernance, - ChangesToLaGovernanceExplained = applicationCreateRequest.ChangesToLaGovernanceExplained, - FormTrustOpeningDate = applicationCreateRequest.FormTrustOpeningDate, - TrustId = applicationCreateRequest.TrustId, - TrustApproverName = applicationCreateRequest.TrustApproverName, - TrustApproverEmail = applicationCreateRequest.TrustApproverEmail, - FormTrustReasonApprovalToConvertAsSat = applicationCreateRequest.FormTrustReasonApprovalToConvertAsSat, - FormTrustReasonApprovedPerson = applicationCreateRequest.FormTrustReasonApprovedPerson, - FormTrustReasonForming = applicationCreateRequest.FormTrustReasonForming, - FormTrustReasonVision = applicationCreateRequest.FormTrustReasonVision, - FormTrustReasonGeoAreas = applicationCreateRequest.FormTrustReasonGeoAreas, - FormTrustReasonFreedom = applicationCreateRequest.FormTrustReasonFreedom, - FormTrustReasonImproveTeaching = applicationCreateRequest.FormTrustReasonImproveTeaching, - FormTrustPlanForGrowth = applicationCreateRequest.FormTrustPlanForGrowth, - FormTrustPlansForNoGrowth = applicationCreateRequest.FormTrustPlansForNoGrowth, - FormTrustGrowthPlansYesNo = applicationCreateRequest.FormTrustGrowthPlansYesNo, - FormTrustImprovementSupport = applicationCreateRequest.FormTrustImprovementSupport, - FormTrustImprovementStrategy = applicationCreateRequest.FormTrustImprovementStrategy, - FormTrustImprovementApprovedSponsor = applicationCreateRequest.FormTrustImprovementApprovedSponsor, - ApplicationStatusId = applicationCreateRequest.ApplicationStatusId, - KeyPersons = applicationCreateRequest.KeyPersons.Select(A2BApplicationKeyPersonsFactory.Create).ToList(), - ApplyingSchools = applicationCreateRequest.ApplyingSchools.Select(A2BApplicationApplyingSchoolFactory.Create).ToList(), - DynamicsApplicationId = applicationCreateRequest.DynamicsApplicationId - }; - - var response = A2BApplicationFactory.Create(applicationCreateRequest); - - response.Should().BeEquivalentTo(expectedApplication); - } - - [Fact] - public void Create_ReturnsExpectedA2BApplicationResponse_WhenA2BApplicationIsProvided() - { - var keyPerson = Builder.CreateNew().Build(); - var applyingSchool = Builder.CreateNew().Build(); - - var application = Builder - .CreateNew() - .With(a => a.ApplicationType = "JoinMat") - .With(a => a.KeyPersons = new List {keyPerson}) - .With(a => a.ApplyingSchools = new List { applyingSchool }) - .Build(); - - var expectedResponse = new A2BApplicationResponse - { - Name = application.Name, - TrustName = application.TrustName, - ApplicationId = application.ApplicationId, - ApplicationType = application.ApplicationType, - FormTrustProposedNameOfTrust = application.FormTrustProposedNameOfTrust, - ApplicationSubmitted = application.ApplicationSubmitted, - ApplicationLeadAuthorId = application.ApplicationLeadAuthorId, - ApplicationVersion = application.ApplicationVersion, - ApplicationLeadAuthorName = application.ApplicationLeadAuthorName, - ApplicationLeadEmail = application.ApplicationLeadEmail, - ApplicationRole = application.ApplicationRole, - ApplicationRoleOtherDescription = application.ApplicationRoleOtherDescription, - ChangesToTrust = application.ChangesToTrust, - ChangesToTrustExplained = application.ChangesToTrustExplained, - ChangesToLaGovernance = application.ChangesToLaGovernance, - ChangesToLaGovernanceExplained = application.ChangesToLaGovernanceExplained, - FormTrustOpeningDate = application.FormTrustOpeningDate, - TrustId = application.TrustId, - TrustApproverName = application.TrustApproverName, - TrustApproverEmail = application.TrustApproverEmail, - FormTrustReasonApprovalToConvertAsSat = application.FormTrustReasonApprovalToConvertAsSat, - FormTrustReasonApprovedPerson = application.FormTrustReasonApprovedPerson, - FormTrustReasonForming = application.FormTrustReasonForming, - FormTrustReasonVision = application.FormTrustReasonVision, - FormTrustReasonGeoAreas = application.FormTrustReasonGeoAreas, - FormTrustReasonFreedom = application.FormTrustReasonFreedom, - FormTrustReasonImproveTeaching = application.FormTrustReasonImproveTeaching, - FormTrustPlanForGrowth = application.FormTrustPlanForGrowth, - FormTrustPlansForNoGrowth = application.FormTrustPlansForNoGrowth, - FormTrustGrowthPlansYesNo = application.FormTrustGrowthPlansYesNo, - FormTrustImprovementSupport = application.FormTrustImprovementSupport, - FormTrustImprovementStrategy = application.FormTrustImprovementStrategy, - FormTrustImprovementApprovedSponsor = application.FormTrustImprovementApprovedSponsor, - ApplicationStatusId = application.ApplicationStatusId, - KeyPersons = application.KeyPersons - .Select(A2BApplicationKeyPersonsFactory.Create) - .ToList(), - ApplyingSchools = application.ApplyingSchools - .Select(A2BApplicationApplyingSchoolFactory.Create) - .ToList(), - DynamicsApplicationId = application.DynamicsApplicationId - }; - - var response = A2BApplicationFactory.Create(application); - - response.Should().BeEquivalentTo(expectedResponse); - } - } -} \ No newline at end of file diff --git a/TramsDataApi.Test/Factories/A2BApplicationKeyPersonsFactoryTests.cs b/TramsDataApi.Test/Factories/A2BApplicationKeyPersonsFactoryTests.cs deleted file mode 100644 index 41509e946..000000000 --- a/TramsDataApi.Test/Factories/A2BApplicationKeyPersonsFactoryTests.cs +++ /dev/null @@ -1,64 +0,0 @@ -using FluentAssertions; -using FizzWare.NBuilder; -using TramsDataApi.DatabaseModels; -using TramsDataApi.Factories.A2BApplicationFactories; -using TramsDataApi.RequestModels.ApplyToBecome; -using Xunit; - -namespace TramsDataApi.Test.Factories -{ - public class A2BApplicationKeyPersonsFactoryTests - { - [Fact] - public void Create_ReturnsExpectedA2BApplicationKeyPerson_WhenA2BApplicationKeyPersonsModelIsProvided() - { - var keyPersonsModel = Builder - .CreateNew() - .Build(); - - var expectedKeyPersons = new A2BApplicationKeyPersons - { - Name = keyPersonsModel.Name, - KeyPersonDateOfBirth = keyPersonsModel.KeyPersonDateOfBirth, - KeyPersonBiography = keyPersonsModel.KeyPersonBiography, - KeyPersonCeoExecutive = keyPersonsModel.KeyPersonCeoExecutive, - KeyPersonChairOfTrust = keyPersonsModel.KeyPersonChairOfTrust, - KeyPersonFinancialDirector = keyPersonsModel.KeyPersonFinancialDirector, - KeyPersonMember = keyPersonsModel.KeyPersonMember, - KeyPersonOther = keyPersonsModel.KeyPersonOther, - KeyPersonTrustee = keyPersonsModel.KeyPersonTrustee, - DynamicsKeyPersonId = keyPersonsModel.DynamicsKeyPersonId - }; - - var response = A2BApplicationKeyPersonsFactory.Create(keyPersonsModel); - - response.Should().BeEquivalentTo(expectedKeyPersons); - } - - [Fact] - public void Create_ReturnsExpectedA2BApplicationKeyPersonsModel_WhenA2BApplicationKeyPersonsIsProvided() - { - var keyPersons = Builder - .CreateNew() - .Build(); - - var expectedKeyPersonsModel = new A2BApplicationKeyPersonsServiceModel - { - Name = keyPersons.Name, - KeyPersonDateOfBirth = keyPersons.KeyPersonDateOfBirth, - KeyPersonBiography = keyPersons.KeyPersonBiography, - KeyPersonCeoExecutive = keyPersons.KeyPersonCeoExecutive, - KeyPersonChairOfTrust = keyPersons.KeyPersonChairOfTrust, - KeyPersonFinancialDirector = keyPersons.KeyPersonFinancialDirector, - KeyPersonMember = keyPersons.KeyPersonMember, - KeyPersonOther = keyPersons.KeyPersonOther, - KeyPersonTrustee = keyPersons.KeyPersonTrustee, - DynamicsKeyPersonId = keyPersons.DynamicsKeyPersonId - }; - - var response = A2BApplicationKeyPersonsFactory.Create(keyPersons); - - response.Should().BeEquivalentTo(expectedKeyPersonsModel); - } - } -} \ No newline at end of file diff --git a/TramsDataApi.Test/Factories/A2BApplyingSchoolFactoryTests.cs b/TramsDataApi.Test/Factories/A2BApplyingSchoolFactoryTests.cs deleted file mode 100644 index 64e4936be..000000000 --- a/TramsDataApi.Test/Factories/A2BApplyingSchoolFactoryTests.cs +++ /dev/null @@ -1,275 +0,0 @@ -using FluentAssertions; -using FizzWare.NBuilder; -using TramsDataApi.DatabaseModels; -using TramsDataApi.Factories.A2BApplicationFactories; -using Xunit; -using TramsDataApi.ServiceModels.ApplyToBecome; -using System.Collections.Generic; -using System.Linq; - -namespace TramsDataApi.Test.Factories -{ - public class A2BApplyingSchoolFactoryTests - { - [Fact] - public void Create_ReturnsExpectedA2BApplicationApplyingSchool_WhenA2BApplicationApplyingSchoolModelIsProvided() - { - var financialYear = Builder - .CreateNew() - .Build(); - var loans = Builder - .CreateNew() - .Build(); - var leases = Builder - .CreateNew() - .Build(); - var request = Builder - .CreateNew() - .With(r => r.PreviousFinancialYear = financialYear) - .With(r => r.CurrentFinancialYear = financialYear) - .With(r => r.NextFinancialYear = financialYear) - .With(r => r.SchoolLoans = new List() { loans }) - .With(r => r.SchoolLeases = new List() { leases }) - .Build(); - - var expectedStatus = new A2BApplicationApplyingSchool - { - Name = request.SchoolName, - SchoolDeclarationBodyAgree = request.DeclarationBodyAgree, - SchoolDeclarationTeacherChair = request.DeclarationIAmTheChairOrHeadteacher, - SchoolConversionReasonsForJoining = request.SchoolConversionReasonsForJoining, - SchoolConversionTargetDateDifferent = request.SchoolConversionTargetDateSpecified, - SchoolConversionTargetDateDate = request.SchoolConversionTargetDate, - SchoolConversionTargetDateExplained = request.SchoolConversionTargetDateExplained, - SchoolConversionChangeName = request.SchoolConversionChangeNamePlanned, - SchoolConversionChangeNameValue = request.SchoolConversionProposedNewSchoolName, - SchoolConversionContactHeadName = request.SchoolConversionContactHeadName, - SchoolConversionContactHeadEmail = request.SchoolConversionContactHeadEmail, - SchoolConversionContactHeadTel = request.SchoolConversionContactHeadTel, - SchoolConversionContactChairName = request.SchoolConversionContactChairName, - SchoolConversionContactChairEmail = request.SchoolConversionContactChairEmail, - SchoolConversionContactChairTel = request.SchoolConversionContactChairTel, - SchoolConversionContactRole = request.SchoolConversionContactRole, - SchoolConversionMainContactOtherName = request.SchoolConversionMainContactOtherName, - SchoolConversionMainContactOtherEmail = request.SchoolConversionMainContactOtherEmail, - SchoolConversionMainContactOtherTelephone = request.SchoolConversionMainContactOtherTelephone, - SchoolConversionMainContactOtherRole = request.SchoolConversionMainContactOtherRole, - SchoolConversionApproverContactName = request.SchoolConversionApproverContactName, - SchoolConversionApproverContactEmail = request.SchoolConversionApproverContactEmail, - SchoolAdInspectedButReportNotPublished = request.SchoolAdInspectedButReportNotPublished, - SchoolAdInspectedReportNotPublishedExplain = request.SchoolAdInspectedButReportNotPublishedExplain, - SchoolLaReorganization = request.SchoolPartOfLaReorganizationPlan, - SchoolLaReorganizationExplain = request.SchoolLaReorganizationDetails, - SchoolLaClosurePlans = request.SchoolPartOfLaClosurePlan, - SchoolLaClosurePlansExplain = request.SchoolLaClosurePlanDetails, - SchoolPartOfFederation = request.SchoolIsPartOfFederation, - SchoolAddFurtherInformation = request.SchoolAdditionalInformationAdded, - SchoolFurtherInformation = request.SchoolAdditionalInformation, - SchoolAdSchoolContributionToTrust = request.SchoolAdSchoolContributionToTrust, - SchoolAdSafeguarding = request.SchoolOngoingSafeguardingInvestigations, - SchoolAdSafeguardingExplained = request.SchoolOngoingSafeguardingDetails, - SchoolSACREExemption = request.SchoolHasSACREException, - SchoolSACREExemptionEndDate = request.SchoolSACREExemptionEndDate, - SchoolFaithSchool = request.SchoolFaithSchool, - SchoolFaithSchoolDioceseName = request.SchoolFaithSchoolDioceseName, - SchoolSupportedFoundation = request.SchoolIsSupportedByFoundation, - SchoolSupportedFoundationBodyName = request.SchoolSupportedFoundationBodyName, - SchoolAdFeederSchools = request.SchoolAdFeederSchools, - SchoolAdEqualitiesImpactAssessment = request.SchoolAdEqualitiesImpactAssessmentCompleted, - SchoolAdEqualitiesImpactAssessmentDetails = request.SchoolAdEqualitiesImpactAssessmentDetails, - SchoolPFYRevenue = request.PreviousFinancialYear.RevenueCarryForward, - SchoolPFYRevenueIsDeficit = request.PreviousFinancialYear.RevenueIsDeficit, - SchoolPFYCapitalForward = request.PreviousFinancialYear.CapitalCarryForward, - SchoolPFYCapitalIsDeficit = request.PreviousFinancialYear.CapitalIsDeficit, - SchoolPFYEndDate = request.PreviousFinancialYear.FYEndDate, - SchoolPFYCapitalForwardStatusExplained = request.PreviousFinancialYear.CapitalStatusExplained, - SchoolPFYRevenueStatusExplained = request.PreviousFinancialYear.RevenueStatusExplained, - SchoolCFYRevenue = request.CurrentFinancialYear.RevenueCarryForward, - SchoolCFYRevenueIsDeficit = request.CurrentFinancialYear.RevenueIsDeficit, - SchoolCFYCapitalForward = request.CurrentFinancialYear.CapitalCarryForward, - SchoolCFYCapitalIsDeficit = request.CurrentFinancialYear.CapitalIsDeficit, - SchoolCFYCapitalForwardStatusExplained = request.CurrentFinancialYear.CapitalStatusExplained, - SchoolCFYRevenueStatusExplained = request.CurrentFinancialYear.RevenueStatusExplained, - SchoolCFYEndDate = request.CurrentFinancialYear.FYEndDate, - SchoolNFYRevenue = request.NextFinancialYear.RevenueCarryForward, - SchoolNFYRevenueIsDeficit = request.NextFinancialYear.RevenueIsDeficit, - SchoolNFYCapitalForward = request.NextFinancialYear.CapitalCarryForward, - SchoolNFYCapitalIsDeficit = request.NextFinancialYear.CapitalIsDeficit, - SchoolNFYEndDate = request.NextFinancialYear.FYEndDate, - SchoolNFYCapitalForwardStatusExplained = request.NextFinancialYear.CapitalStatusExplained, - SchoolNFYRevenueStatusExplained = request.NextFinancialYear.RevenueStatusExplained, - SchoolFinancialInvestigations = request.FinanceOngoingInvestigations, - SchoolFinancialInvestigationsExplain = request.SchoolFinancialInvestigationsExplain, - SchoolFinancialInvestigationsTrustAware = request.SchoolFinancialInvestigationsTrustAware, - ProjectedPupilNumbersYear1 = request.ProjectedPupilNumbersYear1, - ProjectedPupilNumbersYear2 = request.ProjectedPupilNumbersYear2, - ProjectedPupilNumbersYear3 = request.ProjectedPupilNumbersYear3, - SchoolCapacityAssumptions = request.SchoolCapacityAssumptions, - SchoolCapacityPublishedAdmissionsNumber = request.SchoolCapacityPublishedAdmissionsNumber, - SchoolBuildLandOwnerExplained = request.SchoolBuildLandOwnerExplained, - SchoolBuildLandSharedFacilities = request.SchoolBuildLandSharedFacilities, - SchoolBuildLandSharedFacilitiesExplained = request.SchoolBuildLandSharedFacilitiesExplained, - SchoolBuildLandWorksPlanned = request.SchoolBuildLandWorksPlanned, - SchoolBuildLandWorksPlannedExplained = request.SchoolBuildLandWorksPlannedExplained, - SchoolBuildLandWorksPlannedDate = request.SchoolBuildLandWorksPlannedCompletionDate, - SchoolBuildLandGrants = request.SchoolBuildLandGrants, - SchoolBuildLandGrantsBody = request.SchoolBuildLandGrantsExplained, - SchoolBuildLandPriorityBuildingProgramme = request.SchoolBuildLandPriorityBuildingProgramme, - SchoolBuildLandFutureProgramme = request.SchoolBuildLandFutureProgramme, - SchoolBuildLandPFIScheme = request.SchoolBuildLandPFIScheme, - SchoolBuildLandPFISchemeType = request.SchoolBuildLandPFISchemeType, - SchoolConsultationStakeholders = request.SchoolHasConsultedStakeholders, - SchoolConsultationStakeholdersConsult = request.SchoolPlanToConsultStakeholders, - SchoolSupportGrantFundsPaidTo = request.SchoolSupportGrantFundsPaidTo, - SchoolDeclarationSignedByName = request.DeclarationSignedByName, - DiocesePermissionEvidenceDocumentLink = request.DiocesePermissionEvidenceDocumentLink, - GoverningBodyConsentEvidenceDocumentLink = request.GoverningBodyConsentEvidenceDocumentLink, - FoundationEvidenceDocumentLink = request.FoundationEvidenceDocumentLink, - SchoolLeases = request.SchoolLeases.Select(A2BSchoolLeaseFactory.Create).ToList(), - SchoolLoans = request.SchoolLoans.Select(A2BSchoolLoanFactory.Create).ToList(), - DynamicsApplicationId = request.DynamicsApplicationId, - DynamicsApplyingSchoolId = request.DynamicsApplyingSchoolId, - Urn = request.Urn, - LocalAuthorityName = request.LocalAuthorityName - }; - - var response = A2BApplicationApplyingSchoolFactory.Create(request); - - response.Should().BeEquivalentTo(expectedStatus); - } - - [Fact] - public void Create_ReturnsExpectedA2BApplyingSchoolServiceModel_WhenA2BApplicationApplyingSchoolIsProvided() - { - var loans = Builder - .CreateNew() - .Build(); - var leases = Builder - .CreateNew() - .Build(); - var request = Builder - .CreateNew() - .With(r => r.SchoolLoans = new List() { loans }) - .With(r => r.SchoolLeases = new List() { leases }) - .Build(); - - var expectedResponse = new A2BApplicationApplyingSchoolServiceModel - { - SchoolName = request.Name, - DeclarationBodyAgree = request.SchoolDeclarationBodyAgree, - DeclarationIAmTheChairOrHeadteacher = request.SchoolDeclarationTeacherChair, - DeclarationSignedByName = request.SchoolDeclarationSignedByName, - SchoolConversionReasonsForJoining = request.SchoolConversionReasonsForJoining, - SchoolConversionTargetDateSpecified = request.SchoolConversionTargetDateDifferent, - SchoolConversionTargetDate = request.SchoolConversionTargetDateDate, - SchoolConversionTargetDateExplained = request.SchoolConversionTargetDateExplained, - SchoolConversionChangeNamePlanned = request.SchoolConversionChangeName, - SchoolConversionProposedNewSchoolName = request.SchoolConversionChangeNameValue, - SchoolConversionContactHeadName = request.SchoolConversionContactHeadName, - SchoolConversionContactHeadEmail = request.SchoolConversionContactHeadEmail, - SchoolConversionContactHeadTel = request.SchoolConversionContactHeadTel, - SchoolConversionContactChairName = request.SchoolConversionContactChairName, - SchoolConversionContactChairEmail = request.SchoolConversionContactChairEmail, - SchoolConversionContactChairTel = request.SchoolConversionContactChairTel, - SchoolConversionContactRole = request.SchoolConversionContactRole, // "headteacher", "chair of governing body", "someone else" - SchoolConversionMainContactOtherName = request.SchoolConversionMainContactOtherName, - SchoolConversionMainContactOtherEmail = request.SchoolConversionMainContactOtherEmail, - SchoolConversionMainContactOtherTelephone = request.SchoolConversionMainContactOtherTelephone, - SchoolConversionMainContactOtherRole = request.SchoolConversionMainContactOtherRole, - SchoolConversionApproverContactName = request.SchoolConversionApproverContactName, - SchoolConversionApproverContactEmail = request.SchoolConversionApproverContactEmail, - SchoolAdInspectedButReportNotPublished = request.SchoolAdInspectedButReportNotPublished, - SchoolAdInspectedButReportNotPublishedExplain = request.SchoolAdInspectedReportNotPublishedExplain, - SchoolPartOfLaReorganizationPlan = request.SchoolLaReorganization, - SchoolLaReorganizationDetails = request.SchoolLaReorganizationExplain, - SchoolPartOfLaClosurePlan = request.SchoolLaClosurePlans, - SchoolLaClosurePlanDetails = request.SchoolLaClosurePlansExplain, - SchoolIsPartOfFederation = request.SchoolPartOfFederation, - SchoolAdditionalInformationAdded = request.SchoolAddFurtherInformation, - SchoolAdditionalInformation = request.SchoolFurtherInformation, - SchoolAdSchoolContributionToTrust = request.SchoolAdSchoolContributionToTrust, - SchoolOngoingSafeguardingInvestigations = request.SchoolAdSafeguarding, - SchoolOngoingSafeguardingDetails = request.SchoolAdSafeguardingExplained, - SchoolHasSACREException = request.SchoolSACREExemption, - SchoolSACREExemptionEndDate = request.SchoolSACREExemptionEndDate, - SchoolFaithSchool = request.SchoolFaithSchool, - SchoolFaithSchoolDioceseName = request.SchoolFaithSchoolDioceseName, - SchoolIsSupportedByFoundation = request.SchoolSupportedFoundation, - SchoolSupportedFoundationBodyName = request.SchoolSupportedFoundationBodyName, - SchoolAdFeederSchools = request.SchoolAdFeederSchools, - SchoolAdEqualitiesImpactAssessmentCompleted = request.SchoolAdEqualitiesImpactAssessment, - SchoolAdEqualitiesImpactAssessmentDetails = request.SchoolAdEqualitiesImpactAssessmentDetails, - PreviousFinancialYear = new FinancialYearServiceModel - { - RevenueCarryForward = request.SchoolPFYRevenue.Value, - RevenueIsDeficit = request.SchoolPFYRevenueIsDeficit, - RevenueStatusExplained = request.SchoolPFYRevenueStatusExplained, - CapitalCarryForward = request.SchoolPFYCapitalForward.Value, - CapitalIsDeficit = request.SchoolPFYCapitalIsDeficit, - CapitalStatusExplained = request.SchoolPFYCapitalForwardStatusExplained, - FYEndDate = request.SchoolPFYEndDate - }, - CurrentFinancialYear = new FinancialYearServiceModel - { - RevenueCarryForward = request.SchoolCFYRevenue.Value, - RevenueIsDeficit = request.SchoolCFYRevenueIsDeficit, - RevenueStatusExplained = request.SchoolCFYRevenueStatusExplained, - CapitalCarryForward = request.SchoolCFYCapitalForward.Value, - CapitalIsDeficit = request.SchoolCFYCapitalIsDeficit, - CapitalStatusExplained = request.SchoolCFYCapitalForwardStatusExplained, - FYEndDate = request.SchoolCFYEndDate - }, - NextFinancialYear = new FinancialYearServiceModel - { - RevenueCarryForward = request.SchoolNFYRevenue.Value, - RevenueIsDeficit = request.SchoolNFYRevenueIsDeficit, - RevenueStatusExplained = request.SchoolNFYRevenueStatusExplained, - CapitalCarryForward = request.SchoolNFYCapitalForward.Value, - CapitalIsDeficit = request.SchoolNFYCapitalIsDeficit, - CapitalStatusExplained = request.SchoolNFYCapitalForwardStatusExplained, - FYEndDate = request.SchoolNFYEndDate - }, - FinanceOngoingInvestigations = request.SchoolFinancialInvestigations, - SchoolFinancialInvestigationsExplain = request.SchoolFinancialInvestigationsExplain, - SchoolFinancialInvestigationsTrustAware = request.SchoolFinancialInvestigationsTrustAware, - ProjectedPupilNumbersYear1 = (int)request.ProjectedPupilNumbersYear1, - ProjectedPupilNumbersYear2 = (int)request.ProjectedPupilNumbersYear2, - ProjectedPupilNumbersYear3 = (int)request.ProjectedPupilNumbersYear3, - SchoolCapacityAssumptions = request.SchoolCapacityAssumptions, - SchoolCapacityPublishedAdmissionsNumber = (int)request.SchoolCapacityPublishedAdmissionsNumber, - SchoolBuildLandOwnerExplained = request.SchoolBuildLandOwnerExplained, - SchoolBuildLandSharedFacilities = request.SchoolBuildLandSharedFacilities, - SchoolBuildLandSharedFacilitiesExplained = request.SchoolBuildLandSharedFacilitiesExplained, - SchoolBuildLandWorksPlanned = request.SchoolBuildLandWorksPlanned, - SchoolBuildLandWorksPlannedExplained = request.SchoolBuildLandWorksPlannedExplained, - SchoolBuildLandWorksPlannedCompletionDate = request.SchoolBuildLandWorksPlannedDate, - SchoolBuildLandGrants = request.SchoolBuildLandGrants, - SchoolBuildLandGrantsExplained = request.SchoolBuildLandGrantsBody, - SchoolBuildLandPriorityBuildingProgramme = request.SchoolBuildLandPriorityBuildingProgramme, - SchoolBuildLandFutureProgramme = request.SchoolBuildLandFutureProgramme, - SchoolBuildLandPFIScheme = request.SchoolBuildLandPFIScheme, - SchoolBuildLandPFISchemeType = request.SchoolBuildLandPFISchemeType, - SchoolHasConsultedStakeholders = request.SchoolConsultationStakeholders, - SchoolPlanToConsultStakeholders = request.SchoolConsultationStakeholdersConsult, - SchoolSupportGrantFundsPaidTo = request.SchoolSupportGrantFundsPaidTo, - DiocesePermissionEvidenceDocumentLink = request.DiocesePermissionEvidenceDocumentLink, - FoundationEvidenceDocumentLink = request.FoundationEvidenceDocumentLink, - GoverningBodyConsentEvidenceDocumentLink = request.GoverningBodyConsentEvidenceDocumentLink, - SchoolLoans = request.SchoolLoans - .Select(A2BSchoolLoanServiceModelFactory.Create) - .ToList(), - SchoolLeases = request.SchoolLeases - .Select(A2BSchoolLeaseServiceModelFactory.Create) - .ToList(), - DynamicsApplicationId = request.DynamicsApplicationId, - DynamicsApplyingSchoolId = request.DynamicsApplyingSchoolId, - Urn = request.Urn, - LocalAuthorityName = request.LocalAuthorityName - }; - - var response = A2BApplicationApplyingSchoolFactory.Create(request); - - response.Should().BeEquivalentTo(expectedResponse); - } - } -} diff --git a/TramsDataApi.Test/Factories/A2BSchoolLeaseFactoryTests.cs b/TramsDataApi.Test/Factories/A2BSchoolLeaseFactoryTests.cs deleted file mode 100644 index a167b13fb..000000000 --- a/TramsDataApi.Test/Factories/A2BSchoolLeaseFactoryTests.cs +++ /dev/null @@ -1,44 +0,0 @@ -using FizzWare.NBuilder; -using FluentAssertions; -using TramsDataApi.DatabaseModels; -using TramsDataApi.Factories.A2BApplicationFactories; -using TramsDataApi.ServiceModels.ApplyToBecome; -using Xunit; - -namespace TramsDataApi.Test.Factories -{ - public class A2BSchoolLeaseFactoryTests - { - [Fact] - public void Create_ReturnsNull_WhenA2BSchoolLeaseRequestIsNull() - { - var response = A2BSchoolLeaseFactory.Create(null); - - response.Should().BeNull(); - } - - [Fact] - public void Create_ReturnsExpectedA2BSchoolLeaseWhenA2BSchoolLeaseServiceModelProvided() - { - var schoolLeaseCreateRequest = Builder - .CreateNew() - .Build(); - - var expectedSchoolLease = new A2BSchoolLease - { - SchoolLeaseTerm = schoolLeaseCreateRequest.SchoolLeaseTerm, - SchoolLeaseRepaymentValue = schoolLeaseCreateRequest.SchoolLeaseRepaymentValue, - SchoolLeaseInterestRate = schoolLeaseCreateRequest.SchoolLeaseInterestRate, - SchoolLeasePaymentToDate = schoolLeaseCreateRequest.SchoolLeasePaymentToDate, - SchoolLeasePurpose = schoolLeaseCreateRequest.SchoolLeasePurpose, - SchoolLeaseValueOfAssets = schoolLeaseCreateRequest.SchoolLeaseValueOfAssets, - SchoolLeaseResponsibleForAssets = schoolLeaseCreateRequest.SchoolLeaseResponsibleForAssets, - DynamicsSchoolLeaseId = schoolLeaseCreateRequest.DynamicsSchoolLeaseId - }; - - var response = A2BSchoolLeaseFactory.Create(schoolLeaseCreateRequest); - - response.Should().BeEquivalentTo(expectedSchoolLease); - } - } -} \ No newline at end of file diff --git a/TramsDataApi.Test/Factories/A2BSchoolLeaseServiceModelFactoryTests.cs b/TramsDataApi.Test/Factories/A2BSchoolLeaseServiceModelFactoryTests.cs deleted file mode 100644 index 0ab96f2f3..000000000 --- a/TramsDataApi.Test/Factories/A2BSchoolLeaseServiceModelFactoryTests.cs +++ /dev/null @@ -1,44 +0,0 @@ -using FizzWare.NBuilder; -using FluentAssertions; -using TramsDataApi.DatabaseModels; -using TramsDataApi.Factories.A2BApplicationFactories; -using TramsDataApi.ServiceModels.ApplyToBecome; -using Xunit; - -namespace TramsDataApi.Test.Factories -{ - public class A2BSchoolLeaseServiceModelFactoryTests - { - [Fact] - public void Create_ReturnsNull_WhenA2BSchoolLeaseIsNull() - { - var response = A2BSchoolLeaseServiceModelFactory.Create(null); - - response.Should().BeNull(); - } - - [Fact] - public void Create_ReturnsExpectedA2BSchoolLeaseResponseWhenA2BSchoolLeaseIsProvided() - { - var schoolLease = Builder - .CreateNew() - .Build(); - - var expectedSchoolLeaseResponse = new A2BSchoolLeaseServiceModel - { - SchoolLeaseTerm = schoolLease.SchoolLeaseTerm, - SchoolLeaseRepaymentValue = schoolLease.SchoolLeaseRepaymentValue, - SchoolLeaseInterestRate = schoolLease.SchoolLeaseInterestRate, - SchoolLeasePaymentToDate = schoolLease.SchoolLeasePaymentToDate, - SchoolLeasePurpose = schoolLease.SchoolLeasePurpose, - SchoolLeaseValueOfAssets = schoolLease.SchoolLeaseValueOfAssets, - SchoolLeaseResponsibleForAssets = schoolLease.SchoolLeaseResponsibleForAssets, - DynamicsSchoolLeaseId = schoolLease.DynamicsSchoolLeaseId, - }; - - var response = A2BSchoolLeaseServiceModelFactory.Create(schoolLease); - - response.Should().BeEquivalentTo(expectedSchoolLeaseResponse); - } - } -} \ No newline at end of file diff --git a/TramsDataApi.Test/Factories/A2BSchoolLoanFactoryTests.cs b/TramsDataApi.Test/Factories/A2BSchoolLoanFactoryTests.cs deleted file mode 100644 index 4ef342410..000000000 --- a/TramsDataApi.Test/Factories/A2BSchoolLoanFactoryTests.cs +++ /dev/null @@ -1,42 +0,0 @@ -using FizzWare.NBuilder; -using FluentAssertions; -using TramsDataApi.DatabaseModels; -using TramsDataApi.Factories.A2BApplicationFactories; -using TramsDataApi.ServiceModels.ApplyToBecome; -using Xunit; - -namespace TramsDataApi.Test.Factories -{ - public class A2BSchoolLoanFactoryTests - { - [Fact] - public void Create_ReturnsNull_WhenA2BSchoolLoanRequestIsNull() - { - var response = A2BSchoolLoanFactory.Create(null); - - response.Should().BeNull(); - } - - [Fact] - public void Create_ReturnsExpectedA2BSchoolLoanWhenA2BSchoolLoanResponseIsProvided() - { - var schoolLoanCreateRequest = Builder - .CreateNew() - .Build(); - - var expectedSchoolLoan = new A2BSchoolLoan - { - SchoolLoanAmount = schoolLoanCreateRequest.SchoolLoanAmount, - SchoolLoanPurpose = schoolLoanCreateRequest.SchoolLoanPurpose, - SchoolLoanProvider = schoolLoanCreateRequest.SchoolLoanProvider, - SchoolLoanInterestRate = schoolLoanCreateRequest.SchoolLoanInterestRate, - SchoolLoanSchedule = schoolLoanCreateRequest.SchoolLoanSchedule, - DynamicsSchoolLoanId = schoolLoanCreateRequest.DynamicsSchoolLoanId - }; - - var response = A2BSchoolLoanFactory.Create(schoolLoanCreateRequest); - - response.Should().BeEquivalentTo(expectedSchoolLoan); - } - } -} \ No newline at end of file diff --git a/TramsDataApi.Test/Factories/A2BSchoolLoanServiceModelFactoryTests.cs b/TramsDataApi.Test/Factories/A2BSchoolLoanServiceModelFactoryTests.cs deleted file mode 100644 index ac4f73445..000000000 --- a/TramsDataApi.Test/Factories/A2BSchoolLoanServiceModelFactoryTests.cs +++ /dev/null @@ -1,42 +0,0 @@ -using FizzWare.NBuilder; -using FluentAssertions; -using TramsDataApi.DatabaseModels; -using TramsDataApi.Factories.A2BApplicationFactories; -using TramsDataApi.ServiceModels.ApplyToBecome; -using Xunit; - -namespace TramsDataApi.Test.Factories -{ - public class A2BSchoolLoanServiceModelFactoryTests - { - [Fact] - public void Create_ReturnsNull_WhenA2BSchoolLoanIsNull() - { - var response = A2BSchoolLoanServiceModelFactory.Create(null); - - response.Should().BeNull(); - } - - [Fact] - public void Create_ReturnsExpectedA2BSchoolLoanResponseWhenA2BSchoolLoanIsProvided() - { - var schoolLoan = Builder - .CreateNew() - .Build(); - - var expectedSchoolLoanResponse = new A2BSchoolLoanServiceModel - { - SchoolLoanAmount = schoolLoan.SchoolLoanAmount, - SchoolLoanPurpose = schoolLoan.SchoolLoanPurpose, - SchoolLoanProvider = schoolLoan.SchoolLoanProvider, - SchoolLoanInterestRate = schoolLoan.SchoolLoanInterestRate, - SchoolLoanSchedule = schoolLoan.SchoolLoanSchedule, - DynamicsSchoolLoanId = schoolLoan.DynamicsSchoolLoanId, - }; - - var response = A2BSchoolLoanServiceModelFactory.Create(schoolLoan); - - response.Should().BeEquivalentTo(expectedSchoolLoanResponse); - } - } -} \ No newline at end of file diff --git a/TramsDataApi.Test/Integration/ApplyToBecomeIntegrationTests.cs b/TramsDataApi.Test/Integration/ApplyToBecomeIntegrationTests.cs deleted file mode 100644 index 1c42f2d8d..000000000 --- a/TramsDataApi.Test/Integration/ApplyToBecomeIntegrationTests.cs +++ /dev/null @@ -1,419 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Net.Http.Json; -using System.Threading.Tasks; -using FizzWare.NBuilder; -using FluentAssertions; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using TramsDataApi.DatabaseModels; -using TramsDataApi.Factories.A2BApplicationFactories; -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ResponseModels; -using TramsDataApi.ResponseModels.ApplyToBecome; -using TramsDataApi.ServiceModels.ApplyToBecome; -using Xunit; - -namespace TramsDataApi.Test.Integration -{ - [Collection("Database")] - public class ApplyToBecomeIntegrationTests: IClassFixture, IDisposable - { - - private readonly HttpClient _client; - private readonly TramsDbContext _dbContext; - private readonly RandomGenerator _randomGenerator; - - public ApplyToBecomeIntegrationTests(TramsDataApiFactory fixture) - { - _client = fixture.CreateClient(); - _client.DefaultRequestHeaders.Add("ApiKey", "testing-api-key"); - _dbContext = fixture.Services.GetRequiredService(); - _randomGenerator = new RandomGenerator(); - } - - [Fact] - public async Task CanGetApplicationByApplicationId() - { - const string applicationId = "100001"; - - var keyPerson = new A2BApplicationKeyPersons - { - Name = _randomGenerator.NextString(2, 10), - KeyPersonDateOfBirth = _randomGenerator.DateTime(), - KeyPersonBiography = _randomGenerator.NextString(2, 10), - KeyPersonCeoExecutive = _randomGenerator.Boolean(), - KeyPersonChairOfTrust = _randomGenerator.Boolean(), - KeyPersonFinancialDirector = _randomGenerator.Boolean(), - KeyPersonMember = _randomGenerator.Boolean(), - KeyPersonOther = _randomGenerator.Boolean(), - KeyPersonTrustee = _randomGenerator.Boolean(), - DynamicsKeyPersonId = _randomGenerator.Guid() - }; - - var loan = new A2BSchoolLoan - { - SchoolLoanAmount = 1000, - SchoolLoanInterestRate = _randomGenerator.NextString(2, 4), - SchoolLoanProvider = _randomGenerator.NextString(2, 10), - SchoolLoanPurpose = _randomGenerator.NextString(2, 10), - SchoolLoanSchedule = _randomGenerator.NextString(2, 10), - DynamicsSchoolLoanId = _randomGenerator.Guid() - }; - var lease = new A2BSchoolLease - { - SchoolLeaseInterestRate = 10, - SchoolLeasePaymentToDate = 100, - SchoolLeasePurpose = _randomGenerator.NextString(2, 10), - SchoolLeaseRepaymentValue = 1000, - SchoolLeaseResponsibleForAssets = _randomGenerator.NextString(2, 10), - SchoolLeaseTerm = _randomGenerator.NextString(2, 10), - SchoolLeaseValueOfAssets = _randomGenerator.NextString(2, 10), - DynamicsSchoolLeaseId = _randomGenerator.Guid() - }; - - var applyingSchool = new A2BApplicationApplyingSchool - { - SchoolDeclarationSignedById = _randomGenerator.NextString(2, 10), - SchoolDeclarationBodyAgree = _randomGenerator.Boolean(), - SchoolDeclarationTeacherChair = _randomGenerator.Boolean(), - SchoolDeclarationSignedByEmail = _randomGenerator.NextString(2, 10), - Name = _randomGenerator.NextString(2, 10), - SchoolConversionReasonsForJoining = _randomGenerator.NextString(2, 10), - SchoolConversionTargetDateDifferent = true, - SchoolConversionTargetDateDate = _randomGenerator.DateTime(), - SchoolConversionTargetDateExplained = _randomGenerator.NextString(2, 10), - SchoolConversionChangeName = true, - SchoolConversionChangeNameValue = _randomGenerator.NextString(2, 10), - SchoolConversionContactHeadName = _randomGenerator.NextString(2, 10), - SchoolConversionContactHeadEmail = _randomGenerator.NextString(2, 10), - SchoolConversionContactHeadTel = _randomGenerator.NextString(2, 10), - SchoolConversionContactChairName = _randomGenerator.NextString(2, 10), - SchoolConversionContactChairEmail = _randomGenerator.NextString(2, 10), - SchoolConversionContactChairTel = _randomGenerator.NextString(2, 10), - SchoolConversionContactRole = _randomGenerator.NextString(2,10), - SchoolConversionMainContactOtherName = _randomGenerator.NextString(2, 10), - SchoolConversionMainContactOtherEmail = _randomGenerator.NextString(2, 10), - SchoolConversionMainContactOtherTelephone = _randomGenerator.NextString(2, 10), - SchoolConversionMainContactOtherRole = _randomGenerator.NextString(2, 10), - SchoolConversionApproverContactName = _randomGenerator.NextString(2, 10), - SchoolConversionApproverContactEmail = _randomGenerator.NextString(2, 10), - SchoolAdInspectedButReportNotPublished = true, - SchoolAdInspectedReportNotPublishedExplain = _randomGenerator.NextString(2, 10), - SchoolLaReorganization = true, - SchoolLaReorganizationExplain = _randomGenerator.NextString(2, 10), - SchoolLaClosurePlans = true, - SchoolLaClosurePlansExplain = _randomGenerator.NextString(2, 10), - SchoolPartOfFederation = true, - SchoolAddFurtherInformation = true, - SchoolFurtherInformation = _randomGenerator.NextString(2, 10), - SchoolAdSchoolContributionToTrust = _randomGenerator.NextString(2, 10), - SchoolAdSafeguarding = true, - SchoolAdSafeguardingExplained = _randomGenerator.NextString(2, 10), - SchoolSACREExemption = true, - SchoolSACREExemptionEndDate = _randomGenerator.DateTime(), - SchoolFaithSchool = true, - SchoolFaithSchoolDioceseName = _randomGenerator.NextString(2, 10), - SchoolSupportedFoundation = true, - SchoolSupportedFoundationBodyName = _randomGenerator.NextString(2, 10), - SchoolAdFeederSchools = _randomGenerator.NextString(2, 10), - SchoolAdEqualitiesImpactAssessment = true, - SchoolPFYRevenue = 1000, - SchoolPFYRevenueStatusExplained = _randomGenerator.NextString(2, 10), - SchoolPFYCapitalForward = 1000, - SchoolPFYCapitalForwardStatusExplained = _randomGenerator.NextString(2, 10), - SchoolPFYCapitalIsDeficit = _randomGenerator.Boolean(), - SchoolPFYRevenueIsDeficit = _randomGenerator.Boolean(), - SchoolCFYRevenue = 1000, - SchoolCFYRevenueStatusExplained = _randomGenerator.NextString(2, 10), - SchoolCFYCapitalForward = 1000, - SchoolCFYCapitalForwardStatusExplained = _randomGenerator.NextString(2, 10), - SchoolCFYCapitalIsDeficit = _randomGenerator.Boolean(), - SchoolCFYRevenueIsDeficit = _randomGenerator.Boolean(), - SchoolNFYRevenue = 1000, - SchoolNFYRevenueStatusExplained = _randomGenerator.NextString(2, 10), - SchoolNFYCapitalForward = 1000, - SchoolNFYCapitalForwardStatusExplained = _randomGenerator.NextString(2, 10), - SchoolNFYCapitalIsDeficit = _randomGenerator.Boolean(), - SchoolNFYRevenueIsDeficit = _randomGenerator.Boolean(), - SchoolFinancialInvestigations = true, - SchoolFinancialInvestigationsExplain = _randomGenerator.NextString(2, 10), - SchoolFinancialInvestigationsTrustAware = true, - SchoolNFYEndDate = _randomGenerator.DateTime(), - SchoolPFYEndDate = _randomGenerator.DateTime(), - SchoolCFYEndDate = _randomGenerator.DateTime(), - ProjectedPupilNumbersYear1 = 1, - ProjectedPupilNumbersYear2 = 1, - ProjectedPupilNumbersYear3 = 1, - SchoolCapacityAssumptions = _randomGenerator.NextString(2, 10), - SchoolCapacityPublishedAdmissionsNumber = 100, - SchoolBuildLandOwnerExplained = _randomGenerator.NextString(2, 10), - SchoolBuildLandSharedFacilities = true, - SchoolBuildLandSharedFacilitiesExplained = _randomGenerator.NextString(2, 10), - SchoolBuildLandWorksPlanned = true, - SchoolBuildLandWorksPlannedExplained = _randomGenerator.NextString(2, 10), - SchoolBuildLandWorksPlannedDate = _randomGenerator.DateTime(), - SchoolBuildLandGrants = true, - SchoolBuildLandGrantsBody = _randomGenerator.NextString(2, 10), - SchoolBuildLandPriorityBuildingProgramme = true, - SchoolBuildLandFutureProgramme = true, - SchoolBuildLandPFIScheme = true, - SchoolBuildLandPFISchemeType = _randomGenerator.NextString(2, 10), - SchoolConsultationStakeholders = true, - SchoolConsultationStakeholdersConsult = _randomGenerator.NextString(2, 10), - SchoolSupportGrantFundsPaidTo = _randomGenerator.NextString(2, 10), - SchoolDeclarationSignedByName = _randomGenerator.NextString(2, 10), - SchoolAdEqualitiesImpactAssessmentDetails = _randomGenerator.NextString(2,10), - SchoolLeases = new List() { lease }, - SchoolLoans = new List() { loan }, - DynamicsApplicationId = _randomGenerator.Guid(), - DynamicsApplyingSchoolId = _randomGenerator.Guid(), - Urn = _randomGenerator.Int(), - LocalAuthorityName = _randomGenerator.NextString(2, 10) - }; - - var application = Builder - .CreateNew() - .With(a => a.ApplicationId = applicationId) - .With(a => a.TrustApproverEmail = "test@test.com") - .With(a => a.ApplicationType = "JoinMat") - .With(a => a.KeyPersons = new List {keyPerson}) - .With(a => a.ApplyingSchools = new List {applyingSchool}) - .Build(); - - _dbContext.A2BApplications.Add(application); - await _dbContext.SaveChangesAsync(); - - var expected = A2BApplicationFactory.Create(application); - var expectedResponse = new ApiSingleResponseV2(expected); - - var response = await _client.GetAsync($"/v2/apply-to-become/application/{applicationId}"); - - - response.StatusCode.Should().Be(HttpStatusCode.OK); - - var result = await response.Content.ReadFromJsonAsync>(); - result.Should().BeEquivalentTo(expectedResponse); - result.Data.ApplicationId.Should().Be(expectedResponse.Data.ApplicationId); - } - - [Fact] - public async Task CanCreateApplication() - { - var keyPerson = new A2BApplicationKeyPersonsServiceModel - { - Name = _randomGenerator.NextString(2, 10), - KeyPersonDateOfBirth = _randomGenerator.DateTime(), - KeyPersonBiography = _randomGenerator.NextString(2, 10), - KeyPersonCeoExecutive = _randomGenerator.Boolean(), - KeyPersonChairOfTrust = _randomGenerator.Boolean(), - KeyPersonFinancialDirector = _randomGenerator.Boolean(), - KeyPersonMember = _randomGenerator.Boolean(), - KeyPersonOther = _randomGenerator.Boolean(), - KeyPersonTrustee = _randomGenerator.Boolean(), - DynamicsKeyPersonId = _randomGenerator.Guid() - }; - - var loan = new A2BSchoolLoanServiceModel - { - SchoolLoanAmount = 1000, - SchoolLoanInterestRate = "15%", - SchoolLoanProvider = "Provider", - SchoolLoanPurpose = "Purpose", - SchoolLoanSchedule = "£100 monthly for two years", - DynamicsSchoolLoanId = _randomGenerator.Guid() - }; - var lease = new A2BSchoolLeaseServiceModel - { - SchoolLeaseInterestRate = 20, - SchoolLeasePaymentToDate = 300, - SchoolLeasePurpose = "purpose", - SchoolLeaseRepaymentValue = 1100, - SchoolLeaseResponsibleForAssets = "who is responsible", - SchoolLeaseTerm = " 18 months", - SchoolLeaseValueOfAssets = "500", - DynamicsSchoolLeaseId = _randomGenerator.Guid() - }; - - var applyingSchool = new A2BApplicationApplyingSchoolServiceModel - { - DeclarationBodyAgree = _randomGenerator.Boolean(), - DeclarationSignedByName = _randomGenerator.NextString(2, 10), - DeclarationIAmTheChairOrHeadteacher = _randomGenerator.Boolean(), - SchoolName = _randomGenerator.NextString(2, 10), - SchoolConversionReasonsForJoining = _randomGenerator.NextString(2, 10), - SchoolConversionTargetDateSpecified = true, - SchoolConversionTargetDate = _randomGenerator.DateTime(), - SchoolConversionTargetDateExplained = _randomGenerator.NextString(2, 10), - SchoolConversionChangeNamePlanned = true, - SchoolConversionProposedNewSchoolName = _randomGenerator.NextString(2, 10), - SchoolConversionContactHeadName = _randomGenerator.NextString(2, 10), - SchoolConversionContactHeadEmail = _randomGenerator.NextString(2, 10), - SchoolConversionContactHeadTel = _randomGenerator.NextString(2, 10), - SchoolConversionContactChairName = _randomGenerator.NextString(2, 10), - SchoolConversionContactChairEmail = _randomGenerator.NextString(2, 10), - SchoolConversionContactChairTel = _randomGenerator.NextString(2, 10), - SchoolConversionContactRole = _randomGenerator.NextString(2, 10), - SchoolConversionMainContactOtherName = _randomGenerator.NextString(2, 10), - SchoolConversionMainContactOtherEmail = _randomGenerator.NextString(2, 10), - SchoolConversionMainContactOtherTelephone = _randomGenerator.NextString(2, 10), - SchoolConversionMainContactOtherRole = _randomGenerator.NextString(2, 10), - SchoolConversionApproverContactName = _randomGenerator.NextString(2, 10), - SchoolConversionApproverContactEmail = _randomGenerator.NextString(2, 10), - SchoolAdInspectedButReportNotPublished = true, - SchoolAdInspectedButReportNotPublishedExplain = _randomGenerator.NextString(2, 10), - SchoolPartOfLaReorganizationPlan = true, - SchoolLaReorganizationDetails = _randomGenerator.NextString(2, 10), - SchoolPartOfLaClosurePlan = true, - SchoolLaClosurePlanDetails = _randomGenerator.NextString(2, 10), - SchoolIsPartOfFederation = true, - SchoolAdditionalInformationAdded = true, - SchoolAdditionalInformation = _randomGenerator.NextString(2, 10), - SchoolAdSchoolContributionToTrust = _randomGenerator.NextString(2, 10), - SchoolOngoingSafeguardingInvestigations = true, - SchoolOngoingSafeguardingDetails = _randomGenerator.NextString(2, 10), - SchoolHasSACREException = true, - SchoolSACREExemptionEndDate = _randomGenerator.DateTime(), - SchoolFaithSchool = true, - SchoolFaithSchoolDioceseName = _randomGenerator.NextString(2, 10), - SchoolIsSupportedByFoundation = true, - SchoolSupportedFoundationBodyName = _randomGenerator.NextString(2, 10), - SchoolAdFeederSchools = _randomGenerator.NextString(2, 10), - SchoolAdEqualitiesImpactAssessmentCompleted = true, - PreviousFinancialYear = new FinancialYearServiceModel - { - RevenueCarryForward = 1000, - RevenueIsDeficit = false, - RevenueStatusExplained = _randomGenerator.NextString(2, 10), - CapitalCarryForward = 1000, - CapitalIsDeficit = false, - CapitalStatusExplained = _randomGenerator.NextString(2, 10), - FYEndDate = _randomGenerator.DateTime() - }, - CurrentFinancialYear = new FinancialYearServiceModel - { - RevenueCarryForward = 1000, - RevenueIsDeficit = false, - RevenueStatusExplained = _randomGenerator.NextString(2, 10), - CapitalCarryForward = 1000, - CapitalIsDeficit = false, - CapitalStatusExplained = _randomGenerator.NextString(2, 10), - FYEndDate = _randomGenerator.DateTime() - }, - NextFinancialYear = new FinancialYearServiceModel - { - RevenueCarryForward = 1000, - RevenueIsDeficit = false, - RevenueStatusExplained = _randomGenerator.NextString(2, 10), - CapitalCarryForward = 1000, - CapitalIsDeficit = false, - CapitalStatusExplained = _randomGenerator.NextString(2, 10), - FYEndDate = _randomGenerator.DateTime() - }, - - SchoolFinancialInvestigationsExplain = _randomGenerator.NextString(2, 10), - SchoolFinancialInvestigationsTrustAware =true, - ProjectedPupilNumbersYear1 = 1, - ProjectedPupilNumbersYear2 = 1, - ProjectedPupilNumbersYear3 = 1, - SchoolCapacityAssumptions = _randomGenerator.NextString(2, 10), - SchoolCapacityPublishedAdmissionsNumber = 100, - SchoolBuildLandOwnerExplained = _randomGenerator.NextString(2, 10), - SchoolBuildLandSharedFacilities = true, - SchoolBuildLandSharedFacilitiesExplained = _randomGenerator.NextString(2, 10), - SchoolBuildLandWorksPlanned = true, - SchoolBuildLandWorksPlannedExplained = _randomGenerator.NextString(2, 10), - SchoolBuildLandWorksPlannedCompletionDate = _randomGenerator.DateTime(), - SchoolBuildLandGrants = true, - SchoolBuildLandGrantsExplained = _randomGenerator.NextString(2, 10), - SchoolBuildLandPriorityBuildingProgramme = true, - SchoolBuildLandFutureProgramme = true, - SchoolBuildLandPFIScheme = true, - SchoolBuildLandPFISchemeType = _randomGenerator.NextString(2, 10), - SchoolHasConsultedStakeholders = true, - SchoolPlanToConsultStakeholders = _randomGenerator.NextString(2, 10), - SchoolSupportGrantFundsPaidTo = _randomGenerator.NextString(2, 10), - SchoolLoans = new List() { loan }, - SchoolLeases = new List() { lease }, - DynamicsApplicationId = _randomGenerator.Guid(), - DynamicsApplyingSchoolId = _randomGenerator.Guid(), - Urn = _randomGenerator.Int(), - LocalAuthorityName = _randomGenerator.NextString(2, 10) - }; - - var application = new A2BApplicationCreateRequest - { - ApplicationId = "10001", - Name = _randomGenerator.NextString(2, 10), - TrustName = _randomGenerator.NextString(2, 10), - FormTrustProposedNameOfTrust = _randomGenerator.NextString(2, 10), - ApplicationSubmitted = _randomGenerator.Boolean(), - ApplicationLeadAuthorId = _randomGenerator.NextString(2, 10), - ApplicationVersion = _randomGenerator.NextString(2, 10), - ApplicationLeadAuthorName = _randomGenerator.NextString(2, 10), - ApplicationLeadEmail = _randomGenerator.NextString(2, 10), - ApplicationRole = _randomGenerator.NextString(2, 10), - ApplicationRoleOtherDescription = _randomGenerator.NextString(2, 10), - ChangesToTrust = _randomGenerator.Boolean(), - ChangesToTrustExplained = _randomGenerator.NextString(2, 10), - ChangesToLaGovernance = _randomGenerator.Boolean(), - ChangesToLaGovernanceExplained = _randomGenerator.NextString(2, 10), - FormTrustOpeningDate = _randomGenerator.DateTime(), - TrustApproverName = _randomGenerator.NextString(2, 10), - FormTrustReasonApprovalToConvertAsSat = _randomGenerator.Boolean(), - FormTrustReasonApprovedPerson = _randomGenerator.NextString(2, 10), - FormTrustReasonForming = _randomGenerator.NextString(2, 10), - FormTrustReasonVision = _randomGenerator.NextString(2, 10), - FormTrustReasonGeoAreas = _randomGenerator.NextString(2, 10), - FormTrustReasonFreedom = _randomGenerator.NextString(2, 10), - FormTrustReasonImproveTeaching = _randomGenerator.NextString(2, 10), - FormTrustPlanForGrowth = _randomGenerator.NextString(2, 10), - FormTrustPlansForNoGrowth = _randomGenerator.NextString(2, 10), - FormTrustGrowthPlansYesNo = _randomGenerator.Boolean(), - FormTrustImprovementSupport = _randomGenerator.NextString(2, 10), - FormTrustImprovementStrategy = _randomGenerator.NextString(2, 10), - FormTrustImprovementApprovedSponsor = _randomGenerator.NextString(2, 10), - TrustId = _randomGenerator.NextString(2, 10), - ApplicationStatusId = _randomGenerator.NextString(2, 10), - TrustApproverEmail = "test@test.com", - ApplicationType = "JoinMat", - KeyPersons = new List {keyPerson}, - ApplyingSchools = new List {applyingSchool}, - DynamicsApplicationId = _randomGenerator.Guid() - }; - - var response = await _client.PostAsJsonAsync("/v2/apply-to-become/application/", application); - var result = await response.Content.ReadFromJsonAsync>(); - response.StatusCode.Should().Be(HttpStatusCode.Created); - result.Should().NotBeNull(); - - var createdApplication = - _dbContext.A2BApplications - .Include(a => a.KeyPersons) - .Include(a => a.ApplyingSchools) - .ThenInclude(b => b.SchoolLoans) - .Include(a => a.ApplyingSchools) - .ThenInclude(b => b.SchoolLeases) - .FirstOrDefault(a => a.ApplicationId == result.Data.ApplicationId); - - createdApplication.Should().NotBeNull(); - - var expectedResponse = A2BApplicationFactory.Create(createdApplication); - - result.Data.Should().BeEquivalentTo(expectedResponse); - } - - public void Dispose() - { - _dbContext.A2BApplicationKeyPersons.RemoveRange(_dbContext.A2BApplicationKeyPersons); - _dbContext.A2BApplicationApplyingSchools.RemoveRange(_dbContext.A2BApplicationApplyingSchools); - _dbContext.A2BApplications.RemoveRange(_dbContext.A2BApplications); - _dbContext.A2BSchoolLoans.RemoveRange(_dbContext.A2BSchoolLoans); - _dbContext.A2BSchoolLeases.RemoveRange(_dbContext.A2BSchoolLeases); - _dbContext.SaveChanges(); - } - } -} \ No newline at end of file diff --git a/TramsDataApi.Test/UseCases/CreateA2BApplicationTests.cs b/TramsDataApi.Test/UseCases/CreateA2BApplicationTests.cs deleted file mode 100644 index fc6ea2069..000000000 --- a/TramsDataApi.Test/UseCases/CreateA2BApplicationTests.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using FizzWare.NBuilder; -using FluentAssertions; -using Moq; -using TramsDataApi.DatabaseModels; -using TramsDataApi.Factories.A2BApplicationFactories; -using TramsDataApi.Gateways; -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ResponseModels.ApplyToBecome; -using TramsDataApi.ServiceModels.ApplyToBecome; -using TramsDataApi.UseCases; -using Xunit; - -namespace TramsDataApi.Test.UseCases -{ - public class CreateA2BApplicationTests - { - [Fact] - public void CreateA2BApplication_ShouldCreateAndReturnA2BApplicationResponse_WhenGivenA2BApplication() - { - var keyPersons = Builder.CreateNew().Build(); - var financialYear = Builder.CreateNew().Build(); - var applyingSchools = Builder - .CreateNew() - .With(r => r.PreviousFinancialYear = financialYear) - .With(r => r.CurrentFinancialYear = financialYear) - .With(r => r.NextFinancialYear = financialYear) - .Build(); - var applicationCreateRequest = Builder - .CreateNew() - .With(r => r.ApplicationType = "FormMat") - .With(r => r.KeyPersons = new List {keyPersons}) - .With(r => r.ApplyingSchools = new List {applyingSchools}) - .Build(); - - var application = new A2BApplication - { - ApplicationId = "10001", - Name = applicationCreateRequest.Name, - ApplicationType = applicationCreateRequest.ApplicationType, - FormTrustProposedNameOfTrust = applicationCreateRequest.FormTrustProposedNameOfTrust, - ApplicationSubmitted = applicationCreateRequest.ApplicationSubmitted, - ApplicationLeadAuthorId = applicationCreateRequest.ApplicationLeadAuthorId, - ApplicationVersion = applicationCreateRequest.ApplicationVersion, - ApplicationLeadAuthorName = applicationCreateRequest.ApplicationLeadAuthorName, - ApplicationLeadEmail = applicationCreateRequest.ApplicationLeadEmail, - ApplicationRole = applicationCreateRequest.ApplicationRole, - ApplicationRoleOtherDescription = applicationCreateRequest.ApplicationRoleOtherDescription, - ChangesToTrust = applicationCreateRequest.ChangesToTrust, - ChangesToTrustExplained = applicationCreateRequest.ChangesToTrustExplained, - ChangesToLaGovernance = applicationCreateRequest.ChangesToLaGovernance, - ChangesToLaGovernanceExplained = applicationCreateRequest.ChangesToLaGovernanceExplained, - FormTrustOpeningDate = applicationCreateRequest.FormTrustOpeningDate, - TrustId = applicationCreateRequest.TrustId, - TrustApproverName = applicationCreateRequest.TrustApproverName, - TrustApproverEmail = applicationCreateRequest.TrustApproverEmail, - FormTrustReasonApprovalToConvertAsSat = applicationCreateRequest.FormTrustReasonApprovalToConvertAsSat, - FormTrustReasonApprovedPerson = applicationCreateRequest.FormTrustReasonApprovedPerson, - FormTrustReasonForming = applicationCreateRequest.FormTrustReasonForming, - FormTrustReasonVision = applicationCreateRequest.FormTrustReasonVision, - FormTrustReasonGeoAreas = applicationCreateRequest.FormTrustReasonGeoAreas, - FormTrustReasonFreedom = applicationCreateRequest.FormTrustReasonFreedom, - FormTrustReasonImproveTeaching = applicationCreateRequest.FormTrustReasonImproveTeaching, - FormTrustPlanForGrowth = applicationCreateRequest.FormTrustPlanForGrowth, - FormTrustPlansForNoGrowth = applicationCreateRequest.FormTrustPlansForNoGrowth, - FormTrustGrowthPlansYesNo = applicationCreateRequest.FormTrustGrowthPlansYesNo, - FormTrustImprovementSupport = applicationCreateRequest.FormTrustImprovementSupport, - FormTrustImprovementStrategy = applicationCreateRequest.FormTrustImprovementStrategy, - FormTrustImprovementApprovedSponsor = applicationCreateRequest.FormTrustImprovementApprovedSponsor, - ApplicationStatusId = applicationCreateRequest.ApplicationStatusId, - KeyPersons = applicationCreateRequest.KeyPersons - .Select(A2BApplicationKeyPersonsFactory.Create) - .ToList(), - ApplyingSchools = applicationCreateRequest.ApplyingSchools - .Select(A2BApplicationApplyingSchoolFactory.Create) - .ToList(), - DynamicsApplicationId = applicationCreateRequest.DynamicsApplicationId - }; - - var expectedResult = new A2BApplicationResponse - { - ApplicationId = "10001", - Name = applicationCreateRequest.Name, - ApplicationType = applicationCreateRequest.ApplicationType, - FormTrustProposedNameOfTrust = applicationCreateRequest.FormTrustProposedNameOfTrust, - ApplicationSubmitted = applicationCreateRequest.ApplicationSubmitted, - ApplicationLeadAuthorId = applicationCreateRequest.ApplicationLeadAuthorId, - ApplicationVersion = applicationCreateRequest.ApplicationVersion, - ApplicationLeadAuthorName = applicationCreateRequest.ApplicationLeadAuthorName, - ApplicationLeadEmail = applicationCreateRequest.ApplicationLeadEmail, - ApplicationRole = applicationCreateRequest.ApplicationRole, - ApplicationRoleOtherDescription = applicationCreateRequest.ApplicationRoleOtherDescription, - ChangesToTrust = applicationCreateRequest.ChangesToTrust, - ChangesToTrustExplained = applicationCreateRequest.ChangesToTrustExplained, - ChangesToLaGovernance = applicationCreateRequest.ChangesToLaGovernance, - ChangesToLaGovernanceExplained = applicationCreateRequest.ChangesToLaGovernanceExplained, - FormTrustOpeningDate = applicationCreateRequest.FormTrustOpeningDate, - TrustId = applicationCreateRequest.TrustId, - TrustApproverName = applicationCreateRequest.TrustApproverName, - TrustApproverEmail = applicationCreateRequest.TrustApproverEmail, - FormTrustReasonApprovalToConvertAsSat = applicationCreateRequest.FormTrustReasonApprovalToConvertAsSat, - FormTrustReasonApprovedPerson = applicationCreateRequest.FormTrustReasonApprovedPerson, - FormTrustReasonForming = applicationCreateRequest.FormTrustReasonForming, - FormTrustReasonVision = applicationCreateRequest.FormTrustReasonVision, - FormTrustReasonGeoAreas = applicationCreateRequest.FormTrustReasonGeoAreas, - FormTrustReasonFreedom = applicationCreateRequest.FormTrustReasonFreedom, - FormTrustReasonImproveTeaching = applicationCreateRequest.FormTrustReasonImproveTeaching, - FormTrustPlanForGrowth = applicationCreateRequest.FormTrustPlanForGrowth, - FormTrustPlansForNoGrowth = applicationCreateRequest.FormTrustPlansForNoGrowth, - FormTrustGrowthPlansYesNo = applicationCreateRequest.FormTrustGrowthPlansYesNo, - FormTrustImprovementSupport = applicationCreateRequest.FormTrustImprovementSupport, - FormTrustImprovementStrategy = applicationCreateRequest.FormTrustImprovementStrategy, - FormTrustImprovementApprovedSponsor = applicationCreateRequest.FormTrustImprovementApprovedSponsor, - ApplicationStatusId = applicationCreateRequest.ApplicationStatusId, - KeyPersons = applicationCreateRequest.KeyPersons, - ApplyingSchools = applicationCreateRequest.ApplyingSchools, - DynamicsApplicationId = applicationCreateRequest.DynamicsApplicationId - }; - expectedResult.ApplyingSchools.ToList().ForEach(x => x.SchoolLeases = new List()); - expectedResult.ApplyingSchools.ToList().ForEach(x => x.SchoolLoans = new List()); - - var mockGateway = new Mock(); - - mockGateway.Setup(g => g.CreateA2BApplication(It.IsAny())).Returns(application); - - var useCase = new CreateA2BApplication(mockGateway.Object); - - var result = useCase.Execute(applicationCreateRequest); - - result.Should().NotBeNull(); - result.Should().BeEquivalentTo(expectedResult); - } - } -} \ No newline at end of file diff --git a/TramsDataApi.Test/UseCases/GetA2BApplicationTests.cs b/TramsDataApi.Test/UseCases/GetA2BApplicationTests.cs deleted file mode 100644 index e67f3f228..000000000 --- a/TramsDataApi.Test/UseCases/GetA2BApplicationTests.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Linq; -using FizzWare.NBuilder; -using FluentAssertions; -using Moq; -using TramsDataApi.DatabaseModels; -using TramsDataApi.Factories.A2BApplicationFactories; -using TramsDataApi.Gateways; -using TramsDataApi.UseCases; -using Xunit; - -namespace TramsDataApi.Test.UseCases -{ - public class GetA2BApplicationTests - { - [Fact] - public void GetA2BApplication_ShouldReturnNull_WhenApplicationIdIsNotFound() - { - const string applicationId = "10001"; - var mockGateway = new Mock(); - - mockGateway.Setup(g => g.GetByApplicationId(applicationId)); - - var useCase = new GetA2BApplication(mockGateway.Object); - var result = useCase.Execute(applicationId); - - result.Should().BeNull(); - } - - [Fact] - public void GetA2BApplication_ShouldReturnA2BApplicationResponse_WhenApplicationIdIsFound() - { - const string applicationId = "10001"; - var mockGateway = new Mock(); - var keyPersons = Builder.CreateListOfSize(1).Build().ToList(); - var applyingSchools = Builder.CreateListOfSize(1).Build().ToList(); - var application = Builder - .CreateNew() - .With(a => a.ApplicationId == applicationId) - .With(a => a.ApplicationType = "FormMat") - .With(a => a.KeyPersons = keyPersons) - .With(a => a.ApplyingSchools = applyingSchools) - .Build(); - - var expected = A2BApplicationFactory.Create(application); - - mockGateway.Setup(g => g.GetByApplicationId(applicationId)).Returns(application); - - var useCase = new GetA2BApplication(mockGateway.Object); - var result = useCase.Execute(applicationId); - - result.Should().BeEquivalentTo(expected); - } - } -} \ No newline at end of file diff --git a/TramsDataApi/Controllers/V2/A2BApplicationController.cs b/TramsDataApi/Controllers/V2/A2BApplicationController.cs deleted file mode 100644 index 9b0976d8f..000000000 --- a/TramsDataApi/Controllers/V2/A2BApplicationController.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Text.Json; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ResponseModels; -using TramsDataApi.ResponseModels.ApplyToBecome; -using TramsDataApi.UseCases; - -namespace TramsDataApi.Controllers.V2 -{ - [ApiVersion("2.0")] - [ApiController] - [Route("v{version:apiVersion}/apply-to-become/application")] - public class A2BApplicationController: ControllerBase - { - private readonly ILogger _logger; - private readonly IGetA2BApplication _getA2BApplicationById; - private readonly ICreateA2BApplication _createA2BApplication; - - public A2BApplicationController( - ILogger logger, - IGetA2BApplication getA2BApplicationById, - ICreateA2BApplication createA2BApplication) - { - _logger = logger; - _getA2BApplicationById = getA2BApplicationById; - _createA2BApplication = createA2BApplication; - } - - [HttpGet] - [Route("{applicationId}")] - [MapToApiVersion("2.0")] - public ActionResult> GetApplicationByApplicationId(string applicationId) - { - _logger.LogInformation("Attempting to get ApplyToBecome Application by ApplicationId {applicationId}", applicationId); - var application = _getA2BApplicationById.Execute(applicationId); - - if (application == null) - { - _logger.LogInformation($"No ApplyToBecome Application found for ApplicationId {applicationId}", applicationId); - return NotFound($"Application with Id '{applicationId}' not found"); - } - - _logger.LogInformation($"Returning ApplyToBecome Application by ApplicationId {applicationId}", applicationId); - _logger.LogDebug(JsonSerializer.Serialize(application)); - var response = new ApiSingleResponseV2(application); - - return Ok(response); - } - - [HttpPost] - [MapToApiVersion("2.0")] - public ActionResult> Create(A2BApplicationCreateRequest request) - { - var createdA2BApplication = _createA2BApplication.Execute(request); - var response = new ApiSingleResponseV2(createdA2BApplication); - - return new ObjectResult(response) {StatusCode = StatusCodes.Status201Created}; - } - } -} \ No newline at end of file diff --git a/TramsDataApi/DatabaseModels/A2BApplication.cs b/TramsDataApi/DatabaseModels/A2BApplication.cs deleted file mode 100644 index b371c2742..000000000 --- a/TramsDataApi/DatabaseModels/A2BApplication.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace TramsDataApi.DatabaseModels -{ - [Table("A2BApplication", Schema="sdd")] - public class A2BApplication - { - [Key] - public string ApplicationId { get; set; } - - public string Name { get; set; } - public string TrustName { get; set; } - public string ApplicationType { get; set; } - public string FormTrustProposedNameOfTrust { get; set; } - public bool? ApplicationSubmitted { get; set; } - public string ApplicationLeadAuthorId { get; set; } - public string ApplicationVersion { get; set; } - public string ApplicationLeadAuthorName { get; set; } - public string ApplicationLeadEmail { get; set; } - public string ApplicationRole { get; set; } - public string ApplicationRoleOtherDescription { get; set; } - public bool? ChangesToTrust { get; set; } - public string ChangesToTrustExplained { get; set; } - public bool? ChangesToLaGovernance { get; set; } - public string ChangesToLaGovernanceExplained { get; set; } - public DateTime? FormTrustOpeningDate { get; set; } - public string TrustApproverName { get; set; } - public string TrustApproverEmail { get; set; } - public bool? FormTrustReasonApprovalToConvertAsSat { get; set; } - public string FormTrustReasonApprovedPerson { get; set; } - public string FormTrustReasonForming { get; set; } - public string FormTrustReasonVision { get; set; } - public string FormTrustReasonGeoAreas { get; set; } - public string FormTrustReasonFreedom { get; set; } - public string FormTrustReasonImproveTeaching { get; set; } - public string FormTrustPlanForGrowth { get; set; } - public string FormTrustPlansForNoGrowth { get; set; } - public bool? FormTrustGrowthPlansYesNo { get; set; } - public string FormTrustImprovementSupport { get; set; } - public string FormTrustImprovementStrategy { get; set; } - public string FormTrustImprovementApprovedSponsor { get; set; } - public string TrustId { get; set; } - public string ApplicationStatusId { get; set; } - - [ForeignKey(nameof(ApplicationId))] - public virtual ICollection KeyPersons { get; set; } - - [ForeignKey(nameof(ApplicationId))] - public virtual ICollection ApplyingSchools { get; set; } - - public Guid DynamicsApplicationId { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/DatabaseModels/A2BApplicationApplyingSchool.cs b/TramsDataApi/DatabaseModels/A2BApplicationApplyingSchool.cs deleted file mode 100644 index bca353170..000000000 --- a/TramsDataApi/DatabaseModels/A2BApplicationApplyingSchool.cs +++ /dev/null @@ -1,139 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace TramsDataApi.DatabaseModels -{ - [Table("A2BApplicationApplyingSchool", Schema = "sdd")] - public class A2BApplicationApplyingSchool - { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int ApplyingSchoolId {get; set;} - - public string SchoolDeclarationSignedById {get; set;} - public string SchoolDeclarationSignedByName { get; set; } - public bool? SchoolDeclarationBodyAgree {get; set;} // the information is true to the best of my knowledge - public bool? SchoolDeclarationTeacherChair {get; set;} // I declare I am the teacher or chair of governors - public string SchoolDeclarationSignedByEmail {get; set;} - public string Name {get; set;} - public string SchoolConversionReasonsForJoining {get; set;} - public bool? SchoolConversionTargetDateDifferent {get; set;} - public DateTime? SchoolConversionTargetDateDate {get; set;} - public string SchoolConversionTargetDateExplained {get; set;} - public bool? SchoolConversionChangeName {get; set;} - public string SchoolConversionChangeNameValue {get; set;} - public string SchoolConversionContactHeadName {get; set;} - public string SchoolConversionContactHeadEmail {get; set;} - public string SchoolConversionContactHeadTel {get; set;} - public string SchoolConversionContactChairName {get; set;} - public string SchoolConversionContactChairEmail {get; set;} - public string SchoolConversionContactChairTel {get; set;} - public string SchoolConversionContactRole {get; set;} - public string SchoolConversionMainContactOtherName {get; set;} - public string SchoolConversionMainContactOtherEmail {get; set;} - public string SchoolConversionMainContactOtherTelephone {get; set;} - public string SchoolConversionMainContactOtherRole {get; set;} - public string SchoolConversionApproverContactName {get; set;} - public string SchoolConversionApproverContactEmail {get; set;} - public bool? SchoolAdInspectedButReportNotPublished {get; set;} - public string SchoolAdInspectedReportNotPublishedExplain {get; set;} - public bool? SchoolLaReorganization {get; set;} - public string SchoolLaReorganizationExplain {get; set;} - public bool? SchoolLaClosurePlans {get; set;} - public string SchoolLaClosurePlansExplain {get; set;} - public bool? SchoolPartOfFederation {get; set;} - public bool? SchoolAddFurtherInformation {get; set;} - public string SchoolFurtherInformation {get; set;} - public string SchoolAdSchoolContributionToTrust {get; set;} - public bool? SchoolAdSafeguarding {get; set;} - public string SchoolAdSafeguardingExplained {get; set;} - public bool? SchoolSACREExemption {get; set;} - public DateTime? SchoolSACREExemptionEndDate {get; set;} - public bool? SchoolFaithSchool {get; set;} - public string SchoolFaithSchoolDioceseName {get; set;} - public bool? SchoolSupportedFoundation {get; set;} - public string SchoolSupportedFoundationBodyName {get; set;} - public string SchoolAdFeederSchools {get; set;} - public bool? SchoolAdEqualitiesImpactAssessment {get; set;} - public string SchoolAdEqualitiesImpactAssessmentDetails { get; set; } - - [Column(TypeName = "decimal(18,2)")] - public decimal? SchoolPFYRevenue {get; set;} - public bool? SchoolPFYRevenueIsDeficit { get; set; } - public string SchoolPFYRevenueStatusExplained {get; set;} - - [Column(TypeName = "decimal(18,2)")] - public decimal? SchoolPFYCapitalForward {get; set;} - public bool? SchoolPFYCapitalIsDeficit { get; set; } - public string SchoolPFYCapitalForwardStatusExplained {get; set;} - public DateTime? SchoolPFYEndDate { get; set; } - - [Column(TypeName = "decimal(18,2)")] - public decimal? SchoolCFYRevenue {get; set;} - public bool? SchoolCFYRevenueIsDeficit { get; set; } - public string SchoolCFYRevenueStatusExplained {get; set;} - - [Column(TypeName = "decimal(18,2)")] - public decimal? SchoolCFYCapitalForward {get; set;} - public bool? SchoolCFYCapitalIsDeficit { get; set; } - public string SchoolCFYCapitalForwardStatusExplained {get; set;} - public DateTime? SchoolCFYEndDate { get; set; } - - [Column(TypeName = "decimal(18,2)")] - public decimal? SchoolNFYRevenue {get; set;} - public bool? SchoolNFYRevenueIsDeficit { get; set; } - public string SchoolNFYRevenueStatusExplained {get; set;} - - [Column(TypeName = "decimal(18,2)")] - public decimal? SchoolNFYCapitalForward {get; set;} - public bool? SchoolNFYCapitalIsDeficit { get; set; } - public string SchoolNFYCapitalForwardStatusExplained {get; set;} - public DateTime? SchoolNFYEndDate { get; set; } - public bool? SchoolFinancialInvestigations {get; set;} // int? - public string SchoolFinancialInvestigationsExplain {get; set;} - public bool? SchoolFinancialInvestigationsTrustAware {get; set;} - public int? ProjectedPupilNumbersYear1 {get; set;} - public int? ProjectedPupilNumbersYear2 {get; set;} - public int? ProjectedPupilNumbersYear3 {get; set;} - public string SchoolCapacityAssumptions {get; set;} - public int? SchoolCapacityPublishedAdmissionsNumber {get; set;} - public string SchoolBuildLandOwnerExplained {get; set;} - public bool? SchoolBuildLandSharedFacilities {get; set;} - public string SchoolBuildLandSharedFacilitiesExplained {get; set;} - public bool? SchoolBuildLandWorksPlanned {get; set;} - public string SchoolBuildLandWorksPlannedExplained {get; set;} - public DateTime? SchoolBuildLandWorksPlannedDate {get; set;} - public bool? SchoolBuildLandGrants {get; set;} - public string SchoolBuildLandGrantsBody {get; set;} - public bool? SchoolBuildLandPriorityBuildingProgramme {get; set;} - public bool? SchoolBuildLandFutureProgramme {get; set;} - public bool? SchoolBuildLandPFIScheme {get; set;} - public string SchoolBuildLandPFISchemeType {get; set;} - public bool? SchoolConsultationStakeholders {get; set;} - public string SchoolConsultationStakeholdersConsult {get; set;} - public string SchoolSupportGrantFundsPaidTo {get; set;} - - public string DiocesePermissionEvidenceDocumentLink { get; set; } - public string FoundationEvidenceDocumentLink { get; set; } - public string GoverningBodyConsentEvidenceDocumentLink { get; set; } - - [ForeignKey(nameof(ApplyingSchoolId))] - public virtual ICollection SchoolLeases { get; set; } - - [ForeignKey(nameof(ApplyingSchoolId))] - public virtual ICollection SchoolLoans { get; set; } - - public string ApplicationId { get; set; } - public virtual A2BApplication A2BApplication { get; set; } - - public int Urn { get; set; } - - public string LocalAuthorityName { get; set; } - - public Guid DynamicsApplyingSchoolId { get; set; } - - public Guid DynamicsApplicationId { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/DatabaseModels/A2BApplicationKeyPersons.cs b/TramsDataApi/DatabaseModels/A2BApplicationKeyPersons.cs deleted file mode 100644 index 1773ba4dc..000000000 --- a/TramsDataApi/DatabaseModels/A2BApplicationKeyPersons.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace TramsDataApi.DatabaseModels -{ - [Table("A2BApplicationKeyPersons", Schema = "sdd")] - public class A2BApplicationKeyPersons - { - public string Name {get; set;} - - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int KeyPersonId {get; set;} - - public DateTime? KeyPersonDateOfBirth {get; set;} - public string KeyPersonBiography {get; set;} - public bool? KeyPersonCeoExecutive {get; set;} - public bool? KeyPersonChairOfTrust {get; set;} - public bool? KeyPersonFinancialDirector {get; set;} - public bool? KeyPersonMember {get; set;} - public bool? KeyPersonOther {get; set;} - public bool? KeyPersonTrustee {get; set;} - - public string ApplicationId { get; set; } - public virtual A2BApplication A2BApplication { get; set; } - - public Guid DynamicsKeyPersonId { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/DatabaseModels/A2BSchoolLease.cs b/TramsDataApi/DatabaseModels/A2BSchoolLease.cs deleted file mode 100644 index d222ac0d8..000000000 --- a/TramsDataApi/DatabaseModels/A2BSchoolLease.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace TramsDataApi.DatabaseModels -{ - [Table("A2BSchoolLease", Schema = "sdd")] - public class A2BSchoolLease - { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int SchoolLeaseId {get; set;} - - public string SchoolLeaseTerm {get; set;} - - [Column(TypeName = "decimal(18,2)")] - public decimal SchoolLeaseRepaymentValue {get; set;} - - [Column(TypeName = "decimal(18,2)")] - public decimal SchoolLeaseInterestRate {get; set;} - - [Column(TypeName = "decimal(18,2)")] - public decimal SchoolLeasePaymentToDate {get; set;} - public string SchoolLeasePurpose {get; set;} - public string SchoolLeaseValueOfAssets {get; set;} - public string SchoolLeaseResponsibleForAssets {get; set;} - - public int ApplyingSchoolId { get; set; } - public virtual A2BApplicationApplyingSchool A2BApplicationApplyingSchool { get; set; } - - public Guid DynamicsSchoolLeaseId { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/DatabaseModels/A2BSchoolLoan.cs b/TramsDataApi/DatabaseModels/A2BSchoolLoan.cs deleted file mode 100644 index 5372c34fc..000000000 --- a/TramsDataApi/DatabaseModels/A2BSchoolLoan.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace TramsDataApi.DatabaseModels -{ - [Table("A2BSchoolLoan", Schema = "sdd")] - public class A2BSchoolLoan - { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int SchoolLoanId {get; set;} - - [Column(TypeName = "decimal(18,2)")] - public decimal? SchoolLoanAmount {get; set;} - public string SchoolLoanPurpose {get; set;} - public string SchoolLoanProvider {get; set;} - public string SchoolLoanInterestRate {get; set;} - public string SchoolLoanSchedule {get; set;} - - public int ApplyingSchoolId { get; set; } - public virtual A2BApplicationApplyingSchool A2BApplicationApplyingSchool { get; set; } - - public Guid DynamicsSchoolLoanId { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/DatabaseModels/TramsDbContext.cs b/TramsDataApi/DatabaseModels/TramsDbContext.cs index e4236c341..29bb10150 100644 --- a/TramsDataApi/DatabaseModels/TramsDbContext.cs +++ b/TramsDataApi/DatabaseModels/TramsDbContext.cs @@ -16,11 +16,6 @@ public TramsDbContext(DbContextOptions options) public virtual DbSet AcademyTransferProjectIntendedTransferBenefits { get; set; } public virtual DbSet AcademyTransferProjects { get; set; } public virtual DbSet TransferringAcademies { get; set; } - public virtual DbSet A2BApplications { get; set; } - public virtual DbSet A2BApplicationKeyPersons { get; set; } - public virtual DbSet A2BApplicationApplyingSchools { get; set; } - public virtual DbSet A2BSchoolLeases { get; set; } - public virtual DbSet A2BSchoolLoans { get; set; } public virtual DbSet FssProjects { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) diff --git a/TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationApplyingSchoolFactory.cs b/TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationApplyingSchoolFactory.cs deleted file mode 100644 index 9f75883ba..000000000 --- a/TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationApplyingSchoolFactory.cs +++ /dev/null @@ -1,242 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using TramsDataApi.DatabaseModels; -using TramsDataApi.ServiceModels.ApplyToBecome; - -namespace TramsDataApi.Factories.A2BApplicationFactories -{ - public static class A2BApplicationApplyingSchoolFactory - { - public static A2BApplicationApplyingSchool Create(A2BApplicationApplyingSchoolServiceModel request) - { - return request == null - ? null - : new A2BApplicationApplyingSchool - { - Name = request.SchoolName, - SchoolDeclarationBodyAgree = request.DeclarationBodyAgree, - SchoolDeclarationTeacherChair = request.DeclarationIAmTheChairOrHeadteacher, - SchoolDeclarationSignedByName = request.DeclarationSignedByName, - SchoolConversionReasonsForJoining = request.SchoolConversionReasonsForJoining, - SchoolConversionTargetDateDifferent = request.SchoolConversionTargetDateSpecified, - SchoolConversionTargetDateDate = request.SchoolConversionTargetDate, - SchoolConversionTargetDateExplained = request.SchoolConversionTargetDateExplained, - SchoolConversionChangeName = request.SchoolConversionChangeNamePlanned, - SchoolConversionChangeNameValue = request.SchoolConversionProposedNewSchoolName, - SchoolConversionContactHeadName = request.SchoolConversionContactHeadName, - SchoolConversionContactHeadEmail = request.SchoolConversionContactHeadEmail, - SchoolConversionContactHeadTel = request.SchoolConversionContactHeadTel, - SchoolConversionContactChairName = request.SchoolConversionContactChairName, - SchoolConversionContactChairEmail = request.SchoolConversionContactChairEmail, - SchoolConversionContactChairTel = request.SchoolConversionContactChairTel, - SchoolConversionContactRole = request.SchoolConversionContactRole, - SchoolConversionMainContactOtherName = request.SchoolConversionMainContactOtherName, - SchoolConversionMainContactOtherEmail = request.SchoolConversionMainContactOtherEmail, - SchoolConversionMainContactOtherTelephone = request.SchoolConversionMainContactOtherTelephone, - SchoolConversionMainContactOtherRole = request.SchoolConversionMainContactOtherRole, - SchoolConversionApproverContactName = request.SchoolConversionApproverContactName, - SchoolConversionApproverContactEmail = request.SchoolConversionApproverContactEmail, - SchoolAdInspectedButReportNotPublished = request.SchoolAdInspectedButReportNotPublished, - SchoolAdInspectedReportNotPublishedExplain = request.SchoolAdInspectedButReportNotPublishedExplain, - SchoolLaReorganization = request.SchoolPartOfLaReorganizationPlan, - SchoolLaReorganizationExplain = request.SchoolLaReorganizationDetails, - SchoolLaClosurePlans = request.SchoolPartOfLaClosurePlan, - SchoolLaClosurePlansExplain = request.SchoolLaClosurePlanDetails, - SchoolPartOfFederation = request.SchoolIsPartOfFederation, - SchoolAddFurtherInformation = request.SchoolAdditionalInformationAdded, - SchoolFurtherInformation = request.SchoolAdditionalInformation, - SchoolAdSchoolContributionToTrust = request.SchoolAdSchoolContributionToTrust, - SchoolAdSafeguarding = request.SchoolOngoingSafeguardingInvestigations, - SchoolAdSafeguardingExplained = request.SchoolOngoingSafeguardingDetails, - SchoolSACREExemption = request.SchoolHasSACREException, - SchoolSACREExemptionEndDate = request.SchoolSACREExemptionEndDate, - SchoolFaithSchool = request.SchoolFaithSchool, - SchoolFaithSchoolDioceseName = request.SchoolFaithSchoolDioceseName, - SchoolSupportedFoundation = request.SchoolIsSupportedByFoundation, - SchoolSupportedFoundationBodyName = request.SchoolSupportedFoundationBodyName, - SchoolAdFeederSchools = request.SchoolAdFeederSchools, - SchoolAdEqualitiesImpactAssessment = request.SchoolAdEqualitiesImpactAssessmentCompleted, - SchoolAdEqualitiesImpactAssessmentDetails = request.SchoolAdEqualitiesImpactAssessmentDetails, - SchoolPFYRevenue = request.PreviousFinancialYear.RevenueCarryForward, - SchoolPFYRevenueIsDeficit = request.PreviousFinancialYear.RevenueIsDeficit, - SchoolPFYCapitalForward = request.PreviousFinancialYear.CapitalCarryForward, - SchoolPFYCapitalIsDeficit = request.PreviousFinancialYear.CapitalIsDeficit, - SchoolPFYEndDate = request.PreviousFinancialYear.FYEndDate, - SchoolPFYCapitalForwardStatusExplained = request.PreviousFinancialYear.CapitalStatusExplained, - SchoolPFYRevenueStatusExplained = request.PreviousFinancialYear.RevenueStatusExplained, - SchoolCFYRevenue = request.CurrentFinancialYear.RevenueCarryForward, - SchoolCFYRevenueIsDeficit = request.CurrentFinancialYear.RevenueIsDeficit, - SchoolCFYCapitalForward = request. CurrentFinancialYear.CapitalCarryForward, - SchoolCFYCapitalIsDeficit = request.CurrentFinancialYear.CapitalIsDeficit, - SchoolCFYCapitalForwardStatusExplained = request.CurrentFinancialYear.CapitalStatusExplained, - SchoolCFYRevenueStatusExplained = request.CurrentFinancialYear.RevenueStatusExplained, - SchoolCFYEndDate = request.CurrentFinancialYear.FYEndDate, - SchoolNFYRevenue = request.NextFinancialYear.RevenueCarryForward, - SchoolNFYRevenueIsDeficit = request.NextFinancialYear.RevenueIsDeficit, - SchoolNFYCapitalForward = request.NextFinancialYear.CapitalCarryForward, - SchoolNFYCapitalIsDeficit = request.NextFinancialYear.CapitalIsDeficit, - SchoolNFYEndDate = request.NextFinancialYear.FYEndDate, - SchoolNFYCapitalForwardStatusExplained = request.NextFinancialYear.CapitalStatusExplained, - SchoolNFYRevenueStatusExplained = request.NextFinancialYear.RevenueStatusExplained, - SchoolFinancialInvestigations = request.FinanceOngoingInvestigations, - SchoolFinancialInvestigationsExplain = request.SchoolFinancialInvestigationsExplain, - SchoolFinancialInvestigationsTrustAware = request.SchoolFinancialInvestigationsTrustAware, - ProjectedPupilNumbersYear1 = request.ProjectedPupilNumbersYear1, - ProjectedPupilNumbersYear2 = request.ProjectedPupilNumbersYear2, - ProjectedPupilNumbersYear3 = request.ProjectedPupilNumbersYear3, - SchoolCapacityAssumptions = request.SchoolCapacityAssumptions, - SchoolCapacityPublishedAdmissionsNumber = request.SchoolCapacityPublishedAdmissionsNumber, - SchoolBuildLandOwnerExplained = request.SchoolBuildLandOwnerExplained, - SchoolBuildLandSharedFacilities = request.SchoolBuildLandSharedFacilities, - SchoolBuildLandSharedFacilitiesExplained = request.SchoolBuildLandSharedFacilitiesExplained, - SchoolBuildLandWorksPlanned = request.SchoolBuildLandWorksPlanned, - SchoolBuildLandWorksPlannedExplained = request.SchoolBuildLandWorksPlannedExplained, - SchoolBuildLandWorksPlannedDate = request.SchoolBuildLandWorksPlannedCompletionDate, - SchoolBuildLandGrants = request.SchoolBuildLandGrants, - SchoolBuildLandGrantsBody = request.SchoolBuildLandGrantsExplained, - SchoolBuildLandPriorityBuildingProgramme = request.SchoolBuildLandPriorityBuildingProgramme, - SchoolBuildLandFutureProgramme = request.SchoolBuildLandFutureProgramme, - SchoolBuildLandPFIScheme = request.SchoolBuildLandPFIScheme, - SchoolBuildLandPFISchemeType = request.SchoolBuildLandPFISchemeType, - SchoolConsultationStakeholders = request.SchoolHasConsultedStakeholders, - SchoolConsultationStakeholdersConsult = request.SchoolPlanToConsultStakeholders, - SchoolSupportGrantFundsPaidTo = request.SchoolSupportGrantFundsPaidTo, - DiocesePermissionEvidenceDocumentLink = request.DiocesePermissionEvidenceDocumentLink, - GoverningBodyConsentEvidenceDocumentLink = request.GoverningBodyConsentEvidenceDocumentLink, - FoundationEvidenceDocumentLink = request.FoundationEvidenceDocumentLink, - SchoolLoans = request.SchoolLoans? - .Select(A2BSchoolLoanFactory.Create) - .ToList(), - SchoolLeases = request.SchoolLeases? - .Select(A2BSchoolLeaseFactory.Create) - .ToList(), - DynamicsApplicationId = request.DynamicsApplicationId, - LocalAuthorityName = request.LocalAuthorityName, - DynamicsApplyingSchoolId = request.DynamicsApplyingSchoolId, - Urn = request.Urn - }; - } - - // converting nullables into non-nullables in the code below for now - // will throw InvalidOperationException if value is null - // validation to come - public static A2BApplicationApplyingSchoolServiceModel Create(A2BApplicationApplyingSchool request) - { - return request is null ? null : new A2BApplicationApplyingSchoolServiceModel - { - SchoolName = request.Name, - DeclarationBodyAgree = request.SchoolDeclarationBodyAgree, - DeclarationIAmTheChairOrHeadteacher = request.SchoolDeclarationTeacherChair, - DeclarationSignedByName = request.SchoolDeclarationSignedByName, - SchoolConversionReasonsForJoining = request.SchoolConversionReasonsForJoining, - SchoolConversionTargetDateSpecified = request.SchoolConversionTargetDateDifferent, - SchoolConversionTargetDate = request.SchoolConversionTargetDateDate, - SchoolConversionTargetDateExplained = request.SchoolConversionTargetDateExplained, - SchoolConversionChangeNamePlanned = request.SchoolConversionChangeName, - SchoolConversionProposedNewSchoolName = request.SchoolConversionChangeNameValue, - SchoolConversionContactHeadName = request.SchoolConversionContactHeadName, - SchoolConversionContactHeadEmail = request.SchoolConversionContactHeadEmail, - SchoolConversionContactHeadTel = request.SchoolConversionContactHeadTel, - SchoolConversionContactChairName = request.SchoolConversionContactChairName, - SchoolConversionContactChairEmail = request.SchoolConversionContactChairEmail, - SchoolConversionContactChairTel = request.SchoolConversionContactChairTel, - SchoolConversionContactRole = request.SchoolConversionContactRole, // "headteacher", "chair of governing body", "someone else" - SchoolConversionMainContactOtherName = request.SchoolConversionMainContactOtherName, - SchoolConversionMainContactOtherEmail = request.SchoolConversionMainContactOtherEmail, - SchoolConversionMainContactOtherTelephone = request.SchoolConversionMainContactOtherTelephone, - SchoolConversionMainContactOtherRole = request.SchoolConversionMainContactOtherRole, - SchoolConversionApproverContactName = request.SchoolConversionApproverContactName, - SchoolConversionApproverContactEmail = request.SchoolConversionApproverContactEmail, - SchoolAdInspectedButReportNotPublished = request.SchoolAdInspectedButReportNotPublished, - SchoolAdInspectedButReportNotPublishedExplain = request.SchoolAdInspectedReportNotPublishedExplain, - SchoolPartOfLaReorganizationPlan = request.SchoolLaReorganization, - SchoolLaReorganizationDetails = request.SchoolLaReorganizationExplain, - SchoolPartOfLaClosurePlan = request.SchoolLaClosurePlans, - SchoolLaClosurePlanDetails = request.SchoolLaClosurePlansExplain, - SchoolIsPartOfFederation = request.SchoolPartOfFederation, - SchoolAdditionalInformationAdded = request.SchoolAddFurtherInformation, - SchoolAdditionalInformation = request.SchoolFurtherInformation, - SchoolAdSchoolContributionToTrust = request.SchoolAdSchoolContributionToTrust, - SchoolOngoingSafeguardingInvestigations = request.SchoolAdSafeguarding, - SchoolOngoingSafeguardingDetails = request.SchoolAdSafeguardingExplained, - SchoolHasSACREException = request.SchoolSACREExemption, - SchoolSACREExemptionEndDate = request.SchoolSACREExemptionEndDate, - SchoolFaithSchool = request.SchoolFaithSchool, - SchoolFaithSchoolDioceseName = request.SchoolFaithSchoolDioceseName, - SchoolIsSupportedByFoundation = request.SchoolSupportedFoundation, - SchoolSupportedFoundationBodyName = request.SchoolSupportedFoundationBodyName, - SchoolAdFeederSchools = request.SchoolAdFeederSchools, - SchoolAdEqualitiesImpactAssessmentCompleted = request.SchoolAdEqualitiesImpactAssessment, - SchoolAdEqualitiesImpactAssessmentDetails = request.SchoolAdEqualitiesImpactAssessmentDetails, - PreviousFinancialYear = new FinancialYearServiceModel - { - RevenueCarryForward = request.SchoolPFYRevenue, - RevenueIsDeficit = request.SchoolPFYRevenueIsDeficit, - RevenueStatusExplained = request.SchoolPFYRevenueStatusExplained, - CapitalCarryForward = request.SchoolPFYCapitalForward, - CapitalIsDeficit = request.SchoolPFYCapitalIsDeficit, - CapitalStatusExplained = request.SchoolPFYCapitalForwardStatusExplained, - FYEndDate = request.SchoolPFYEndDate - }, - CurrentFinancialYear = new FinancialYearServiceModel - { - RevenueCarryForward = request.SchoolCFYRevenue, - RevenueIsDeficit = request.SchoolCFYRevenueIsDeficit, - RevenueStatusExplained = request.SchoolCFYRevenueStatusExplained, - CapitalCarryForward = request.SchoolCFYCapitalForward, - CapitalIsDeficit = request.SchoolCFYCapitalIsDeficit, - CapitalStatusExplained = request.SchoolCFYCapitalForwardStatusExplained, - FYEndDate = request.SchoolCFYEndDate - }, - NextFinancialYear = new FinancialYearServiceModel - { - RevenueCarryForward = request.SchoolNFYRevenue, - RevenueIsDeficit = request.SchoolNFYRevenueIsDeficit, - RevenueStatusExplained = request.SchoolNFYRevenueStatusExplained, - CapitalCarryForward = request.SchoolNFYCapitalForward, - CapitalIsDeficit = request.SchoolNFYCapitalIsDeficit, - CapitalStatusExplained = request.SchoolNFYCapitalForwardStatusExplained, - FYEndDate = request.SchoolNFYEndDate - }, - FinanceOngoingInvestigations = request.SchoolFinancialInvestigations, - SchoolFinancialInvestigationsExplain = request.SchoolFinancialInvestigationsExplain, - SchoolFinancialInvestigationsTrustAware = request.SchoolFinancialInvestigationsTrustAware, - ProjectedPupilNumbersYear1 = request.ProjectedPupilNumbersYear1, - ProjectedPupilNumbersYear2 = request.ProjectedPupilNumbersYear2, - ProjectedPupilNumbersYear3 = request.ProjectedPupilNumbersYear3, - SchoolCapacityAssumptions = request.SchoolCapacityAssumptions, - SchoolCapacityPublishedAdmissionsNumber = request.SchoolCapacityPublishedAdmissionsNumber, - SchoolBuildLandOwnerExplained = request.SchoolBuildLandOwnerExplained, - SchoolBuildLandSharedFacilities = request.SchoolBuildLandSharedFacilities, - SchoolBuildLandSharedFacilitiesExplained = request.SchoolBuildLandSharedFacilitiesExplained, - SchoolBuildLandWorksPlanned = request.SchoolBuildLandWorksPlanned, - SchoolBuildLandWorksPlannedExplained = request.SchoolBuildLandWorksPlannedExplained, - SchoolBuildLandWorksPlannedCompletionDate = request.SchoolBuildLandWorksPlannedDate, - SchoolBuildLandGrants = request.SchoolBuildLandGrants, - SchoolBuildLandGrantsExplained = request.SchoolBuildLandGrantsBody, - SchoolBuildLandPriorityBuildingProgramme = request.SchoolBuildLandPriorityBuildingProgramme, - SchoolBuildLandFutureProgramme = request.SchoolBuildLandFutureProgramme, - SchoolBuildLandPFIScheme = request.SchoolBuildLandPFIScheme, - SchoolBuildLandPFISchemeType = request.SchoolBuildLandPFISchemeType, - SchoolHasConsultedStakeholders = request.SchoolConsultationStakeholders, - SchoolPlanToConsultStakeholders = request.SchoolConsultationStakeholdersConsult, - SchoolSupportGrantFundsPaidTo = request.SchoolSupportGrantFundsPaidTo, - DiocesePermissionEvidenceDocumentLink = request.DiocesePermissionEvidenceDocumentLink, - FoundationEvidenceDocumentLink = request.FoundationEvidenceDocumentLink, - GoverningBodyConsentEvidenceDocumentLink = request.GoverningBodyConsentEvidenceDocumentLink, - SchoolLeases = request.SchoolLeases == null - ? new List() - : request.SchoolLeases.Select(A2BSchoolLeaseServiceModelFactory.Create) - .ToList(), - SchoolLoans = request.SchoolLoans == null - ? new List() - : request.SchoolLoans.Select(A2BSchoolLoanServiceModelFactory.Create) - .ToList(), - DynamicsApplicationId = request.DynamicsApplicationId, - LocalAuthorityName = request.LocalAuthorityName, - DynamicsApplyingSchoolId = request.DynamicsApplyingSchoolId, - Urn = request.Urn - }; - } - } -} \ No newline at end of file diff --git a/TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationFactory.cs b/TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationFactory.cs deleted file mode 100644 index 64f48aa0d..000000000 --- a/TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationFactory.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using TramsDataApi.DatabaseModels; -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ResponseModels.ApplyToBecome; -using TramsDataApi.ServiceModels.ApplyToBecome; - -namespace TramsDataApi.Factories.A2BApplicationFactories -{ - public static class A2BApplicationFactory - { - public static A2BApplication Create(A2BApplicationCreateRequest request) => new A2BApplication - { - ApplicationId = request.ApplicationId, - TrustName = request.TrustName, - ApplicationStatusId = request.ApplicationStatusId, - ApplicationType = request.ApplicationType, - Name = request.Name, - TrustId = request.TrustId, - FormTrustProposedNameOfTrust = request.FormTrustProposedNameOfTrust, - ApplicationSubmitted = request.ApplicationSubmitted, - ApplicationLeadAuthorId = request.ApplicationLeadAuthorId, - ApplicationVersion = request.ApplicationVersion, - ApplicationLeadAuthorName = request.ApplicationLeadAuthorName, - ApplicationLeadEmail = request.ApplicationLeadEmail, - ApplicationRole = request.ApplicationRole, - ApplicationRoleOtherDescription = request.ApplicationRoleOtherDescription, - ChangesToTrust = request.ChangesToTrust, - ChangesToTrustExplained = request.ChangesToTrustExplained, - ChangesToLaGovernance = request.ChangesToLaGovernance, - ChangesToLaGovernanceExplained = request.ChangesToLaGovernanceExplained, - FormTrustOpeningDate = request.FormTrustOpeningDate, - TrustApproverName = request.TrustApproverName, - TrustApproverEmail = request.TrustApproverEmail, - FormTrustReasonApprovalToConvertAsSat = request.FormTrustReasonApprovalToConvertAsSat, - FormTrustReasonApprovedPerson = request.FormTrustReasonApprovedPerson, - FormTrustReasonForming = request.FormTrustReasonForming, - FormTrustReasonVision = request.FormTrustReasonVision, - FormTrustReasonGeoAreas = request.FormTrustReasonGeoAreas, - FormTrustReasonFreedom = request.FormTrustReasonFreedom, - FormTrustReasonImproveTeaching = request.FormTrustReasonImproveTeaching, - FormTrustPlanForGrowth = request.FormTrustPlanForGrowth, - FormTrustPlansForNoGrowth = request.FormTrustPlansForNoGrowth, - FormTrustGrowthPlansYesNo = request.FormTrustGrowthPlansYesNo, - FormTrustImprovementSupport = request.FormTrustImprovementSupport, - FormTrustImprovementStrategy = request.FormTrustImprovementStrategy, - FormTrustImprovementApprovedSponsor = request.FormTrustImprovementApprovedSponsor, - KeyPersons = request.KeyPersons - .Select(A2BApplicationKeyPersonsFactory.Create) - .ToList(), - ApplyingSchools = request.ApplyingSchools - .Select(A2BApplicationApplyingSchoolFactory.Create) - .ToList(), - DynamicsApplicationId = request.DynamicsApplicationId, - - }; - - public static A2BApplicationResponse Create(A2BApplication application) => new A2BApplicationResponse - { - Name = application.Name, - TrustName = application.TrustName, - ApplicationId = application.ApplicationId, - ApplicationType = application.ApplicationType, - FormTrustProposedNameOfTrust = application.FormTrustProposedNameOfTrust, - ApplicationSubmitted = application.ApplicationSubmitted, - ApplicationLeadAuthorId = application.ApplicationLeadAuthorId, - ApplicationVersion = application.ApplicationVersion, - ApplicationLeadAuthorName = application.ApplicationLeadAuthorName, - ApplicationLeadEmail = application.ApplicationLeadEmail, - ApplicationRole = application.ApplicationRole, - ApplicationRoleOtherDescription = application.ApplicationRoleOtherDescription, - ChangesToTrust = application.ChangesToTrust, - ChangesToTrustExplained = application.ChangesToTrustExplained, - ChangesToLaGovernance = application.ChangesToLaGovernance, - ChangesToLaGovernanceExplained = application.ChangesToLaGovernanceExplained, - FormTrustOpeningDate = application.FormTrustOpeningDate, - TrustApproverName = application.TrustApproverName, - TrustApproverEmail = application.TrustApproverEmail, - TrustId = application.TrustId, - FormTrustReasonApprovalToConvertAsSat = application.FormTrustReasonApprovalToConvertAsSat, - FormTrustReasonApprovedPerson = application.FormTrustReasonApprovedPerson, - FormTrustReasonForming = application.FormTrustReasonForming, - FormTrustReasonVision = application.FormTrustReasonVision, - FormTrustReasonGeoAreas = application.FormTrustReasonGeoAreas, - FormTrustReasonFreedom = application.FormTrustReasonFreedom, - FormTrustReasonImproveTeaching = application.FormTrustReasonImproveTeaching, - FormTrustPlanForGrowth = application.FormTrustPlanForGrowth, - FormTrustPlansForNoGrowth = application.FormTrustPlansForNoGrowth, - FormTrustGrowthPlansYesNo = application.FormTrustGrowthPlansYesNo, - FormTrustImprovementSupport = application.FormTrustImprovementSupport, - FormTrustImprovementStrategy = application.FormTrustImprovementStrategy, - FormTrustImprovementApprovedSponsor = application.FormTrustImprovementApprovedSponsor, - ApplicationStatusId = application.ApplicationStatusId, - KeyPersons = application.KeyPersons == null - ? new List() - : application.KeyPersons - .Select(A2BApplicationKeyPersonsFactory.Create) - .ToList(), - ApplyingSchools = application.ApplyingSchools == null - ? new List() - : application.ApplyingSchools - .Select(A2BApplicationApplyingSchoolFactory.Create) - .ToList(), - DynamicsApplicationId = application.DynamicsApplicationId, - - }; - } -} \ No newline at end of file diff --git a/TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationKeyPersonsFactory.cs b/TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationKeyPersonsFactory.cs deleted file mode 100644 index 177b55af8..000000000 --- a/TramsDataApi/Factories/A2BApplicationFactories/A2BApplicationKeyPersonsFactory.cs +++ /dev/null @@ -1,42 +0,0 @@ -using TramsDataApi.DatabaseModels; -using TramsDataApi.RequestModels.ApplyToBecome; - -namespace TramsDataApi.Factories.A2BApplicationFactories -{ - public static class A2BApplicationKeyPersonsFactory - { - public static A2BApplicationKeyPersons Create(A2BApplicationKeyPersonsServiceModel request) - { - return new A2BApplicationKeyPersons - { - Name = request.Name, - KeyPersonDateOfBirth = request.KeyPersonDateOfBirth, - KeyPersonBiography = request.KeyPersonBiography, - KeyPersonCeoExecutive = request.KeyPersonCeoExecutive, - KeyPersonChairOfTrust = request.KeyPersonChairOfTrust, - KeyPersonFinancialDirector = request.KeyPersonFinancialDirector, - KeyPersonMember = request.KeyPersonMember, - KeyPersonOther = request.KeyPersonOther, - KeyPersonTrustee = request.KeyPersonTrustee, - DynamicsKeyPersonId = request.DynamicsKeyPersonId, - }; - } - - public static A2BApplicationKeyPersonsServiceModel Create(A2BApplicationKeyPersons request) - { - return new A2BApplicationKeyPersonsServiceModel - { - Name = request.Name, - KeyPersonDateOfBirth = request.KeyPersonDateOfBirth, - KeyPersonBiography = request.KeyPersonBiography, - KeyPersonCeoExecutive = request.KeyPersonCeoExecutive, - KeyPersonChairOfTrust = request.KeyPersonChairOfTrust, - KeyPersonFinancialDirector = request.KeyPersonFinancialDirector, - KeyPersonMember = request.KeyPersonMember, - KeyPersonOther = request.KeyPersonOther, - KeyPersonTrustee = request.KeyPersonTrustee, - DynamicsKeyPersonId = request.DynamicsKeyPersonId, - }; - } - } -} \ No newline at end of file diff --git a/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLeaseFactory.cs b/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLeaseFactory.cs deleted file mode 100644 index f9e5bcfc1..000000000 --- a/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLeaseFactory.cs +++ /dev/null @@ -1,25 +0,0 @@ -using TramsDataApi.DatabaseModels; -using TramsDataApi.ServiceModels.ApplyToBecome; - -namespace TramsDataApi.Factories.A2BApplicationFactories -{ - public class A2BSchoolLeaseFactory - { - public static A2BSchoolLease Create(A2BSchoolLeaseServiceModel request) - { - return request == null - ? null - : new A2BSchoolLease - { - SchoolLeaseTerm = request.SchoolLeaseTerm, - SchoolLeaseRepaymentValue = request.SchoolLeaseRepaymentValue, - SchoolLeaseInterestRate = request.SchoolLeaseInterestRate, - SchoolLeasePaymentToDate = request.SchoolLeasePaymentToDate, - SchoolLeasePurpose = request.SchoolLeasePurpose, - SchoolLeaseValueOfAssets = request.SchoolLeaseValueOfAssets, - SchoolLeaseResponsibleForAssets = request.SchoolLeaseResponsibleForAssets, - DynamicsSchoolLeaseId = request.DynamicsSchoolLeaseId, - }; - } - } -} \ No newline at end of file diff --git a/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLeaseServiceModelFactory.cs b/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLeaseServiceModelFactory.cs deleted file mode 100644 index 068d39eec..000000000 --- a/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLeaseServiceModelFactory.cs +++ /dev/null @@ -1,25 +0,0 @@ -using TramsDataApi.DatabaseModels; -using TramsDataApi.ServiceModels.ApplyToBecome; - -namespace TramsDataApi.Factories.A2BApplicationFactories -{ - public class A2BSchoolLeaseServiceModelFactory - { - public static A2BSchoolLeaseServiceModel Create(A2BSchoolLease schoolLease) - { - return schoolLease == null - ? null - : new A2BSchoolLeaseServiceModel - { - SchoolLeaseTerm = schoolLease.SchoolLeaseTerm, - SchoolLeaseRepaymentValue = schoolLease.SchoolLeaseRepaymentValue, - SchoolLeaseInterestRate = schoolLease.SchoolLeaseInterestRate, - SchoolLeasePaymentToDate = schoolLease.SchoolLeasePaymentToDate, - SchoolLeasePurpose = schoolLease.SchoolLeasePurpose, - SchoolLeaseValueOfAssets = schoolLease.SchoolLeaseValueOfAssets, - SchoolLeaseResponsibleForAssets = schoolLease.SchoolLeaseResponsibleForAssets, - DynamicsSchoolLeaseId = schoolLease.DynamicsSchoolLeaseId - }; - } - } -} \ No newline at end of file diff --git a/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLoanFactory.cs b/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLoanFactory.cs deleted file mode 100644 index 60c1b1286..000000000 --- a/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLoanFactory.cs +++ /dev/null @@ -1,23 +0,0 @@ -using TramsDataApi.DatabaseModels; -using TramsDataApi.ServiceModels.ApplyToBecome; - -namespace TramsDataApi.Factories.A2BApplicationFactories -{ - public class A2BSchoolLoanFactory - { - public static A2BSchoolLoan Create(A2BSchoolLoanServiceModel request) - { - return request == null - ? null - : new A2BSchoolLoan - { - SchoolLoanAmount = request.SchoolLoanAmount, - SchoolLoanPurpose = request.SchoolLoanPurpose, - SchoolLoanProvider = request.SchoolLoanProvider, - SchoolLoanInterestRate = request.SchoolLoanInterestRate, - SchoolLoanSchedule = request.SchoolLoanSchedule, - DynamicsSchoolLoanId = request.DynamicsSchoolLoanId, - }; - } - } -} \ No newline at end of file diff --git a/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLoanServiceModelFactory.cs b/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLoanServiceModelFactory.cs deleted file mode 100644 index 20ee4c903..000000000 --- a/TramsDataApi/Factories/A2BApplicationFactories/A2BSchoolLoanServiceModelFactory.cs +++ /dev/null @@ -1,23 +0,0 @@ -using TramsDataApi.DatabaseModels; -using TramsDataApi.ServiceModels.ApplyToBecome; - -namespace TramsDataApi.Factories.A2BApplicationFactories -{ - public class A2BSchoolLoanServiceModelFactory - { - public static A2BSchoolLoanServiceModel Create(A2BSchoolLoan schoolLoan) - { - return schoolLoan == null - ? null - : new A2BSchoolLoanServiceModel - { - SchoolLoanAmount = schoolLoan.SchoolLoanAmount, - SchoolLoanPurpose = schoolLoan.SchoolLoanPurpose, - SchoolLoanProvider = schoolLoan.SchoolLoanProvider, - SchoolLoanInterestRate = schoolLoan.SchoolLoanInterestRate, - SchoolLoanSchedule = schoolLoan.SchoolLoanSchedule, - DynamicsSchoolLoanId = schoolLoan.DynamicsSchoolLoanId, - }; - } - } -} \ No newline at end of file diff --git a/TramsDataApi/Gateways/A2BApplicationGateway.cs b/TramsDataApi/Gateways/A2BApplicationGateway.cs deleted file mode 100644 index 708abddb9..000000000 --- a/TramsDataApi/Gateways/A2BApplicationGateway.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Linq; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using TramsDataApi.DatabaseModels; - -namespace TramsDataApi.Gateways -{ - public class A2BApplicationGateway : IA2BApplicationGateway - { - private readonly TramsDbContext _tramsDbContext; - private readonly ILogger _logger; - - public A2BApplicationGateway(TramsDbContext tramsDbContext, ILogger logger) - { - _tramsDbContext = tramsDbContext; - _logger = logger; - } - - public A2BApplication GetByApplicationId(string applicationId) - { - return _tramsDbContext.A2BApplications - .AsNoTracking() - .Include(a => a.KeyPersons) - .Include(a => a.ApplyingSchools) - .ThenInclude(asc => asc.SchoolLoans) - .Include(a => a.ApplyingSchools) - .ThenInclude(asc => asc.SchoolLeases) - .FirstOrDefault(a => a.ApplicationId == applicationId); - } - - public A2BApplication CreateA2BApplication(A2BApplication application) - { - try - { - _tramsDbContext.A2BApplications.Add(application); - _tramsDbContext.SaveChanges(); - - _logger.LogInformation("Successfully created A2BApplication with Id {id}", application.ApplicationId); - } - catch (DbUpdateException e) - { - _logger.LogError("Failed to create application with Id {id}, {e}", application.ApplicationId, e); - return null; - } - catch (Exception e) - { - _logger.LogError( - "An application exception has occurred whilst creating A2BApplication with Id {id}, {e}", - application.ApplicationId, e); - - return null; - } - - return application; - } - } -} \ No newline at end of file diff --git a/TramsDataApi/Gateways/IA2BApplicationGateway.cs b/TramsDataApi/Gateways/IA2BApplicationGateway.cs deleted file mode 100644 index 155924ed9..000000000 --- a/TramsDataApi/Gateways/IA2BApplicationGateway.cs +++ /dev/null @@ -1,10 +0,0 @@ -using TramsDataApi.DatabaseModels; - -namespace TramsDataApi.Gateways -{ - public interface IA2BApplicationGateway - { - A2BApplication GetByApplicationId(string applicationId); - A2BApplication CreateA2BApplication(A2BApplication request); - } -} \ No newline at end of file diff --git a/TramsDataApi/RequestModels/ApplyToBecome/A2BApplicationCreateRequest.cs b/TramsDataApi/RequestModels/ApplyToBecome/A2BApplicationCreateRequest.cs deleted file mode 100644 index 6fdccafe1..000000000 --- a/TramsDataApi/RequestModels/ApplyToBecome/A2BApplicationCreateRequest.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using TramsDataApi.ServiceModels.ApplyToBecome; - -namespace TramsDataApi.RequestModels.ApplyToBecome -{ - public class A2BApplicationCreateRequest - { - public string Name { get; set; } - public string TrustName { get; set; } - - [Required] - public string ApplicationId { get; set; } - - public string ApplicationType { get; set; } - public string FormTrustProposedNameOfTrust { get; set; } - public bool? ApplicationSubmitted { get; set; } - public string ApplicationLeadAuthorId { get; set; } - public string ApplicationVersion { get; set; } - public string ApplicationLeadAuthorName { get; set; } - public string ApplicationLeadEmail { get; set; } - public string ApplicationRole { get; set; } - public string ApplicationRoleOtherDescription { get; set; } - public bool? ChangesToTrust { get; set; } - public string ChangesToTrustExplained { get; set; } - public bool? ChangesToLaGovernance { get; set; } - public string ChangesToLaGovernanceExplained { get; set; } - public DateTime? FormTrustOpeningDate { get; set; } - public string TrustApproverName { get; set; } - - [EmailAddress] - public string TrustApproverEmail { get; set; } - public bool? FormTrustReasonApprovalToConvertAsSat { get; set; } - public string FormTrustReasonApprovedPerson { get; set; } - public string FormTrustReasonForming { get; set; } - public string FormTrustReasonVision { get; set; } - public string FormTrustReasonGeoAreas { get; set; } - public string FormTrustReasonFreedom { get; set; } - public string FormTrustReasonImproveTeaching { get; set; } - public string FormTrustPlanForGrowth { get; set; } - public string FormTrustPlansForNoGrowth { get; set; } - public bool? FormTrustGrowthPlansYesNo { get; set; } - public string FormTrustImprovementSupport { get; set; } - public string FormTrustImprovementStrategy { get; set; } - public string FormTrustImprovementApprovedSponsor { get; set; } - public string TrustId { get; set; } - public string ApplicationStatusId { get; set; } - - public List KeyPersons { get; set; } - public List ApplyingSchools { get; set; } - public Guid DynamicsApplicationId { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/RequestModels/ApplyToBecome/A2BApplicationStatusCreateRequest.cs b/TramsDataApi/RequestModels/ApplyToBecome/A2BApplicationStatusCreateRequest.cs deleted file mode 100644 index 33d799e7e..000000000 --- a/TramsDataApi/RequestModels/ApplyToBecome/A2BApplicationStatusCreateRequest.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace TramsDataApi.RequestModels.ApplyToBecome -{ - public class A2BApplicationStatusCreateRequest - { - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/RequestModels/ApplyToBecome/A2BContributorCreateRequest.cs b/TramsDataApi/RequestModels/ApplyToBecome/A2BContributorCreateRequest.cs deleted file mode 100644 index 4fdd8ffee..000000000 --- a/TramsDataApi/RequestModels/ApplyToBecome/A2BContributorCreateRequest.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace TramsDataApi.RequestModels.ApplyToBecome -{ - public class A2BContributorCreateRequest - { - public string ContributorUserId { get; set; } - public string ApplicationTypeId { get; set; } - public string ContributorAppIdTest { get; set; } - public string ContributorUserName { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/ResponseModels/ApplyToBecome/A2BApplicationResponse.cs b/TramsDataApi/ResponseModels/ApplyToBecome/A2BApplicationResponse.cs deleted file mode 100644 index 49d8452b9..000000000 --- a/TramsDataApi/ResponseModels/ApplyToBecome/A2BApplicationResponse.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using TramsDataApi.DatabaseModels; -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ServiceModels.ApplyToBecome; - -namespace TramsDataApi.ResponseModels.ApplyToBecome -{ - public class A2BApplicationResponse - { - public string Name {get; set;} - public string TrustName { get; set; } - public string ApplicationId {get; set;} - public string ApplicationType {get; set;} - public string TrustId { get; set; } - public string FormTrustProposedNameOfTrust {get; set;} - public bool? ApplicationSubmitted {get; set;} - public string ApplicationLeadAuthorId {get; set;} - public string ApplicationLeadEmail { get; set; } - public string ApplicationVersion {get; set;} - public string ApplicationLeadAuthorName {get; set;} - public string ApplicationRole {get; set;} - public string ApplicationRoleOtherDescription {get; set;} - public bool? ChangesToTrust {get; set;} - public string ChangesToTrustExplained {get; set;} - public bool? ChangesToLaGovernance {get; set;} - public string ChangesToLaGovernanceExplained {get; set;} - public DateTime? FormTrustOpeningDate {get; set;} - public string TrustApproverName {get; set;} - public string TrustApproverEmail {get; set;} - public bool? FormTrustReasonApprovalToConvertAsSat {get; set;} - public string FormTrustReasonApprovedPerson {get; set;} - public string FormTrustReasonForming {get; set;} - public string FormTrustReasonVision {get; set;} - public string FormTrustReasonGeoAreas {get; set;} - public string FormTrustReasonFreedom {get; set;} - public string FormTrustReasonImproveTeaching {get; set;} - public string FormTrustPlanForGrowth {get; set;} - public string FormTrustPlansForNoGrowth {get; set;} - public bool? FormTrustGrowthPlansYesNo {get; set;} - public string FormTrustImprovementSupport {get; set;} - public string FormTrustImprovementStrategy {get; set;} - public string FormTrustImprovementApprovedSponsor {get; set;} - public string ApplicationStatusId {get; set;} - public ICollection KeyPersons { get; set; } - public ICollection ApplyingSchools { get; set; } - public Guid DynamicsApplicationId { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/ResponseModels/ApplyToBecome/A2BApplicationStatusResponse.cs b/TramsDataApi/ResponseModels/ApplyToBecome/A2BApplicationStatusResponse.cs deleted file mode 100644 index 31dc5b201..000000000 --- a/TramsDataApi/ResponseModels/ApplyToBecome/A2BApplicationStatusResponse.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace TramsDataApi.ResponseModels.ApplyToBecome -{ - public class A2BApplicationStatusResponse - { - public int ApplicationStatusId {get; set;} - public string Name {get; set;} - } -} \ No newline at end of file diff --git a/TramsDataApi/ResponseModels/ApplyToBecome/A2BContributorResponse.cs b/TramsDataApi/ResponseModels/ApplyToBecome/A2BContributorResponse.cs deleted file mode 100644 index e6bb73dc6..000000000 --- a/TramsDataApi/ResponseModels/ApplyToBecome/A2BContributorResponse.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace TramsDataApi.ResponseModels.ApplyToBecome -{ - public class A2BContributorResponse - { - public string ContributorUserId { get; set; } - public string ApplicationTypeId { get; set; } - public string ContributorAppIdTest { get; set; } - public string ContributorUserName { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/ServiceModels/ApplyToBecome/A2BApplicationApplyingSchoolServiceModel.cs b/TramsDataApi/ServiceModels/ApplyToBecome/A2BApplicationApplyingSchoolServiceModel.cs deleted file mode 100644 index 6b098467a..000000000 --- a/TramsDataApi/ServiceModels/ApplyToBecome/A2BApplicationApplyingSchoolServiceModel.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; - -namespace TramsDataApi.ServiceModels.ApplyToBecome -{ - public class A2BApplicationApplyingSchoolServiceModel - { - public string SchoolName { get; set; } - // contact details - public string SchoolConversionContactHeadName { get; set; } - public string SchoolConversionContactHeadEmail { get; set; } - public string SchoolConversionContactHeadTel { get; set; } - public string SchoolConversionContactChairName { get; set; } - public string SchoolConversionContactChairEmail { get; set; } - public string SchoolConversionContactChairTel { get; set; } - public string SchoolConversionContactRole { get; set; } // "headteacher", "chair of governing body", "someone else" - public string SchoolConversionMainContactOtherName { get; set; } - public string SchoolConversionMainContactOtherEmail { get; set; } - public string SchoolConversionMainContactOtherTelephone { get; set; } - public string SchoolConversionMainContactOtherRole { get; set; } - public string SchoolConversionApproverContactName { get; set; } - public string SchoolConversionApproverContactEmail { get; set; } - // conversion dates - public bool? SchoolConversionTargetDateSpecified { get; set; } - public DateTime? SchoolConversionTargetDate { get; set; } - public string SchoolConversionTargetDateExplained { get; set; } - // reasons for joining - public string SchoolConversionReasonsForJoining { get; set; } - // name changes - public bool? SchoolConversionChangeNamePlanned { get; set; } - public string SchoolConversionProposedNewSchoolName { get; set; } - // additional information - public string SchoolAdSchoolContributionToTrust { get; set; } - public bool? SchoolOngoingSafeguardingInvestigations { get; set; } - public string SchoolOngoingSafeguardingDetails { get; set; } - public bool? SchoolPartOfLaReorganizationPlan { get; set; } - public string SchoolLaReorganizationDetails { get; set; } - public bool? SchoolPartOfLaClosurePlan { get; set; } - public string SchoolLaClosurePlanDetails { get; set; } - public bool? SchoolFaithSchool { get; set; } - public string SchoolFaithSchoolDioceseName { get; set; } - public string DiocesePermissionEvidenceDocumentLink { get; set; } - public bool? SchoolIsPartOfFederation { get; set; } - public bool? SchoolIsSupportedByFoundation { get; set; } - public string SchoolSupportedFoundationBodyName { get; set; } - public string FoundationEvidenceDocumentLink { get; set; } - public bool? SchoolHasSACREException { get; set; } - public DateTime? SchoolSACREExemptionEndDate { get; set; } - public string SchoolAdFeederSchools { get; set; } - public string GoverningBodyConsentEvidenceDocumentLink { get; set; } - public bool? SchoolAdEqualitiesImpactAssessmentCompleted { get; set; } - public string SchoolAdEqualitiesImpactAssessmentDetails { get; set; } // two possible very long proforma string answers here - maybe this should be a bool - public bool? SchoolAdInspectedButReportNotPublished { get; set; } - public string SchoolAdInspectedButReportNotPublishedExplain { get; set; } - public bool? SchoolAdditionalInformationAdded { get; set; } - public string SchoolAdditionalInformation { get; set; } - // Finances - [Required] - public FinancialYearServiceModel PreviousFinancialYear { get; set; } - [Required] - public FinancialYearServiceModel CurrentFinancialYear { get; set; } - [Required] - public FinancialYearServiceModel NextFinancialYear { get; set; } - public bool? FinanceOngoingInvestigations { get; set; } - public string SchoolFinancialInvestigationsExplain { get; set; } - public bool? SchoolFinancialInvestigationsTrustAware { get; set; } - // future pupil numbers - public int? ProjectedPupilNumbersYear1 { get; set; } - public int? ProjectedPupilNumbersYear2 { get; set; } - public int? ProjectedPupilNumbersYear3 { get; set; } - public string SchoolCapacityAssumptions { get; set; } - public int? SchoolCapacityPublishedAdmissionsNumber { get; set; } - // land and buildings - public string SchoolBuildLandOwnerExplained { get; set; } - public bool? SchoolBuildLandWorksPlanned { get; set; } - public string SchoolBuildLandWorksPlannedExplained { get; set; } - public DateTime? SchoolBuildLandWorksPlannedCompletionDate { get; set; } - public bool? SchoolBuildLandSharedFacilities { get; set; } - public string SchoolBuildLandSharedFacilitiesExplained { get; set; } - public bool? SchoolBuildLandGrants { get; set; } - public string SchoolBuildLandGrantsExplained { get; set; } - public bool? SchoolBuildLandPFIScheme { get; set; } - public string SchoolBuildLandPFISchemeType { get; set; } - public bool? SchoolBuildLandPriorityBuildingProgramme { get; set; } - public bool? SchoolBuildLandFutureProgramme { get; set; } - // pre-opening support grant - public string SchoolSupportGrantFundsPaidTo { get; set; } // either "To the school" or "To the trust the school is joining" - // consultation details - public bool? SchoolHasConsultedStakeholders { get; set; } - public string SchoolPlanToConsultStakeholders { get; set; } - // declaration - // two questions from the application form would be easy to mix up here - // 1. I agree with all of these statements, and belive that the facts stated in this application are true (summary page) - // 2. The information in this application is true to the best of my kowledge (actual question) - public bool? DeclarationBodyAgree { get; set; } - public bool? DeclarationIAmTheChairOrHeadteacher { get; set; } - public string DeclarationSignedByName { get; set; } - public ICollection SchoolLoans { get; set; } - public ICollection SchoolLeases { get; set; } - public int Urn { get; set; } - - public string LocalAuthorityName { get; set; } - - public Guid DynamicsApplyingSchoolId { get; set; } - - public Guid DynamicsApplicationId { get; set; } - } -} diff --git a/TramsDataApi/ServiceModels/ApplyToBecome/A2BApplicationKeyPersonsServiceModel.cs b/TramsDataApi/ServiceModels/ApplyToBecome/A2BApplicationKeyPersonsServiceModel.cs deleted file mode 100644 index 3735ef982..000000000 --- a/TramsDataApi/ServiceModels/ApplyToBecome/A2BApplicationKeyPersonsServiceModel.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace TramsDataApi.RequestModels.ApplyToBecome -{ - public class A2BApplicationKeyPersonsServiceModel - { - public string Name {get; set;} - public DateTime? KeyPersonDateOfBirth {get; set;} - public string KeyPersonBiography {get; set;} - public bool? KeyPersonCeoExecutive {get; set;} - public bool? KeyPersonChairOfTrust {get; set;} - public bool? KeyPersonFinancialDirector {get; set;} - public bool? KeyPersonMember {get; set;} - public bool? KeyPersonOther {get; set;} - public bool? KeyPersonTrustee {get; set;} - public Guid DynamicsKeyPersonId { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/ServiceModels/ApplyToBecome/A2BFinancialYearServiceModel.cs b/TramsDataApi/ServiceModels/ApplyToBecome/A2BFinancialYearServiceModel.cs deleted file mode 100644 index 78a57e5d7..000000000 --- a/TramsDataApi/ServiceModels/ApplyToBecome/A2BFinancialYearServiceModel.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace TramsDataApi.ServiceModels.ApplyToBecome -{ - public class FinancialYearServiceModel - { - public DateTime? FYEndDate { get; set; } - public decimal? RevenueCarryForward { get; set; } - public bool? RevenueIsDeficit { get; set; } - public string RevenueStatusExplained { get; set; } - public decimal? CapitalCarryForward { get; set; } - public bool? CapitalIsDeficit { get; set; } - public string CapitalStatusExplained { get; set; } - } -} diff --git a/TramsDataApi/ServiceModels/ApplyToBecome/A2BSchoolLeaseServiceModel.cs b/TramsDataApi/ServiceModels/ApplyToBecome/A2BSchoolLeaseServiceModel.cs deleted file mode 100644 index 313ac83db..000000000 --- a/TramsDataApi/ServiceModels/ApplyToBecome/A2BSchoolLeaseServiceModel.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace TramsDataApi.ServiceModels.ApplyToBecome -{ - public class A2BSchoolLeaseServiceModel - { - public string SchoolLeaseTerm {get; set;} - public decimal SchoolLeaseRepaymentValue {get; set;} - public decimal SchoolLeaseInterestRate {get; set;} - public decimal SchoolLeasePaymentToDate {get; set;} - public string SchoolLeasePurpose {get; set;} - public string SchoolLeaseValueOfAssets {get; set;} - public string SchoolLeaseResponsibleForAssets {get; set;} - public Guid DynamicsSchoolLeaseId { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/ServiceModels/ApplyToBecome/A2BSchoolLoanServiceModel.cs b/TramsDataApi/ServiceModels/ApplyToBecome/A2BSchoolLoanServiceModel.cs deleted file mode 100644 index c4f1cb3d7..000000000 --- a/TramsDataApi/ServiceModels/ApplyToBecome/A2BSchoolLoanServiceModel.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace TramsDataApi.ServiceModels.ApplyToBecome -{ - public class A2BSchoolLoanServiceModel - { - public decimal? SchoolLoanAmount {get; set;} - public string SchoolLoanPurpose {get; set;} - public string SchoolLoanProvider {get; set;} - public string SchoolLoanInterestRate {get; set;} - public string SchoolLoanSchedule {get; set;} - public Guid DynamicsSchoolLoanId { get; set; } - } -} \ No newline at end of file diff --git a/TramsDataApi/Startup.cs b/TramsDataApi/Startup.cs index 5c4ed6db1..3526553ff 100644 --- a/TramsDataApi/Startup.cs +++ b/TramsDataApi/Startup.cs @@ -63,10 +63,7 @@ public void ConfigureServices(IServiceCollection services) services.AddScoped(); services.AddScoped(); - - services.AddScoped(); - services.AddScoped(); - services.AddScoped(); + services.AddScoped(); services.AddScoped(); diff --git a/TramsDataApi/TramsDataApi.csproj b/TramsDataApi/TramsDataApi.csproj index e3abc3726..958fe8335 100644 --- a/TramsDataApi/TramsDataApi.csproj +++ b/TramsDataApi/TramsDataApi.csproj @@ -25,6 +25,7 @@ + diff --git a/TramsDataApi/UseCases/CreateA2BApplication.cs b/TramsDataApi/UseCases/CreateA2BApplication.cs deleted file mode 100644 index 59742a29c..000000000 --- a/TramsDataApi/UseCases/CreateA2BApplication.cs +++ /dev/null @@ -1,26 +0,0 @@ -using TramsDataApi.Factories; -using TramsDataApi.Factories.A2BApplicationFactories; -using TramsDataApi.Gateways; -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ResponseModels.ApplyToBecome; - -namespace TramsDataApi.UseCases -{ - public class CreateA2BApplication : ICreateA2BApplication - { - private readonly IA2BApplicationGateway _gateway; - - public CreateA2BApplication(IA2BApplicationGateway gateway) - { - _gateway = gateway; - } - - public A2BApplicationResponse Execute(A2BApplicationCreateRequest request) - { - var applicationToCreate = A2BApplicationFactory.Create(request); - var createdApplication = _gateway.CreateA2BApplication(applicationToCreate); - return A2BApplicationFactory.Create(createdApplication); - } - - } -} \ No newline at end of file diff --git a/TramsDataApi/UseCases/GetA2BApplication.cs b/TramsDataApi/UseCases/GetA2BApplication.cs deleted file mode 100644 index 13a377d37..000000000 --- a/TramsDataApi/UseCases/GetA2BApplication.cs +++ /dev/null @@ -1,26 +0,0 @@ -using TramsDataApi.Factories; -using TramsDataApi.Factories.A2BApplicationFactories; -using TramsDataApi.Gateways; -using TramsDataApi.ResponseModels.ApplyToBecome; - -namespace TramsDataApi.UseCases -{ - public class GetA2BApplication : IGetA2BApplication - { - private readonly IA2BApplicationGateway _applicationGateway; - - public GetA2BApplication(IA2BApplicationGateway applicationGateway) - { - _applicationGateway = applicationGateway; - } - - public A2BApplicationResponse Execute(string applicationId) - { - var application = _applicationGateway.GetByApplicationId(applicationId); - - return application != null - ? A2BApplicationFactory.Create(application) - : null; - } - } -} diff --git a/TramsDataApi/UseCases/ICreateA2BApplication.cs b/TramsDataApi/UseCases/ICreateA2BApplication.cs deleted file mode 100644 index e34f1151f..000000000 --- a/TramsDataApi/UseCases/ICreateA2BApplication.cs +++ /dev/null @@ -1,10 +0,0 @@ -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ResponseModels.ApplyToBecome; - -namespace TramsDataApi.UseCases -{ - public interface ICreateA2BApplication - { - A2BApplicationResponse Execute(A2BApplicationCreateRequest request); - } -} \ No newline at end of file diff --git a/TramsDataApi/UseCases/ICreateA2BApplicationStatus.cs b/TramsDataApi/UseCases/ICreateA2BApplicationStatus.cs deleted file mode 100644 index e84a94e2b..000000000 --- a/TramsDataApi/UseCases/ICreateA2BApplicationStatus.cs +++ /dev/null @@ -1,10 +0,0 @@ -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ResponseModels.ApplyToBecome; - -namespace TramsDataApi.UseCases -{ - public interface ICreateA2BApplicationStatus - { - A2BApplicationStatusResponse Execute(A2BApplicationStatusCreateRequest request); - } -} \ No newline at end of file diff --git a/TramsDataApi/UseCases/ICreateA2BContributor.cs b/TramsDataApi/UseCases/ICreateA2BContributor.cs deleted file mode 100644 index 9b8a03a9f..000000000 --- a/TramsDataApi/UseCases/ICreateA2BContributor.cs +++ /dev/null @@ -1,10 +0,0 @@ -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ResponseModels.ApplyToBecome; - -namespace TramsDataApi.UseCases -{ - public interface ICreateA2BContributor - { - A2BContributorResponse Execute(A2BContributorCreateRequest request); - } -} \ No newline at end of file diff --git a/TramsDataApi/UseCases/IGetA2BApplication.cs b/TramsDataApi/UseCases/IGetA2BApplication.cs deleted file mode 100644 index 5bf6886c8..000000000 --- a/TramsDataApi/UseCases/IGetA2BApplication.cs +++ /dev/null @@ -1,10 +0,0 @@ -using TramsDataApi.RequestModels.ApplyToBecome; -using TramsDataApi.ResponseModels.ApplyToBecome; - -namespace TramsDataApi.UseCases -{ - public interface IGetA2BApplication - { - A2BApplicationResponse Execute(string applicationId); - } -} \ No newline at end of file diff --git a/TramsDataApi/UseCases/IGetA2BApplicationStatus.cs b/TramsDataApi/UseCases/IGetA2BApplicationStatus.cs deleted file mode 100644 index 5640c625d..000000000 --- a/TramsDataApi/UseCases/IGetA2BApplicationStatus.cs +++ /dev/null @@ -1,9 +0,0 @@ -using TramsDataApi.ResponseModels.ApplyToBecome; - -namespace TramsDataApi.UseCases -{ - public interface IGetA2BApplicationStatus - { - A2BApplicationStatusResponse Execute(int applicationStatusId); - } -} \ No newline at end of file diff --git a/TramsDataApi/UseCases/IGetA2BContributor.cs b/TramsDataApi/UseCases/IGetA2BContributor.cs deleted file mode 100644 index 493a8dbd1..000000000 --- a/TramsDataApi/UseCases/IGetA2BContributor.cs +++ /dev/null @@ -1,9 +0,0 @@ -using TramsDataApi.ResponseModels.ApplyToBecome; - -namespace TramsDataApi.UseCases -{ - public interface IGetA2BContributor - { - A2BContributorResponse Execute(string contributorId); - } -} \ No newline at end of file From ca789cefd9ffc970adabd222410d01d39eaae331 Mon Sep 17 00:00:00 2001 From: Dominic NEED Date: Thu, 5 Oct 2023 11:44:02 +0100 Subject: [PATCH 2/2] removed a2b cypress test --- .../89785_schemaJson.js | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 CypressTests/cypress/integration/conversions/89770_api_apply-to-become/89785_schemaJson.js diff --git a/CypressTests/cypress/integration/conversions/89770_api_apply-to-become/89785_schemaJson.js b/CypressTests/cypress/integration/conversions/89770_api_apply-to-become/89785_schemaJson.js deleted file mode 100644 index b0c65d6df..000000000 --- a/CypressTests/cypress/integration/conversions/89770_api_apply-to-become/89785_schemaJson.js +++ /dev/null @@ -1,22 +0,0 @@ -/// -import { applyToBecomeAcademySchema } from "../../../schemas/schema" - -let apiKey = Cypress.env('apiKey') -let url = Cypress.env('url') - - -describe('Test Against Json Schema API V2 School application', () => { - - it('GET Application Data by ID', () => { - cy.request({ - url: url + 'v2/apply-to-become/application/A2B_1373', - headers: { - ApiKey: apiKey, - } - }).then((response) => { - expect(response.status).to.eq(200) - cy.log(response.body) - cy.validateSchema(applyToBecomeAcademySchema, response.body) - }) - }) -}) \ No newline at end of file