Skip to content

Commit

Permalink
Changed the path that files are expected to be for schools
Browse files Browse the repository at this point in the history
  • Loading branch information
paullocknimble committed Mar 3, 2023
1 parent d38853d commit 06e838c
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 33 deletions.
3 changes: 2 additions & 1 deletion Dfe.Academies.External.Web/Helpers/FileUploadConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

public static class FileUploadConstants
{
public const string TopLevelFolderName = "sip_application";
public const string TopLevelApplicationFolderName = "sip_application";
public const string TopLevelSchoolFolderName = "sip_applyingschools";
public const string DioceseFilePrefixFieldName = "sip_adschoolfaithschoolfile";
public const string FoundationConsentFilePrefixFieldName = "sip_adschoolsupportedfoundationfile";
public const string ResolutionConsentfilePrefixFieldName = "sip_adschoolgoverningbodyconsent";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public bool HasError

public async Task<IActionResult> OnGetRemoveFileAsync(int appId, int urn, string entityId, string applicationReference, string section, string fileName)
{
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelFolderName, entityId, applicationReference, section, fileName);
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelSchoolFolderName, entityId, applicationReference, section, fileName);
return RedirectToPage("AdditionalDetails", new { Urn = urn, AppId = appId });
}
public override async Task<ActionResult> OnGetAsync(int urn, int appId)
Expand All @@ -201,11 +201,11 @@ public override async Task<ActionResult> OnGetAsync(int urn, int appId)
}
ApplicationReference = applicationDetails.ApplicationReference;
OfstedInspected = !string.IsNullOrWhiteSpace(OfstedInspectionDetails) ? SelectOption.Yes : SelectOption.No;
DioceseFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.DioceseFilePrefixFieldName);
DioceseFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.DioceseFilePrefixFieldName);
TempDataHelper.StoreSerialisedValue($"{EntityId}-dioceseFiles", TempData, DioceseFileNames);
FoundationConsentFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.FoundationConsentFilePrefixFieldName);
FoundationConsentFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.FoundationConsentFilePrefixFieldName);
TempDataHelper.StoreSerialisedValue($"{EntityId}-foundationConsentFiles", TempData, FoundationConsentFileNames);
ResolutionConsentFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.ResolutionConsentfilePrefixFieldName);
ResolutionConsentFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.ResolutionConsentfilePrefixFieldName);
TempDataHelper.StoreSerialisedValue($"{EntityId}-resolutionConsentFiles", TempData, ResolutionConsentFileNames);
return Page();
}
Expand Down Expand Up @@ -478,7 +478,7 @@ private async Task<bool> UploadFiles()
{
foreach (var file in DioceseFiles)
{
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, EntityId.ToString(),
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(),
ApplicationReference, FileUploadConstants.DioceseFilePrefixFieldName, file);
}
}
Expand All @@ -494,7 +494,7 @@ await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, Enti
{
foreach (var file in FoundationConsentFiles)
{
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, EntityId.ToString(),
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(),
ApplicationReference, FileUploadConstants.FoundationConsentFilePrefixFieldName, file);
}
}
Expand All @@ -509,7 +509,7 @@ await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, Enti
{
foreach (var file in ResolutionConsentFiles)
{
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, EntityId.ToString(),
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(),
ApplicationReference, FileUploadConstants.ResolutionConsentfilePrefixFieldName, file);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ public override async Task<ActionResult> OnGetAsync(int urn, int appId)
}
ApplicationType = applicationDetails.ApplicationType;
ApplicationReference = applicationDetails.ApplicationReference;
SchoolCFYRevenueStatusFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.SchoolCFYRevenueStatusFile);
SchoolCFYCapitalForwardFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.SchoolCFYCapitalForwardFile);
SchoolCFYRevenueStatusFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.SchoolCFYRevenueStatusFile);
SchoolCFYCapitalForwardFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.SchoolCFYCapitalForwardFile);

TempDataHelper.StoreSerialisedValue($"{EntityId}-SchoolCFYRevenueStatusFileNames", TempData, SchoolCFYRevenueStatusFileNames);
TempDataHelper.StoreSerialisedValue($"{EntityId}-SchoolCFYCapitalForwardFileNames", TempData, SchoolCFYCapitalForwardFileNames);
Expand Down Expand Up @@ -213,7 +213,7 @@ private async Task<bool> UploadFiles()
{
foreach (var file in SchoolCfyRevenueStatusFiles)
{
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, EntityId.ToString(),
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(),
ApplicationReference, FileUploadConstants.SchoolCFYRevenueStatusFile,
file);
}
Expand All @@ -229,7 +229,7 @@ await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, Enti
{
foreach (var file in SchoolCFYCapitalForwardFiles)
{
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, EntityId.ToString(),
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(),
ApplicationReference, FileUploadConstants.SchoolCFYCapitalForwardFile, file);
}
}
Expand Down Expand Up @@ -296,7 +296,7 @@ public override bool RunUiValidation()
}
public async Task<IActionResult> OnGetRemoveFileAsync(int appId, int urn, string entityId, string applicationReference, string section, string fileName)
{
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelFolderName, entityId, applicationReference, section, fileName);
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelSchoolFolderName, entityId, applicationReference, section, fileName);
return RedirectToPage("CurrentFinancialYear", new { Urn = urn, AppId = appId });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private FurtherInformationSummaryViewModel PopulateFurtherInformation(SchoolAppl
selectedSchool.MainFeederSchools : QuestionAndAnswerConstants.NoInfoAnswer)
);

var fileNames = _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.ResolutionConsentfilePrefixFieldName).Result;
var fileNames = _fileUploadService.GetFiles(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.ResolutionConsentfilePrefixFieldName).Result;


FISheading.Sections.Add(new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ public override async Task<ActionResult> OnGetAsync(int urn, int appId)
ApplicationReference = applicationDetails.ApplicationReference;

ForecastedRevenueFileNames = await _fileUploadService.GetFiles(
FileUploadConstants.TopLevelFolderName,
FileUploadConstants.TopLevelSchoolFolderName,
EntityId.ToString(),
ApplicationReference,
FileUploadConstants.NFYForecastedRevenueFilePrefixFieldName);

TempDataHelper.StoreSerialisedValue($"{EntityId}-NFYforecastedRevenueFiles", TempData, ForecastedRevenueFileNames);

ForecastedCapitalFileNames = await _fileUploadService.GetFiles(
FileUploadConstants.TopLevelFolderName,
FileUploadConstants.TopLevelSchoolFolderName,
EntityId.ToString(),
ApplicationReference,
FileUploadConstants.NFYForecastedCapitalFilePrefixFieldName);
Expand All @@ -176,7 +176,7 @@ private async Task<bool> UploadFiles()
{
foreach (var file in ForecastedRevenueFiles)
{
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, EntityId.ToString(),
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(),
ApplicationReference, FileUploadConstants.NFYForecastedRevenueFilePrefixFieldName,
file);
}
Expand All @@ -192,7 +192,7 @@ await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, Enti
{
foreach (var file in ForecastedCapitalFiles)
{
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, EntityId.ToString(),
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(),
ApplicationReference, FileUploadConstants.NFYForecastedCapitalFilePrefixFieldName, file);
}
}
Expand Down Expand Up @@ -299,7 +299,7 @@ public override bool RunUiValidation()

public async Task<IActionResult> OnGetRemoveFileAsync(int appId, int urn, string entityId, string applicationReference, string section, string fileName)
{
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelFolderName, entityId, applicationReference, section, fileName);
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelSchoolFolderName, entityId, applicationReference, section, fileName);
return RedirectToPage("NextFinancialYear", new {Urn = urn, AppId = appId});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public PreviousFinancialYearModel(IFileUploadService fileUploadService,

public async Task<IActionResult> OnGetRemoveFileAsync(int appId, int urn, string entityId, string applicationReference, string section, string fileName)
{
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelFolderName, entityId, applicationReference, section, fileName);
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelSchoolFolderName, entityId, applicationReference, section, fileName);
return RedirectToPage("PreviousFinancialYear", new { Urn = urn, AppId = appId });
}

Expand All @@ -156,8 +156,8 @@ public override async Task<ActionResult> OnGetAsync(int urn, int appId)
PopulateUiModel(selectedSchool);
}
ApplicationReference = applicationDetails?.ApplicationReference;
SchoolPFYRevenueStatusFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.SchoolPFYRevenueStatusFile);
SchoolPFYCapitalForwardStatusFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.SchoolPFYCapitalForwardStatusFile);
SchoolPFYRevenueStatusFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.SchoolPFYRevenueStatusFile);
SchoolPFYCapitalForwardStatusFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.SchoolPFYCapitalForwardStatusFile);

TempDataHelper.StoreSerialisedValue($"{appId}-SchoolPFYRevenueStatusFileNames", TempData, SchoolPFYRevenueStatusFileNames);
TempDataHelper.StoreSerialisedValue($"{appId}-SchoolPFYCapitalForwardStatusFileNames", TempData, SchoolPFYCapitalForwardStatusFileNames);
Expand All @@ -171,7 +171,7 @@ private async Task<bool> UploadFiles()
{
foreach (var file in SchoolPFYRevenueStatusFiles)
{
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, EntityId.ToString(),
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(),
ApplicationReference, FileUploadConstants.SchoolPFYRevenueStatusFile,
file);
}
Expand All @@ -187,7 +187,7 @@ await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, Enti
{
foreach (var file in SchoolPFYCapitalForwardStatusFiles)
{
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName, EntityId.ToString(),
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelSchoolFolderName, EntityId.ToString(),
ApplicationReference, FileUploadConstants.SchoolPFYCapitalForwardStatusFile, file);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public override async Task<ActionResult> OnGetAsync(int appId)
if (applicationDetails?.ApplicationReference != null)
{
GovernanceStructureDetailsFileNames = await _fileUploadService.GetFiles(
FileUploadConstants.TopLevelFolderName, EntityId.ToString(), ApplicationReference,
FileUploadConstants.TopLevelApplicationFolderName, EntityId.ToString(), ApplicationReference,
FileUploadConstants.JoinAMatTrustGovernanceFilePrefixFieldName);
TempDataHelper.StoreSerialisedValue($"{EntityId}-governanceStructureDetailsFiles", TempData,
GovernanceStructureDetailsFileNames);
Expand Down Expand Up @@ -114,7 +114,7 @@ private async Task<bool> UploadFiles()
{
foreach (var file in GovernanceStructureDetailsFiles)
{
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName,
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelApplicationFolderName,
EntityId.ToString(), ApplicationReference,
FileUploadConstants.JoinAMatTrustGovernanceFilePrefixFieldName, file);
}
Expand Down Expand Up @@ -168,7 +168,7 @@ public override Dictionary<string, dynamic> PopulateUpdateDictionary()

public async Task<IActionResult> OnGetRemoveFileAsync(int appId, int urn, string entityId, string applicationReference, string section, string fileName)
{
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelFolderName, entityId, applicationReference, section, fileName);
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelApplicationFolderName, entityId, applicationReference, section, fileName);
return RedirectToPage("ApplicationNewTrustGovernanceStructureDetails", new { Urn = urn, AppId = appId });
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public override void PopulateUiModel(ConversionApplication? conversionApplicatio

try
{
result = _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, conversionApplication.EntityId.ToString(), conversionApplication.ApplicationReference, FileUploadConstants.JoinAMatTrustGovernanceFilePrefixFieldName).Result;
result = _fileUploadService.GetFiles(FileUploadConstants.TopLevelApplicationFolderName, conversionApplication.EntityId.ToString(), conversionApplication.ApplicationReference, FileUploadConstants.JoinAMatTrustGovernanceFilePrefixFieldName).Result;
files = result.Aggregate(string.Empty, (current, fileName) => current + (fileName + "\n"));
}
catch (Exception ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ApplicationSchoolJoinAMatTrustSummaryHeadingViewModel headingChangeTrustDetails
List<string> trustConsentFileNames = new List<string>();
try
{
trustConsentFileNames = _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, conversionApplication.EntityId.ToString(), conversionApplication.ApplicationReference, FileUploadConstants.JoinAMatTrustConsentFilePrefixFieldName).Result;
trustConsentFileNames = _fileUploadService.GetFiles(FileUploadConstants.TopLevelApplicationFolderName, conversionApplication.EntityId.ToString(), conversionApplication.ApplicationReference, FileUploadConstants.JoinAMatTrustConsentFilePrefixFieldName).Result;
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public override bool RunUiValidation()
}
public async Task<IActionResult> OnGetRemoveFileAsync(int appId, int urn, string entityId, string applicationReference, string section, string fileName)
{
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelFolderName, entityId, applicationReference, section, fileName);
await _fileUploadService.DeleteFile(FileUploadConstants.TopLevelApplicationFolderName, entityId, applicationReference, section, fileName);
return RedirectToPage("ApplicationSchoolTrustConsent", new {Urn = urn, AppId = appId});
}

Expand Down Expand Up @@ -115,7 +115,7 @@ public override async Task<ActionResult> OnGetAsync(int urn, int appId)

EntityId = applicationDetails.EntityId;
ApplicationReference = applicationDetails.ApplicationReference;
TrustConsentFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.JoinAMatTrustConsentFilePrefixFieldName);
TrustConsentFileNames = await _fileUploadService.GetFiles(FileUploadConstants.TopLevelApplicationFolderName, EntityId.ToString(), ApplicationReference, FileUploadConstants.JoinAMatTrustConsentFilePrefixFieldName);
TempDataHelper.StoreSerialisedValue($"{EntityId}-trustConsentFiles", TempData, TrustConsentFileNames);
return Page();
}
Expand Down Expand Up @@ -153,7 +153,7 @@ private async Task<bool> UploadFiles()
{
foreach (var file in TrustConsentFiles)
{
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelFolderName,
await _fileUploadService.UploadFile(FileUploadConstants.TopLevelApplicationFolderName,
EntityId.ToString(), ApplicationReference,
FileUploadConstants.JoinAMatTrustConsentFilePrefixFieldName, file);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private Status CalculateGovernanceStructureSectionStatus(ConversionApplication a
{
try
{
var result = _fileUploadService.GetFiles(FileUploadConstants.TopLevelFolderName, application.EntityId.ToString(), application.ApplicationReference, FileUploadConstants.JoinAMatTrustGovernanceFilePrefixFieldName).Result;
var result = _fileUploadService.GetFiles(FileUploadConstants.TopLevelApplicationFolderName, application.EntityId.ToString(), application.ApplicationReference, FileUploadConstants.JoinAMatTrustGovernanceFilePrefixFieldName).Result;
return result.Any() ? Status.Completed : Status.NotStarted;
}
catch (Exception e)
Expand Down

0 comments on commit 06e838c

Please sign in to comment.