Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


<ItemGroup>
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.33" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="17.12.0" />
Expand Down
2 changes: 1 addition & 1 deletion Auth/LearningHub.Nhs.Auth/LearningHub.Nhs.Auth.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<PackageReference Include="Azure.Extensions.AspNetCore.DataProtection.Blobs" Version="1.4.0" />
<PackageReference Include="Azure.Extensions.AspNetCore.DataProtection.Keys" Version="1.3.0" />
<PackageReference Include="Azure.Identity" Version="1.13.2" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="FluentValidation" Version="11.11.0" />
<PackageReference Include="IdentityServer4" Version="4.1.2" />
<PackageReference Include="IdentityServer4.Contrib.RedisStore" Version="4.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
Expand Down
16 changes: 16 additions & 0 deletions LearningHub.Nhs.UserApi.Services.Interface/ICountryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,21 @@ public interface ICountryService
/// The <see cref="Task"/>.
/// </returns>
Task<List<GenericListViewModel>> GetFilteredAsync(string filter);

/// <summary>
/// The get all.
/// </summary>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
Task<List<GenericListViewModel>> GetAllUKCountries();

/// <summary>
/// The get all.
/// </summary>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
Task<List<GenericListViewModel>> GetAllNonUKCountries();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -520,5 +520,13 @@ public interface IElfhUserService
/// <param name="currentUserId">currentUserId.</param>
/// <returns>The <see cref="Task"/>.</returns>
Task<bool> CheckSamePrimaryemailIsPendingToValidate(string secondaryEmail, int currentUserId);

/// <summary>
/// Update MyAccount Personal Details.
/// </summary>
/// <param name="personalDetailsViewModel">personalDetailsViewModel.</param>
/// <param name="currentUserId">currentUserId.</param>
/// <returns>The <see cref="Task"/>.</returns>
Task UpdateMyAccountPersonalDetails(PersonalDetailsViewModel personalDetailsViewModel, int currentUserId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="EntityFrameworkCore.Testing.Moq" Version="5.0.0" />
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.0" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
Expand Down
30 changes: 30 additions & 0 deletions LearningHub.Nhs.UserApi.Services/CountryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,35 @@ public async Task<List<GenericListViewModel>> GetFilteredAsync(string filter)

return countryList;
}

/// <summary>
/// Get All UK Countries.
/// </summary>
/// <returns>List of countries.</returns>
public async Task<List<GenericListViewModel>> GetAllUKCountries()
{
var items = this.countryRepository.GetAll()
.Where(c => c.Deleted == false && c.Numeric == "826")
.OrderBy(r => r.DisplayOrder);

var countryList = await this.mapper.ProjectTo<GenericListViewModel>(items).ToListWithNoLockAsync();

return countryList;
}

/// <summary>
/// Get All Non UK Countries.
/// </summary>
/// <returns>List of countries.</returns>
public async Task<List<GenericListViewModel>> GetAllNonUKCountries()
{
var items = this.countryRepository.GetAll()
.Where(c => c.Deleted == false && c.Numeric != "826")
.OrderBy(r => r.DisplayOrder);

var countryList = await this.mapper.ProjectTo<GenericListViewModel>(items).ToListWithNoLockAsync();

return countryList;
}
}
}
20 changes: 20 additions & 0 deletions LearningHub.Nhs.UserApi.Services/ElfhUserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,26 @@ public async Task<bool> CheckSamePrimaryemailIsPendingToValidate(string secondar
return false;
}

/// <summary>
/// Update MyAccount PersonalDetails.
/// </summary>
/// <param name="personalDetailsViewModel">personalDetailsViewModel.</param>
/// <param name="currentUserId">currentUserId.</param>
/// <returns>The <see cref="Task"/>.</returns>
public async Task UpdateMyAccountPersonalDetails(PersonalDetailsViewModel personalDetailsViewModel, int currentUserId)
{
User user = await this.elfhUserRepository.GetByIdAsync(personalDetailsViewModel.UserId);
user.FirstName = personalDetailsViewModel.FirstName;
user.LastName = personalDetailsViewModel.LastName;
user.PreferredName = personalDetailsViewModel.PreferredName;
if (!string.IsNullOrEmpty(personalDetailsViewModel.SecondaryEmailAddress))
{
user.AltEmailAddress = personalDetailsViewModel.SecondaryEmailAddress;
}

await this.elfhUserRepository.UpdateAsync(currentUserId, user);
}

private async Task<LearningHubValidationResult> ValidateAsync(CreateOpenAthensLinkToLhUser newUserDetails)
{
var registrationValidator = new CreateLinkedOpenAthensUserValidator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
Expand Down
28 changes: 28 additions & 0 deletions LearningHub.Nhs.UserApi/Controllers/CountryController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,33 @@ public async Task<IActionResult> GetFiltered(string filter)
var list = await this.countryService.GetFilteredAsync(filter);
return this.Ok(list);
}

/// <summary>
/// Get a list of Uk Country records.
/// </summary>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
[HttpGet]
[Route("GetAllUKCountries")]
public async Task<IActionResult> GetAllUKCountries()
{
var list = await this.countryService.GetAllUKCountries();
return this.Ok(list);
}

/// <summary>
/// Get a list of non Uk Country records.
/// </summary>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
[HttpGet]
[Route("GetAllNonUKCountries")]
public async Task<IActionResult> GetAllNonUKCountries()
{
var list = await this.countryService.GetAllNonUKCountries();
return this.Ok(list);
}
}
}
13 changes: 13 additions & 0 deletions LearningHub.Nhs.UserApi/Controllers/ElfhUserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -923,5 +923,18 @@ public async Task<IActionResult> UpgradeAsFullAccessUser(int userId, string emai
var result = await this.securityService.UpgradeAsFullAccessUser(userId, email);
return this.Ok(result);
}

/// <summary>
/// Update MyAccount Personal Details.
/// </summary>
/// <param name="personalDetailsViewModel">personalDetailsViewModel.</param>
/// <returns>The <see cref="Task"/>.</returns>
[HttpPut]
[Route("UpdateMyAccountPersonalDetails")]
public async Task<IActionResult> UpdateMyAccountPersonalDetails([FromBody] PersonalDetailsViewModel personalDetailsViewModel)
{
await this.elfhUserService.UpdateMyAccountPersonalDetails(personalDetailsViewModel, this.CurrentUserId);
return this.Ok();
}
}
}
2 changes: 1 addition & 1 deletion LearningHub.Nhs.UserApi/LearningHub.Nhs.UserApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.10" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.0" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
Expand Down
Loading