Skip to content

Commit 11a544f

Browse files
authored
Merge pull request #239 from TechnologyEnhancedLearning/Develop/Features/TD-3132-Unified-platform-interface
Merge unified platform interface changes to test
2 parents e395ca7 + 397eddd commit 11a544f

File tree

16 files changed

+125
-10
lines changed

16 files changed

+125
-10
lines changed

Auth/LearningHub.Nhs.Auth.Tests/LearningHub.Nhs.Auth.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
<ItemGroup>
12-
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
12+
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
1313
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.33" />
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1515
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="17.12.0" />

Auth/LearningHub.Nhs.Auth/LearningHub.Nhs.Auth.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
<PackageReference Include="Azure.Extensions.AspNetCore.DataProtection.Blobs" Version="1.4.0" />
102102
<PackageReference Include="Azure.Extensions.AspNetCore.DataProtection.Keys" Version="1.3.0" />
103103
<PackageReference Include="Azure.Identity" Version="1.13.2" />
104-
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
104+
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
105105
<PackageReference Include="FluentValidation" Version="11.11.0" />
106106
<PackageReference Include="IdentityServer4" Version="4.1.2" />
107107
<PackageReference Include="IdentityServer4.Contrib.RedisStore" Version="4.0.0" />

LearningHub.Nhs.UserApi.Repository.Interface/LearningHub.Nhs.UserApi.Repository.Interface.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
11+
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
1212
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
1313
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
1414
<PrivateAssets>all</PrivateAssets>

LearningHub.Nhs.UserApi.Repository/LearningHub.Nhs.UserApi.Repository.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
11+
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
1212
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
1313
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
1414
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />

LearningHub.Nhs.UserApi.Services.Interface/ICountryService.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,21 @@ public interface ICountryService
3939
/// The <see cref="Task"/>.
4040
/// </returns>
4141
Task<List<GenericListViewModel>> GetFilteredAsync(string filter);
42+
43+
/// <summary>
44+
/// The get all.
45+
/// </summary>
46+
/// <returns>
47+
/// The <see cref="Task"/>.
48+
/// </returns>
49+
Task<List<GenericListViewModel>> GetAllUKCountries();
50+
51+
/// <summary>
52+
/// The get all.
53+
/// </summary>
54+
/// <returns>
55+
/// The <see cref="Task"/>.
56+
/// </returns>
57+
Task<List<GenericListViewModel>> GetAllNonUKCountries();
4258
}
4359
}

LearningHub.Nhs.UserApi.Services.Interface/IElfhUserService.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,5 +520,13 @@ public interface IElfhUserService
520520
/// <param name="currentUserId">currentUserId.</param>
521521
/// <returns>The <see cref="Task"/>.</returns>
522522
Task<bool> CheckSamePrimaryemailIsPendingToValidate(string secondaryEmail, int currentUserId);
523+
524+
/// <summary>
525+
/// Update MyAccount Personal Details.
526+
/// </summary>
527+
/// <param name="personalDetailsViewModel">personalDetailsViewModel.</param>
528+
/// <param name="currentUserId">currentUserId.</param>
529+
/// <returns>The <see cref="Task"/>.</returns>
530+
Task UpdateMyAccountPersonalDetails(PersonalDetailsViewModel personalDetailsViewModel, int currentUserId);
523531
}
524532
}

LearningHub.Nhs.UserApi.Services.Interface/LearningHub.Nhs.UserAPI.Services.Interface.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
11+
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
1212
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
1313
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
1414
<PrivateAssets>all</PrivateAssets>

LearningHub.Nhs.UserApi.Services.UnitTests/LearningHub.Nhs.UserApi.Services.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
13+
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
1414
<PackageReference Include="EntityFrameworkCore.Testing.Moq" Version="5.0.0" />
1515
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.0" />
1616
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />

LearningHub.Nhs.UserApi.Services/CountryService.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,35 @@ public async Task<List<GenericListViewModel>> GetFilteredAsync(string filter)
7979

8080
return countryList;
8181
}
82+
83+
/// <summary>
84+
/// Get All UK Countries.
85+
/// </summary>
86+
/// <returns>List of countries.</returns>
87+
public async Task<List<GenericListViewModel>> GetAllUKCountries()
88+
{
89+
var items = this.countryRepository.GetAll()
90+
.Where(c => c.Deleted == false && c.Numeric == "826")
91+
.OrderBy(r => r.DisplayOrder);
92+
93+
var countryList = await this.mapper.ProjectTo<GenericListViewModel>(items).ToListWithNoLockAsync();
94+
95+
return countryList;
96+
}
97+
98+
/// <summary>
99+
/// Get All Non UK Countries.
100+
/// </summary>
101+
/// <returns>List of countries.</returns>
102+
public async Task<List<GenericListViewModel>> GetAllNonUKCountries()
103+
{
104+
var items = this.countryRepository.GetAll()
105+
.Where(c => c.Deleted == false && c.Numeric != "826")
106+
.OrderBy(r => r.DisplayOrder);
107+
108+
var countryList = await this.mapper.ProjectTo<GenericListViewModel>(items).ToListWithNoLockAsync();
109+
110+
return countryList;
111+
}
82112
}
83113
}

LearningHub.Nhs.UserApi.Services/ElfhUserService.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,26 @@ public async Task<bool> CheckSamePrimaryemailIsPendingToValidate(string secondar
968968
return false;
969969
}
970970

971+
/// <summary>
972+
/// Update MyAccount PersonalDetails.
973+
/// </summary>
974+
/// <param name="personalDetailsViewModel">personalDetailsViewModel.</param>
975+
/// <param name="currentUserId">currentUserId.</param>
976+
/// <returns>The <see cref="Task"/>.</returns>
977+
public async Task UpdateMyAccountPersonalDetails(PersonalDetailsViewModel personalDetailsViewModel, int currentUserId)
978+
{
979+
User user = await this.elfhUserRepository.GetByIdAsync(personalDetailsViewModel.UserId);
980+
user.FirstName = personalDetailsViewModel.FirstName;
981+
user.LastName = personalDetailsViewModel.LastName;
982+
user.PreferredName = personalDetailsViewModel.PreferredName;
983+
if (!string.IsNullOrEmpty(personalDetailsViewModel.SecondaryEmailAddress))
984+
{
985+
user.AltEmailAddress = personalDetailsViewModel.SecondaryEmailAddress;
986+
}
987+
988+
await this.elfhUserRepository.UpdateAsync(currentUserId, user);
989+
}
990+
971991
private async Task<LearningHubValidationResult> ValidateAsync(CreateOpenAthensLinkToLhUser newUserDetails)
972992
{
973993
var registrationValidator = new CreateLinkedOpenAthensUserValidator();

0 commit comments

Comments
 (0)