From 75e3e7afbd3d85062eb93c36dd0aaff332dd0b4e Mon Sep 17 00:00:00 2001 From: swapnamol-abraham Date: Fri, 20 Jun 2025 12:04:18 +0100 Subject: [PATCH 1/3] TD-5502: Replace Web API layer with Open API Layer -Admin Operations-Catalogue Creation/Catalogue Edit/ Edit Folder Structure/resource Transfer and unpublish/resource details/user management- SIT fixes --- .../Services/CatalogueService.cs | 4 +- .../Services/ContentService.cs | 2 +- .../Services/UserGroupService.cs | 4 +- LearningHub.Nhs.WebUI/web.config | 44 +++++++++++-------- .../Services/CatalogueService.cs | 2 +- .../Controllers/CatalogueController.cs | 6 +-- 6 files changed, 37 insertions(+), 25 deletions(-) diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Services/CatalogueService.cs b/AdminUI/LearningHub.Nhs.AdminUI/Services/CatalogueService.cs index b2a082dc6..0ce6c58a5 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Services/CatalogueService.cs +++ b/AdminUI/LearningHub.Nhs.AdminUI/Services/CatalogueService.cs @@ -25,11 +25,13 @@ public class CatalogueService : BaseService, ICatalogueService /// Initializes a new instance of the class. /// /// The learningHubHttpClient. + /// The Open Api Http Client. /// The openApiFacade. public CatalogueService( ILearningHubHttpClient learningHubHttpClient, + IOpenApiHttpClient openApiHttpClient, IOpenApiFacade openApiFacade) - : base(learningHubHttpClient) + : base(learningHubHttpClient, openApiHttpClient) { this.facade = openApiFacade; } diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Services/ContentService.cs b/AdminUI/LearningHub.Nhs.AdminUI/Services/ContentService.cs index cc792c228..ec983fffd 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Services/ContentService.cs +++ b/AdminUI/LearningHub.Nhs.AdminUI/Services/ContentService.cs @@ -37,7 +37,7 @@ public class ContentService : BaseService, IContentService /// The fileService. /// azureMediaService. public ContentService(ILearningHubHttpClient learningHubHttpClient, IOpenApiHttpClient openApiHttpClient, IFileService fileService, IAzureMediaService azureMediaService) - : base(learningHubHttpClient) + : base(learningHubHttpClient, openApiHttpClient) { this.fileService = fileService; this.azureMediaService = azureMediaService; diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Services/UserGroupService.cs b/AdminUI/LearningHub.Nhs.AdminUI/Services/UserGroupService.cs index a9a7a3133..0a941c761 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Services/UserGroupService.cs +++ b/AdminUI/LearningHub.Nhs.AdminUI/Services/UserGroupService.cs @@ -32,15 +32,17 @@ public class UserGroupService : BaseService, IUserGroupService /// Initializes a new instance of the class. /// /// The learningHubHttpClient. + /// The Open Api Http Client. /// The http context accessor. /// The cacheService. /// The roleService. public UserGroupService( ILearningHubHttpClient learningHubHttpClient, + IOpenApiHttpClient openApiHttpClient, ICacheService cacheService, IRoleService roleService, IHttpContextAccessor contextAccessor) - : base(learningHubHttpClient) + : base(learningHubHttpClient, openApiHttpClient) { this.contextAccessor = contextAccessor; this.cacheService = cacheService; diff --git a/LearningHub.Nhs.WebUI/web.config b/LearningHub.Nhs.WebUI/web.config index 837247997..eb1f7ff1e 100644 --- a/LearningHub.Nhs.WebUI/web.config +++ b/LearningHub.Nhs.WebUI/web.config @@ -1,21 +1,29 @@  - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/CatalogueService.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/CatalogueService.cs index f75c0616e..53810f5d1 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/CatalogueService.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/CatalogueService.cs @@ -189,7 +189,7 @@ public CatalogueBasicViewModel GetBasicCatalogue(int catalogueNodeId) /// /// The searchTerm. /// The catalogues. - public List GetCatalogues(string searchTerm) + public List GetCatalogues(string? searchTerm) { IQueryable catalogueVersions = this.catalogueNodeVersionRepository.GetAll() .Include(x => x.Keywords) diff --git a/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/CatalogueController.cs b/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/CatalogueController.cs index 3d6e330ff..55b812fdb 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/CatalogueController.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/CatalogueController.cs @@ -57,7 +57,7 @@ public async Task GetAllCataloguesAsync(string filterChar = null) /// The catalogues. [HttpGet] [Route("Catalogues")] - public IActionResult GetCatalogues(string searchTerm) + public IActionResult GetCatalogues([FromQuery] string? searchTerm) { var catalogues = this.catalogueService.GetCatalogues(searchTerm); return this.Ok(catalogues); @@ -152,7 +152,7 @@ public IActionResult GetCataloguesForCurrentUser() /// The actionResult. [HttpPost] [Route("Catalogues")] - public async Task CreateCatalogue(CatalogueViewModel viewModel) + public async Task CreateCatalogue([FromBody] CatalogueViewModel viewModel) { try { @@ -237,7 +237,7 @@ public async Task AccessRequest(int accessRequestId) /// The updated catalogue. [HttpPut] [Route("Catalogues")] - public async Task UpdateCatalogue(CatalogueViewModel viewModel) + public async Task UpdateCatalogue([FromBody] CatalogueViewModel viewModel) { try { From ad892e76a9b1e14150765a8bd9d1d42c497e8914 Mon Sep 17 00:00:00 2001 From: swapnamol-abraham Date: Fri, 20 Jun 2025 12:06:55 +0100 Subject: [PATCH 2/3] Reverted the config changes --- LearningHub.Nhs.WebUI/web.config | 44 +++++++++++++------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/LearningHub.Nhs.WebUI/web.config b/LearningHub.Nhs.WebUI/web.config index eb1f7ff1e..837247997 100644 --- a/LearningHub.Nhs.WebUI/web.config +++ b/LearningHub.Nhs.WebUI/web.config @@ -1,29 +1,21 @@  - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - \ No newline at end of file + From 31c677ad10891c72cf9740657288646af69e23ae Mon Sep 17 00:00:00 2001 From: swapnamol-abraham Date: Mon, 23 Jun 2025 09:36:05 +0100 Subject: [PATCH 3/3] Removed optional referenece from the service class --- AdminUI/LearningHub.Nhs.AdminUI/Services/CatalogueService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Services/CatalogueService.cs b/AdminUI/LearningHub.Nhs.AdminUI/Services/CatalogueService.cs index 0ce6c58a5..2ac0088d9 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Services/CatalogueService.cs +++ b/AdminUI/LearningHub.Nhs.AdminUI/Services/CatalogueService.cs @@ -31,7 +31,7 @@ public CatalogueService( ILearningHubHttpClient learningHubHttpClient, IOpenApiHttpClient openApiHttpClient, IOpenApiFacade openApiFacade) - : base(learningHubHttpClient, openApiHttpClient) + : base(learningHubHttpClient) { this.facade = openApiFacade; }