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
3 changes: 1 addition & 2 deletions LearningHub.Nhs.WebUI/Controllers/CatalogueController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,7 @@ public async Task<IActionResult> RequestPreviewAccess(CatalogueRequestAccessView
[Route("/allcatalogue/{filterChar}")]
public async Task<IActionResult> GetAllCatalogue(string filterChar = "a")
{
var pageSize = this.settings.AllCataloguePageSize;
var catalogues = await this.catalogueService.GetAllCatalogueAsync(filterChar, pageSize);
var catalogues = await this.catalogueService.GetAllCatalogueAsync(filterChar);
return this.View("allcatalogue", catalogues);
}

Expand Down
3 changes: 1 addition & 2 deletions LearningHub.Nhs.WebUI/Interfaces/ICatalogueService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ public interface ICatalogueService
/// The GetAllCatalogueAsync.
/// </summary>
/// <param name="filterChar">The letter.</param>
/// <param name="pageSize">The pageSize.</param>
/// <returns>The allcatalogue result based on letters.</returns>
Task<AllCatalogueResponseViewModel> GetAllCatalogueAsync(string filterChar, int pageSize);
Task<AllCatalogueResponseViewModel> GetAllCatalogueAsync(string filterChar);
}
}
7 changes: 3 additions & 4 deletions LearningHub.Nhs.WebUI/Services/CatalogueService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -607,14 +607,13 @@ public async Task<LearningHubValidationResult> RemoveUserFromRestrictedAccessUse
/// GetAllCatalogueAsync.
/// </summary>
/// <param name="filterChar">The filterChar.</param>
/// <param name="pageSize">the pageSize.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
public async Task<AllCatalogueResponseViewModel> GetAllCatalogueAsync(string filterChar, int pageSize)
/// /// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
public async Task<AllCatalogueResponseViewModel> GetAllCatalogueAsync(string filterChar)
{
AllCatalogueResponseViewModel viewmodel = new AllCatalogueResponseViewModel { };
var client = await this.LearningHubHttpClient.GetClientAsync();

var request = $"catalogue/allcatalogues/{pageSize}/{filterChar}";
var request = $"catalogue/allcatalogues/{filterChar}";
var response = await client.GetAsync(request).ConfigureAwait(false);

if (response.IsSuccessStatusCode)
Expand Down
4 changes: 2 additions & 2 deletions LearningHub.Nhs.WebUI/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
"MediaKindStorageConnectionString": ""
},
"EnableTempDebugging": "false",
"LimitScormToAdmin": "false",
"AllCataloguePageSize": 10
"LimitScormToAdmin": "false"

},
"LearningHubAuthServiceConfig": {
"Authority": "",
Expand Down
7 changes: 3 additions & 4 deletions WebAPI/LearningHub.Nhs.API/Controllers/CatalogueController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,13 @@ public async Task<IActionResult> AccessRequest(int accessRequestId)
/// <summary>
/// Gets AllCatalogues.
/// </summary>
/// <param name="pageSize">The pageSize.</param>
/// <param name="filterChar">The filterChar.</param>
/// <returns>IActionResult.</returns>
[HttpGet]
[Route("allcatalogues/{pageSize}/{filterChar}")]
public async Task<IActionResult> GetAllCataloguesAsync(int pageSize, string filterChar = null)
[Route("allcatalogues/{filterChar}")]
public async Task<IActionResult> GetAllCataloguesAsync(string filterChar = null)
{
var response = await this.catalogueService.GetAllCataloguesAsync(pageSize, filterChar, this.CurrentUserId);
var response = await this.catalogueService.GetAllCataloguesAsync(filterChar, this.CurrentUserId);
return this.Ok(response);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
CREATE PROCEDURE [hierarchy].[GetCatalogues] (
-------------------------------------------------------------------------------
-- Author Arunima George
-- Created 15-08-2024
-- Purpose Get Cataloges for View all cataoge page
--
-- Modification History

-- Anju 03-02-2025 TD-4794: Removed page size to disaplay all records
-------------------------------------------------------------------------------

CREATE PROCEDURE [hierarchy].[GetCatalogues] (
@userId INT
,@filterChar nvarchar(10)
,@OffsetRows int
,@fetchRows int
)
,@filterChar nvarchar(10))
AS
BEGIN

Expand All @@ -30,10 +37,7 @@ BEGIN
WHERE n.Id <> 1 AND n.Hidden = 0 AND n.Deleted = 0 AND cnv.Deleted = 0 AND nv.VersionStatusId = 2
and cnv.Name like @filterChar+'%'
ORDER BY cnv.Name
OFFSET @OffsetRows ROWS
FETCH NEXT @FetchRows ROWS ONLY




END
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
CREATE PROCEDURE [hierarchy].[GetCataloguesCount] (
-------------------------------------------------------------------------------
-- Author Arunima George
-- Created 15-08-2024
-- Purpose Get Cataloges for View all cataoge page

CREATE PROCEDURE [hierarchy].[GetCataloguesCount] (
@userId INT
)
AS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@ public interface ICatalogueNodeVersionRepository : IGenericRepository<CatalogueN
/// <summary>
/// Gets catalogues based on filter character.
/// </summary>
/// <param name="pageSize">The pageSize.</param>
/// <param name="filterChar">The filterChar.</param>
/// <param name="userId">The userId.</param>
/// <returns>The catalogues.</returns>
Task<List<AllCatalogueViewModel>> GetAllCataloguesAsync(int pageSize, string filterChar, int userId);
Task<List<AllCatalogueViewModel>> GetAllCataloguesAsync(string filterChar, int userId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,18 +373,15 @@ public List<AllCatalogueAlphabetModel> GetAllCataloguesAlphaCount(int userId)
/// <summary>
/// Gets catalogues based on filter character.
/// </summary>
/// <param name="pageSize">The pageSize.</param>
/// <param name="filterChar">The filterChar.</param>
/// <param name="userId">The userId.</param>
/// <returns>resources.</returns>
public async Task<List<AllCatalogueViewModel>> GetAllCataloguesAsync(int pageSize, string filterChar, int userId)
public async Task<List<AllCatalogueViewModel>> GetAllCataloguesAsync(string filterChar, int userId)
{
var param0 = new SqlParameter("@userId", SqlDbType.Int) { Value = userId };
var param1 = new SqlParameter("@filterChar", SqlDbType.NVarChar, 10) { Value = filterChar.Trim() };
var param2 = new SqlParameter("@OffsetRows", SqlDbType.Int) { Value = 0 };
var param3 = new SqlParameter("@fetchRows", SqlDbType.Int) { Value = pageSize };

var result = await this.DbContext.AllCatalogueViewModel.FromSqlRaw("[hierarchy].[GetCatalogues] @userId, @filterChar, @OffsetRows, @fetchRows", param0, param1, param2, param3)
var result = await this.DbContext.AllCatalogueViewModel.FromSqlRaw("[hierarchy].[GetCatalogues] @userId, @filterChar", param0, param1)
.AsNoTracking().ToListAsync();
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,9 @@ public interface ICatalogueService
/// <summary>
/// GetAllCataloguesAsync.
/// </summary>
/// <param name="pageSize">The pageSize.</param>
/// <param name="filterChar">filterChar.</param>
/// <param name="userId">userId.</param>
/// <returns>The allcatalogue result based on letters.</returns>
Task<AllCatalogueResponseViewModel> GetAllCataloguesAsync(int pageSize, string filterChar, int userId);
Task<AllCatalogueResponseViewModel> GetAllCataloguesAsync(string filterChar, int userId);
}
}
5 changes: 2 additions & 3 deletions WebAPI/LearningHub.Nhs.Services/CatalogueService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -968,11 +968,10 @@ public async Task<CatalogueAccessRequestViewModel> AccessRequestAsync(int userId
/// <summary>
/// GetAllCataloguesAsync.
/// </summary>
/// <param name="pageSize">The pageSize.</param>
/// <param name="filterChar">The filterChar.</param>
/// <param name="userId">The userId.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
public async Task<AllCatalogueResponseViewModel> GetAllCataloguesAsync(int pageSize, string filterChar, int userId)
public async Task<AllCatalogueResponseViewModel> GetAllCataloguesAsync(string filterChar, int userId)
{
var catalogueAlphaCount = this.catalogueNodeVersionRepository.GetAllCataloguesAlphaCount(userId);
var filterCharMod = filterChar.Trim() == "0-9" ? "[0-9]" : filterChar;
Expand Down Expand Up @@ -1010,7 +1009,7 @@ public async Task<AllCatalogueResponseViewModel> GetAllCataloguesAsync(int pageS
}
}

var catalogues = await this.catalogueNodeVersionRepository.GetAllCataloguesAsync(pageSize, filterCharMod, userId);
var catalogues = await this.catalogueNodeVersionRepository.GetAllCataloguesAsync(filterCharMod, userId);
foreach (var catalogue in catalogues)
{
catalogue.Providers = await this.providerService.GetByCatalogueVersionIdAsync(catalogue.NodeVersionId);
Expand Down
Loading