diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Services.Interface/Services/IResourceService.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Services.Interface/Services/IResourceService.cs index 2a83eed8..e8427c4a 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Services.Interface/Services/IResourceService.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Services.Interface/Services/IResourceService.cs @@ -211,6 +211,14 @@ Task GetAssessmentProgress( /// The . List GetContributions(int userId, ResourceContributionsRequestViewModel resourceContributionsRequestViewModel, bool readOnly); + /// + /// The get my contributions view model async. + /// + /// The userId. + /// The myContributionsRequestViewModel. + /// The . + List GetMyContributions(int userId, MyContributionsRequestViewModel myContributionsRequestViewModel); + /// /// The get my resource view model async. /// diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/ResourceService.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/ResourceService.cs index caa66525..c14d04ed 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/ResourceService.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/ResourceService.cs @@ -4394,6 +4394,25 @@ public List GetContributions(int userId, Resou return models; } + /// + /// The get my contributions view model async. + /// + /// The userId. + /// The myContributionsRequestViewModel. + /// The . + public List GetMyContributions(int userId, MyContributionsRequestViewModel myContributionsRequestViewModel) + { + var resourceVersions = this.resourceVersionRepository.GetAll() + .Where(rv => !rv.Deleted && + rv.CreateUserId == userId && + rv.Resource.ResourceTypeEnum == myContributionsRequestViewModel.ResourceType && + rv.VersionStatusEnum == myContributionsRequestViewModel.Status); + + var models = this.mapper.Map>(resourceVersions); + return models; + } + + /// /// The get my resource view model async. /// diff --git a/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/ResourceController.cs b/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/ResourceController.cs index f514d1f4..98ae2417 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/ResourceController.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/ResourceController.cs @@ -701,12 +701,24 @@ public ActionResult GetMyContributionsAsync(ResourceContributionsRequestViewMode return this.Ok(this.resourceService.GetContributions(this.CurrentUserId.GetValueOrDefault(), resourceContributionsRequestViewModel, this.HttpContext.User.IsInRole("ReadOnly"))); } - - /// - /// Returns Resource Cards. - /// - /// The . - [HttpGet] + /// + /// Returns the requested contributions. + /// + /// The myContributionsRequestViewModel. + /// The . + [HttpPost] + [Route("GetMyContributions")] + public ActionResult GetMyContributions(MyContributionsRequestViewModel myContributionsRequestViewModel) + { + return this.Ok(this.resourceService.GetMyContributions(this.CurrentUserId.GetValueOrDefault(), myContributionsRequestViewModel)); + } + + + /// + /// Returns Resource Cards. + /// + /// The . + [HttpGet] [Route("GetMyResourceViewModel")] public async Task GetMyResourceViewModelAsync() {