Skip to content

Commit

Permalink
Merge pull request #991 from DFE-Digital/feature/form-a-mat-editable
Browse files Browse the repository at this point in the history
form a mat editable and grouping of form a mat project
  • Loading branch information
paullocknimble authored Feb 16, 2024
2 parents 0102d13 + 7a20611 commit d7bdd8b
Show file tree
Hide file tree
Showing 51 changed files with 907 additions and 379 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ public async Task<HttpResponseMessage> GetProjectByIdAsync(int id)
HttpResponseMessage getProjectResponse = await AcademisationClient.GetAsync(string.Format(PathFor.GetProjectById, id));
return getProjectResponse;
}

public async Task<HttpResponseMessage> GetFormAMatProjectById(int id)
{
HttpResponseMessage getProjectResponse = await AcademisationClient.GetAsync(string.Format(PathFor.GetFormAMatProjectById, id));
return getProjectResponse;
}
public async Task<HttpResponseMessage> UpdateProjectAsync(int id, UpdateAcademyConversionProject updateProject)
{
return await AcademisationClient.PatchAsync(string.Format(PathFor.UpdateProject, id), JsonContent.Create(updateProject));
Expand Down Expand Up @@ -93,8 +97,32 @@ public async Task<HttpResponseMessage> SetSchoolOverview(int id, SetSchoolOvervi
var formattedString = string.Format(PathFor.SetSchoolOverview, id);
return await AcademisationClient.PutAsync(formattedString, JsonContent.Create(payload));
}
public async Task<HttpResponseMessage> SetAssignedUser(int id, SetAssignedUserModel updatedAssignedUser)
{
var payload = new
{
id = updatedAssignedUser.Id,
userId = updatedAssignedUser.UserId,
fullName = updatedAssignedUser.FullName,
emailAddress = updatedAssignedUser.EmailAddress
};

var formattedString = string.Format(PathFor.SetAssignedUser, id);
return await AcademisationClient.PutAsync(formattedString, JsonContent.Create(payload));
}
public async Task<HttpResponseMessage> SetFormAMatAssignedUser(int id, SetAssignedUserModel updatedAssignedUser)
{
var payload = new
{
id = updatedAssignedUser.Id,
userId = updatedAssignedUser.UserId,
fullName = updatedAssignedUser.FullName,
emailAddress = updatedAssignedUser.EmailAddress
};

var formattedString = string.Format(PathFor.SetFormAMatAssignedUser, id);
return await AcademisationClient.PutAsync(formattedString, JsonContent.Create(payload));
}
public async Task<HttpResponseMessage> GetAllProjectsV2Async(AcademyConversionSearchModelV2 searchModel)
{
return await AcademisationClient.PostAsync(PathFor.GetAllProjectsV2, JsonContent.Create(searchModel));
Expand All @@ -105,9 +133,9 @@ public async Task<HttpResponseMessage> SetPerformanceData(int id, SetPerformance
return await AcademisationClient.PutAsync(string.Format(PathFor.SetPerformanceData, id), JsonContent.Create(setPerformanceDataModel));
}

public async Task<HttpResponseMessage> GetMATProjectsAsync(AcademyConversionSearchModelV2 searchModel)
public async Task<HttpResponseMessage> GetFormAMatProjectsAsync(AcademyConversionSearchModelV2 searchModel)
{
return await AcademisationClient.PostAsync(PathFor.GetMATProjects, JsonContent.Create(searchModel));
return await AcademisationClient.PostAsync(PathFor.GetFormAMatProjects, JsonContent.Create(searchModel));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ public interface IApiClient
Task<HttpResponseMessage> DownloadProjectExport(AcademyConversionSearchModelV2 searchModel);
Task<HttpResponseMessage> GetAllProjectsV2Async(AcademyConversionSearchModelV2 searchModel);
Task<HttpResponseMessage> GetProjectByIdAsync(int id);
Task<HttpResponseMessage> GetFormAMatProjectById(int id);
Task<HttpResponseMessage> UpdateProjectAsync(int id, UpdateAcademyConversionProject updateProject);
Task<HttpResponseMessage> GetFilterParametersAsync();
Task<HttpResponseMessage> GetApplicationByReferenceAsync(string id);
Task<HttpResponseMessage> AddProjectNote(int id, AddProjectNote projectNote);

Task<HttpResponseMessage> SetProjectExternalApplicationForm(int id, bool externalApplicationFormSaved, string externalApplicationFormUrl);
Task<HttpResponseMessage> SetSchoolOverview(int id, SetSchoolOverviewModel updatedSchoolOverview);
Task<HttpResponseMessage> SetAssignedUser(int id, SetAssignedUserModel updatedAssignedUser);
Task<HttpResponseMessage> SetFormAMatAssignedUser(int id, SetAssignedUserModel updatedAssignedUser);
Task<HttpResponseMessage> SetPerformanceData(int id, SetPerformanceDataModel setPerformanceDataModel);
Task<HttpResponseMessage> GetMATProjectsAsync(AcademyConversionSearchModelV2 searchModel);
Task<HttpResponseMessage> GetFormAMatProjectsAsync(AcademyConversionSearchModelV2 searchModel);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ public PathFor(IFeatureManager features)
public static string GetAllProjects => "/legacy/projects";
public static string DownloadProjectExport => "/export/export-projects";
public static string GetProjectById => "/legacy/project/{0}";
public static string GetFormAMatProjectById => "/conversion-project/formamatproject/{0}";
public static string UpdateProject => "/legacy/project/{0}";
public static string GetFilterParameters => "/legacy/projects/status";
public static string AddProjectNote => "/legacy/project/{0}/notes";
public static string SetExternalApplicationForm => "/conversion-project/{0}/setExternalApplicationForm";
public static string SetPerformanceData => "/conversion-project/{0}/SetPerformanceData";
public static string SetSchoolOverview => "/conversion-project/{0}/SetSchoolOverview";
public static string SetAssignedUser => "/conversion-project/{0}/SetAssignedUser";
public static string SetFormAMatAssignedUser => "/conversion-project/{0}/SetFormAMatAssignedUser";

public static string GetAllProjectsV2 => "/conversion-project/projects";
public static string GetMATProjects => "/conversion-project/MATprojects";
public static string GetFormAMatProjects => "/conversion-project/FormAMatProjects";
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class AcademyConversionProject
{
public int Id { get; set; }
public int? Urn { get; set; }
public int? FormAMatProjectId { get; set; }
public DateTime CreatedOn { get; set; }
public string SchoolName { get; set; }
public string SchoolPhase { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,137 +1,14 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;

namespace Dfe.PrepareConversions.Data.Models;

public class FormAMATProject
public class FormAMatProject
{
public int Id { get; set; }
public int? Urn { get; set; }
public DateTime CreatedOn { get; set; }
public string SchoolName { get; set; }
public string SchoolPhase { get; set; }
public string SchoolType { get; set; }
public string LocalAuthority { get; set; }
public string ApplicationReferenceNumber { get; set; }
public string ProjectStatus { get; set; }
public DateTime? ApplicationReceivedDate { get; set; }
public DateTime? AssignedDate { get; set; }
public DateTime? HeadTeacherBoardDate { get; set; }
public DateTime? BaselineDate { get; set; }

//la summary page
public DateTime? LocalAuthorityInformationTemplateSentDate { get; set; }
public DateTime? LocalAuthorityInformationTemplateReturnedDate { get; set; }
public string LocalAuthorityInformationTemplateComments { get; set; }
public string LocalAuthorityInformationTemplateLink { get; set; }
public bool? LocalAuthorityInformationTemplateSectionComplete { get; set; }

//school/trust info
public string RecommendationForProject { get; set; }
public string Author { get; set; }
public string Version { get; set; }
public string ClearedBy { get; set; }
public string AcademyOrderRequired { get; set; }
public string PreviousHeadTeacherBoardDateQuestion { get; set; }
public DateTime? PreviousHeadTeacherBoardDate { get; set; }
public string PreviousHeadTeacherBoardLink { get; set; }
public string TrustReferenceNumber { get; set; }
public string NameOfTrust { get; set; }
public string SponsorReferenceNumber { get; set; }
public string SponsorName { get; set; }
public string AcademyTypeAndRoute { get; set; }
public string Form7Received { get; set; }
public DateTime? Form7ReceivedDate { get; set; }
public DateTime? ProposedAcademyOpeningDate { get; set; }
public bool? SchoolAndTrustInformationSectionComplete { get; set; }
public decimal? ConversionSupportGrantAmount { get; set; }
public string ConversionSupportGrantChangeReason { get; set; }
public string ConversionSupportGrantType { get; set; }
public string ConversionSupportGrantEnvironmentalImprovementGrant { get; set; }
public bool? ConversionSupportGrantAmountChanged { get; set; }
public string ConversionSupportGrantNumberOfSites { get; set; }
public DateTime? DaoPackSentDate { get; set; }
public string Region { get; set; }

// Annex B
public bool? AnnexBFormReceived { get; set; }
public string AnnexBFormUrl { get; set; }

// External Application Form
public bool? ExternalApplicationFormSaved { get; set; }
public string? ExternalApplicationFormUrl { get; set; }

// School Overview
public string PublishedAdmissionNumber { get; set; }
public string PartOfPfiScheme { get; set; }
public string PfiSchemeDetails { get; set; }
public string ViabilityIssues { get; set; }
public decimal? NumberOfPlacesFundedFor { get; set; }
public decimal? NumberOfResidentialPlaces { get; set; }
public decimal? NumberOfFundedResidentialPlaces { get; set; }
public string FinancialDeficit { get; set; }
public decimal? DistanceFromSchoolToTrustHeadquarters { get; set; }
public string DistanceFromSchoolToTrustHeadquartersAdditionalInformation { get; set; }
public string MemberOfParliamentNameAndParty { get; set; }
public bool? SchoolOverviewSectionComplete { get; set; }
public bool? PupilsAttendingGroupPermanentlyExcluded { get; set; }
public bool? PupilsAttendingGroupMedicalAndHealthNeeds { get; set; }
public bool? PupilsAttendingGroupTeenageMums { get; set; }
public int? NumberOfAlternativeProvisionPlaces { get; set; }
public int? NumberOfMedicalPlaces { get; set; }
public int? NumberOfPost16Places { get; set; }
public int? NumberOfSENUnitPlaces { get; set; }

//school performance ofsted information
public string SchoolPerformanceAdditionalInformation { get; set; }

// rationale
public string RationaleForProject { get; set; }
public string RationaleForTrust { get; set; }
public bool? RationaleSectionComplete { get; set; }

// risk and issues
public string RisksAndIssues { get; set; }
public bool? RisksAndIssuesSectionComplete { get; set; }

// legal requirements
public string GoverningBodyResolution { get; set; }
public string Consultation { get; set; }
public string DiocesanConsent { get; set; }
public string FoundationConsent { get; set; }
public bool? LegalRequirementsSectionComplete { get; set; }

// school budget info
public DateTime? EndOfCurrentFinancialYear { get; set; }
public decimal? RevenueCarryForwardAtEndMarchCurrentYear { get; set; }
public decimal? CapitalCarryForwardAtEndMarchCurrentYear { get; set; }
public DateTime? EndOfNextFinancialYear { get; set; }
public decimal? ProjectedRevenueBalanceAtEndMarchNextYear { get; set; }
public decimal? CapitalCarryForwardAtEndMarchNextYear { get; set; }
public string SchoolBudgetInformationAdditionalInformation { get; set; }
public bool? SchoolBudgetInformationSectionComplete { get; set; }

// pupil schools forecast
public int? YearOneProjectedCapacity { get; set; }
public int? YearOneProjectedPupilNumbers { get; set; }
public int? YearTwoProjectedCapacity { get; set; }
public int? YearTwoProjectedPupilNumbers { get; set; }
public int? YearThreeProjectedCapacity { get; set; }
public int? YearThreeProjectedPupilNumbers { get; set; }
public int? YearFourProjectedCapacity { get; set; }
public int? YearFourProjectedPupilNumbers { get; set; }
public string SchoolPupilForecastsAdditionalInformation { get; set; }

// key stage performance tables
public string KeyStage2PerformanceAdditionalInformation { get; set; }
public string KeyStage4PerformanceAdditionalInformation { get; set; }
public string KeyStage5PerformanceAdditionalInformation { get; set; }
public string EducationalAttendanceAdditionalInformation { get; set; }

// assigned user
public string ProposedTrustName { get; set; }
public string ApplicationReference { get; set; }
public User AssignedUser { get; set; }

// notes
public ICollection<ProjectNote> Notes { get; set; } = new List<ProjectNote>();
public ICollection<AcademyConversionProject> Projects { get; set; } = new List<AcademyConversionProject>();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;

namespace Dfe.PrepareConversions.Data.Models
{
public class SetAssignedUserModel
{
public SetAssignedUserModel() { }
public SetAssignedUserModel(
int id,
Guid userId,
string fullName,
string emailAddress)
{
Id = id;
UserId = userId;
FullName = fullName;
EmailAddress = emailAddress;
}

public int Id { get; set; }
public Guid UserId { get; set; }
public string FullName { get; set; }

public string EmailAddress { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,17 @@ public async Task<ApiResponse<AcademyConversionProject>> GetProjectById(int id)
AcademyConversionProject project = await ReadFromJsonAndThrowIfNull<AcademyConversionProject>(response.Content);
return new ApiResponse<AcademyConversionProject>(response.StatusCode, project);
}
public async Task<ApiResponse<FormAMatProject>> GetFormAMatProjectById(int id)
{
HttpResponseMessage response = await _apiClient.GetFormAMatProjectById(id);
if (!response.IsSuccessStatusCode)
{
return new ApiResponse<FormAMatProject>(response.StatusCode, null);
}

FormAMatProject project = await ReadFromJsonAndThrowIfNull<FormAMatProject>(response.Content);
return new ApiResponse<FormAMatProject>(response.StatusCode, project);
}
public async Task<ApiResponse<AcademyConversionProject>> UpdateProject(int id, UpdateAcademyConversionProject updateProject)
{
ApiResponse<AcademyConversionProject> projectResponse = await GetProjectById(id);
Expand Down Expand Up @@ -250,6 +260,16 @@ public async Task SetSchoolOverview(int id, SetSchoolOverviewModel updatedSchool
HttpResponseMessage result = await _apiClient.SetSchoolOverview(id, updatedSchoolOverview);
if (result.IsSuccessStatusCode is false) throw new ApiResponseException($"Request to Api failed | StatusCode - {result.StatusCode}");
}
public async Task SetAssignedUser(int id, SetAssignedUserModel updatedAssignedUser)
{
HttpResponseMessage result = await _apiClient.SetAssignedUser(id, updatedAssignedUser);
if (result.IsSuccessStatusCode is false) throw new ApiResponseException($"Request to Api failed | StatusCode - {result.StatusCode}");
}
public async Task SetFormAMatAssignedUser(int id, SetAssignedUserModel updatedAssignedUser)
{
HttpResponseMessage result = await _apiClient.SetFormAMatAssignedUser(id, updatedAssignedUser);
if (result.IsSuccessStatusCode is false) throw new ApiResponseException($"Request to Api failed | StatusCode - {result.StatusCode}");
}

public async Task<ApiResponse<ApiV2Wrapper<IEnumerable<AcademyConversionProject>>>> GetAllProjectsV2(int page, int count, string titleFilter = "", IEnumerable<string> statusFilters = null, IEnumerable<string> deliveryOfficerFilter = null, IEnumerable<string> regionsFilter = null, IEnumerable<string> localAuthoritiesFilter = null, IEnumerable<string> advisoryBoardDatesFilter = null)
{
Expand All @@ -269,22 +289,22 @@ public async Task<ApiResponse<ApiV2Wrapper<IEnumerable<AcademyConversionProject>
return new ApiResponse<ApiV2Wrapper<IEnumerable<AcademyConversionProject>>>(response.StatusCode, outerResponse);
}

public async Task<ApiResponse<ApiV2Wrapper<IEnumerable<FormAMATProject>>>> GetMATProjects(int page, int count, string titleFilter = "", IEnumerable<string> statusFilters = null, IEnumerable<string> deliveryOfficerFilter = null, IEnumerable<string> regionsFilter = null, IEnumerable<string> localAuthoritiesFilter = null, IEnumerable<string> advisoryBoardDatesFilter = null)
public async Task<ApiResponse<ApiV2Wrapper<IEnumerable<FormAMatProject>>>> GetFormAMatProjects(int page, int count, string titleFilter = "", IEnumerable<string> statusFilters = null, IEnumerable<string> deliveryOfficerFilter = null, IEnumerable<string> regionsFilter = null, IEnumerable<string> localAuthoritiesFilter = null, IEnumerable<string> advisoryBoardDatesFilter = null)
{
AcademyConversionSearchModelV2 searchModel = new() { TitleFilter = titleFilter, Page = page, Count = count };

ProcessFiltersV2(statusFilters, deliveryOfficerFilter, searchModel, regionsFilter, localAuthoritiesFilter, advisoryBoardDatesFilter);

HttpResponseMessage response = await _apiClient.GetMATProjectsAsync(searchModel);
HttpResponseMessage response = await _apiClient.GetFormAMatProjectsAsync(searchModel);
if (!response.IsSuccessStatusCode)
{
return new ApiResponse<ApiV2Wrapper<IEnumerable<FormAMATProject>>>(response.StatusCode,
new ApiV2Wrapper<IEnumerable<FormAMATProject>> { Data = Enumerable.Empty<FormAMATProject>() });
return new ApiResponse<ApiV2Wrapper<IEnumerable<FormAMatProject>>>(response.StatusCode,
new ApiV2Wrapper<IEnumerable<FormAMatProject>> { Data = Enumerable.Empty<FormAMatProject>() });
}

ApiV2Wrapper<IEnumerable<FormAMATProject>> outerResponse = await response.Content.ReadFromJsonAsync<ApiV2Wrapper<IEnumerable<FormAMATProject>>>();
ApiV2Wrapper<IEnumerable<FormAMatProject>> outerResponse = await response.Content.ReadFromJsonAsync<ApiV2Wrapper<IEnumerable<FormAMatProject>>>();

return new ApiResponse<ApiV2Wrapper<IEnumerable<FormAMATProject>>>(response.StatusCode, outerResponse);
return new ApiResponse<ApiV2Wrapper<IEnumerable<FormAMatProject>>>(response.StatusCode, outerResponse);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ public class ApiV2PagingInfo
{
public int Page { get; set; }
public int RecordCount { get; set; }
public string NextPageUrl { get; set; }
public string? NextPageUrl { get; set; }

Check warning on line 7 in Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Services/ApiV2PagingInfo.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Task<ApiResponse<ApiV2Wrapper<IEnumerable<AcademyConversionProject>>>> GetAllPro
IEnumerable<string> advisoryBoardDatesFilter = default
);

Task<ApiResponse<ApiV2Wrapper<IEnumerable<FormAMATProject>>>> GetMATProjects(
Task<ApiResponse<ApiV2Wrapper<IEnumerable<FormAMatProject>>>> GetFormAMatProjects(
int page,
int count,
string titleFilter = "",
Expand All @@ -51,9 +51,12 @@ Task<ApiResponse<ApiV2Wrapper<IEnumerable<FormAMATProject>>>> GetMATProjects(
);

Task<ApiResponse<AcademyConversionProject>> GetProjectById(int id);
Task<ApiResponse<FormAMatProject>> GetFormAMatProjectById(int id);
Task<ApiResponse<AcademyConversionProject>> UpdateProject(int id, UpdateAcademyConversionProject updateProject);
Task CreateProject(CreateNewProject newProject);
Task SetProjectExternalApplicationForm(int id, bool externalApplicationFormSaved, string externalApplicationFormUrl);
Task SetAssignedUser(int id, SetAssignedUserModel updatedAssignedUser);
Task SetFormAMatAssignedUser(int id, SetAssignedUserModel updatedAssignedUser);
Task SetSchoolOverview(int id, SetSchoolOverviewModel updatedSchoolOverview);
Task SetPerformanceData(int id, SetPerformanceDataModel setPerformanceDataModel);
Task<ApiResponse<ProjectFilterParameters>> GetFilterParameters();
Expand Down
Loading

0 comments on commit d7bdd8b

Please sign in to comment.