Skip to content

Commit

Permalink
Merge branch 'main' into feature/156275-withdrawn-decision-option
Browse files Browse the repository at this point in the history
  • Loading branch information
elielijah321 authored Feb 20, 2024
2 parents 85c816f + d7bdd8b commit e52b7a5
Show file tree
Hide file tree
Showing 70 changed files with 1,169 additions and 384 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/continuous-integration-terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ jobs:
run: rm ./terraform/backend.tf

- name: Run a Terraform init
uses: docker://hashicorp/terraform:1.6.4
uses: docker://hashicorp/terraform:1.7.1
with:
entrypoint: terraform
args: -chdir=terraform init

- name: Run a Terraform validate
uses: docker://hashicorp/terraform:1.6.4
uses: docker://hashicorp/terraform:1.7.1
with:
entrypoint: terraform
args: -chdir=terraform validate

- name: Run a Terraform format check
uses: docker://hashicorp/terraform:1.6.4
uses: docker://hashicorp/terraform:1.7.1
with:
entrypoint: terraform
args: -chdir=terraform fmt -check=true -diff=true
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* @dneed-nimble @paullocknimble @danielryannimble @dangood84 @nwarms @elielijah321 @FahadDarw
/terraform/ @DrizzlyOwl @stretch96
Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests @cshnimble
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,40 @@ describe('Filteration Tests', { tags: ['@dev', '@stage'] }, () => {
nextMonthDate.setMonth(currentDate.getMonth() + 1);

const testData = {
projectName: 'Sponsored Cypress Project',
projectName: 'Deanshanger Primary School',
completedText: 'Completed',
projectAssignment: {
deliveryOfficer: 'Richika Dogra',
assignedOfficerMessage: 'Project is assigned',
deliveryOfficer: 'Chris Sherlock',
assignedOfficerMessage: 'Project is assigned',
},
schoolOverview: {
pan: '98765',
pfiDescription: 'PFI Description',
distance: '15',
distanceDecription: 'Distance description',
mp: 'Important Politician, Independent',
pan: '999',
pfiDescription: 'PFI Description',
distance: '15',
distanceDecription: 'Distance description',
mp: 'Important Politician, Independent',
},
budget: {
endOfFinanicalYear: currentDate,
forecastedRevenueCurrentYear: 20,
forecastedCapitalCurrentYear: 10,
endOfNextFinancialYear: nextYearDate,
forecastedRevenueNextYear: 15,
forecastedCapitalNextYear: 12
endOfFinanicalYear: currentDate,
forecastedRevenueCurrentYear: 20,
forecastedCapitalCurrentYear: 10,
endOfNextFinancialYear: nextYearDate,
forecastedRevenueNextYear: 15,
forecastedCapitalNextYear: 12
},
pupilForecast: {
additionalInfomation: 'Pupil Forecast Additional Information'
additionalInfomation: 'Pupil Forecast Additional Information'
},
rationale: 'This is why this school should become an academy',
risksAndIssues: 'Here are the risks and issues for this conversion',
localAuthority: {
comment: 'Comment',
sharepointLink: 'https://sharepoint.com'
comment: 'Comment',
sharepointLink: 'https://sharepoint.com'
},
performanceInfo: 'Additional Information',
keyStages: [4, 5]
}
keyStages: [2]
}


before(() => {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ describe('Sponsored conversion journey', { tags: ['@dev', '@stage'] }, () => {
nextMonthDate.setMonth(currentDate.getMonth() + 1);

const testData = {
projectName: 'Sponsored Cypress Project',
projectName: 'Deanshanger Primary School',
completedText: 'Completed',
projectAssignment: {
deliveryOfficer: 'Richika Dogra',
deliveryOfficer: 'Chris Sherlock',
assignedOfficerMessage: 'Project is assigned',
},
schoolOverview: {
pan: '98765',
pan: '999',
pfiDescription: 'PFI Description',
distance: '15',
distanceDecription: 'Distance description',
Expand All @@ -55,7 +55,7 @@ describe('Sponsored conversion journey', { tags: ['@dev', '@stage'] }, () => {
sharepointLink: 'https://sharepoint.com'
},
performanceInfo: 'Additional Information',
keyStages: [4, 5]
keyStages: [2]
}

before(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class ConversionDetails extends BasePage {
advisoryBoardDateInput: 'head-teacher-board-date',
proposedOpeningLink: '[data-test="change-proposed-academy-opening-date"]',
proposedOpeningValue: '[id="proposed-academy-opening-date"]',
proposedOpeningRadioButton: (month, year) => `input[data-cy="select-radio-01/${month}/${year} 00:00:00"]`,
proposedOpeningRadioButton: (month, year) => `input[data-cy="select-radio-${month}/01/${year} 00:00:00"]`,
previousAdvisoryBoardLink: '[data-test="change-previous-advisory-board"]',
previousAdvisoryBoardValue: '[id="previous-advisory-board"]',
previousAdvisoryBoardDateInput: 'previous-head-teacher-board-date',
Expand Down
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 @@ -104,4 +132,10 @@ public async Task<HttpResponseMessage> SetPerformanceData(int id, SetPerformance
{
return await AcademisationClient.PutAsync(string.Format(PathFor.SetPerformanceData, id), JsonContent.Create(setPerformanceDataModel));
}

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +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> GetFormAMatProjectsAsync(AcademyConversionSearchModelV2 searchModel);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +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 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
@@ -0,0 +1,14 @@
using System.Collections.Generic;

namespace Dfe.PrepareConversions.Data.Models;

public class FormAMatProject
{
public int Id { get; set; }

public string ProposedTrustName { get; set; }
public string ApplicationReference { get; set; }
public User AssignedUser { get; set; }
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 @@ -268,4 +288,23 @@ public async Task<ApiResponse<ApiV2Wrapper<IEnumerable<AcademyConversionProject>

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

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.GetFormAMatProjectsAsync(searchModel);
if (!response.IsSuccessStatusCode)
{
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>>>();

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,10 +39,24 @@ Task<ApiResponse<ApiV2Wrapper<IEnumerable<AcademyConversionProject>>>> GetAllPro
IEnumerable<string> advisoryBoardDatesFilter = default
);

Task<ApiResponse<ApiV2Wrapper<IEnumerable<FormAMatProject>>>> GetFormAMatProjects(
int page,
int count,
string titleFilter = "",
IEnumerable<string> statusFilters = default,
IEnumerable<string> deliveryOfficerFilter = default,
IEnumerable<string> regionsFilter = default,
IEnumerable<string> localAuthoritiesFilter = default,
IEnumerable<string> advisoryBoardDatesFilter = default
);

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
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public IntegrationTestingWebApplicationFactory()

public ITestOutputHelper DebugOutput { get; set; }

public IUserRepository UserRepository { get; private set; }

public IEnumerable<LogEntry> GetMockServerLogs(string path, HttpMethod verb = null)
{
IRequestBuilder requestBuilder = Request.Create().WithPath(path);
Expand Down Expand Up @@ -83,11 +85,13 @@ protected override void ConfigureWebHost(IWebHostBuilder builder)
featureManager.Setup(m => m.IsEnabledAsync("UseAcademisationApplication")).ReturnsAsync(true);
featureManager.Setup(m => m.IsEnabledAsync("ShowDirectedAcademyOrders")).ReturnsAsync(true);

UserRepository = new TestUserRepository();

builder.ConfigureServices(services =>
{
services.AddAuthentication("Test");
services.AddTransient<IAuthenticationSchemeProvider, MockSchemeProvider>();
services.AddTransient<IUserRepository, TestUserRepository>();
services.AddScoped(x => UserRepository);
services.AddTransient(_ => featureManager.Object);
});
}
Expand Down
Loading

0 comments on commit e52b7a5

Please sign in to comment.