Skip to content

Commit

Permalink
Merge pull request #333 from DFE-Digital/client-package-upgrade
Browse files Browse the repository at this point in the history
AB#123301
  • Loading branch information
paullocknimble authored Mar 7, 2023
2 parents f2463aa + 98f47c1 commit 607f6a2
Show file tree
Hide file tree
Showing 57 changed files with 13,066 additions and 15,218 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,4 @@ backend.vars

## Homebrew
Brewfile.lock.json
/Dfe.Academies.External.Web/wwwroot/lib/bootstrap/dist/scss
6 changes: 3 additions & 3 deletions Dfe.Academies.External.Web/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@
<script src="~/js/site.js" asp-append-version="true"></script>
</environment>
<environment exclude="Development">
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.4.1.min.js"
@*<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.4.1.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery"
crossorigin="anonymous"
integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh">
</script>

</script>*@
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
</environment>
@* <script src="~/js/all.js"></script>*@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,24 @@ public async Task AddSchoolToApplication(int applicationId, int schoolUrn, strin
//// https://academies-academisation-api-dev.azurewebsites.net/application/99
string apiurl = $"{_httpClient.BaseAddress}application/{applicationId}?api-version=V1";

// MR:- need to check if application type =JoinAMat and application already has school remove existing school - add new one
// otherwise API validation will reject !! which is correct !!!
if (application.Schools.All(c => c.URN != schoolUrn))
// PL:- if is form a mat we can add as many schools as we want just check that we aren't adding the same school twice
// if is join a mat then we add only if it is the first one
if ((application.ApplicationType == ApplicationTypes.FormAMat && application.Schools.All(c => c.URN != schoolUrn)) ||
(application.ApplicationType == ApplicationTypes.JoinAMat && !application.Schools.Any()))
{
SchoolApplyingToConvert school = new(name, schoolUrn, null);
application.Schools.Add(school);
}
else

//PL:- if it is join a mat we only add one school and from then it is changes to the existing school to maintain the attached data
if (application.ApplicationType == ApplicationTypes.JoinAMat)
{
if (application.ApplicationType == ApplicationTypes.JoinAMat)
var existingSchool = application.Schools.FirstOrDefault();
if (existingSchool != null)
{
var existingSchool = application.Schools.FirstOrDefault();
if (existingSchool != null)
{
// MR:- can't do remove because then we will bin all the associated data !!
existingSchool.URN = schoolUrn;
existingSchool.SchoolName = name;
}
// MR:- can't do remove because then we will bin all the associated data !!
existingSchool.URN = schoolUrn;
existingSchool.SchoolName = name;
}
}

Expand Down Expand Up @@ -160,7 +160,7 @@ public async Task AddTrustToApplication(int applicationId, int trustUkPrn, strin
{
trust = new ExistingTrust(applicationId, name, trustReference, trustUkPrn);
}

// MR:- no response from Academies API - Just an OK
await _resilientRequestProvider.PutAsync(apiurl, trust);
}
Expand Down Expand Up @@ -210,7 +210,7 @@ public async Task SetExistingTrustDetails(int applicationId, ExistingTrust exist
public async Task PutSchoolApplicationDetails(int applicationId, int schoolUrn, Dictionary<string, dynamic> schoolProperties)
{
var application = await GetApplication(applicationId);

if (application?.ApplicationId != applicationId)
{
throw new ArgumentException("Application not found");
Expand All @@ -221,12 +221,12 @@ public async Task PutSchoolApplicationDetails(int applicationId, int schoolUrn,
{
throw new ArgumentException("School not found");
}

//Populate all school fields with the values in the dictionary
foreach (var property in schoolProperties)
{
var prop = school.GetType().GetProperty(property.Key);
if(prop.CanBeSet())
if (prop.CanBeSet())
prop?.SetValue(school, property.Value);
}
string apiurl = $"{_httpClient.BaseAddress}application/{applicationId}?api-version=V1";
Expand Down Expand Up @@ -309,7 +309,9 @@ public async Task DeleteLoan(int applicationId, int schoolId, int loanId)
{
var deleteLoanCommand = new DeleteLoanCommand
{
ApplicationId = applicationId, SchoolId = schoolId, LoanId = loanId
ApplicationId = applicationId,
SchoolId = schoolId,
LoanId = loanId
};
string apiurl = $"{_httpClient.BaseAddress}school/loan/delete";
await _resilientRequestProvider.DeleteAsync<DeleteLoanCommand>(apiurl, deleteLoanCommand);
Expand Down Expand Up @@ -359,7 +361,9 @@ public async Task DeleteLease(int applicationId, int schoolId, int leaseId)
{
var deleteLeaseCommand = new DeleteLeaseCommand
{
ApplicationId = applicationId, SchoolId = schoolId, LeaseId = leaseId
ApplicationId = applicationId,
SchoolId = schoolId,
LeaseId = leaseId
};
string apiurl = $"{_httpClient.BaseAddress}school/lease/delete";
await _resilientRequestProvider.DeleteAsync<DeleteLeaseCommand>(apiurl, deleteLeaseCommand);
Expand Down
83 changes: 83 additions & 0 deletions Dfe.Academies.External.Web/libman.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"library": "[email protected]",
"files": [
"jquery.min.js",
"jquery.js",
"jquery.min.map"
],
"destination": "wwwroot/lib/jquery/dist/"
},
{
"library": "[email protected]",
"files": [
"jquery.validate.js",
"jquery.validate.min.js",
"additional-methods.js",
"additional-methods.min.js"
],
"destination": "wwwroot/lib/jquery-validation/dist/"
},
{
"library": "[email protected]",
"files": [
"jquery.validate.unobtrusive.js",
"jquery.validate.unobtrusive.min.js"
],
"destination": "wwwroot/lib/jquery-validation-unobtrusive/"
},
{
"library": "[email protected]",
"files": [
"js/bootstrap.js",
"js/bootstrap.min.js",
"js/bootstrap.min.js.map",
"js/bootstrap.js.map",
"js/bootstrap.bundle.js",
"js/bootstrap.bundle.js.map",
"js/bootstrap.bundle.min.js",
"js/bootstrap.bundle.min.js.map",
"js/bootstrap.esm.js",
"js/bootstrap.esm.js.map",
"js/bootstrap.esm.min.js",
"js/bootstrap.esm.min.js.map",
"css/bootstrap-grid.css",
"css/bootstrap-grid.css.map",
"css/bootstrap-grid.min.css",
"css/bootstrap-grid.min.css.map",
"css/bootstrap-grid.rtl.css",
"css/bootstrap-grid.rtl.css.map",
"css/bootstrap-grid.rtl.min.css",
"css/bootstrap-grid.rtl.min.css.map",
"css/bootstrap-reboot.css",
"css/bootstrap-reboot.css.map",
"css/bootstrap-reboot.min.css",
"css/bootstrap-reboot.min.css.map",
"css/bootstrap-reboot.rtl.css",
"css/bootstrap-reboot.rtl.css.map",
"css/bootstrap-reboot.rtl.min.css",
"css/bootstrap-reboot.rtl.min.css.map",
"css/bootstrap-utilities.css",
"css/bootstrap-utilities.css.map",
"css/bootstrap-utilities.min.css",
"css/bootstrap-utilities.min.css.map",
"css/bootstrap-utilities.rtl.css",
"css/bootstrap-utilities.rtl.css.map",
"css/bootstrap-utilities.rtl.min.css",
"css/bootstrap-utilities.rtl.min.css.map",
"css/bootstrap.css",
"css/bootstrap.css.map",
"css/bootstrap.min.css",
"css/bootstrap.min.css.map",
"css/bootstrap.rtl.css",
"css/bootstrap.rtl.css.map",
"css/bootstrap.rtl.min.css",
"css/bootstrap.rtl.min.css.map"
],
"destination": "wwwroot/lib/bootstrap/dist/"
}
]
}
Loading

0 comments on commit 607f6a2

Please sign in to comment.