diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Services/MKIOMediaService.cs b/AdminUI/LearningHub.Nhs.AdminUI/Services/MKIOMediaService.cs index fb1860afd..dc44a6959 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Services/MKIOMediaService.cs +++ b/AdminUI/LearningHub.Nhs.AdminUI/Services/MKIOMediaService.cs @@ -91,19 +91,21 @@ public async Task CreateMediaInputAsset(IFormFile file) /// . public async Task DownloadMediaInputAsset(string inputAssetName, string fileName) { - IAzureMediaServicesClient client = await this.CreateMediaServicesClientAsync(); + var client = this.GetMKIOServicesClientAsync(); + var assets = client.Assets.Get(inputAssetName); + + BlobServiceClient blobServiceClient = new BlobServiceClient(this.settings.MediaKindSettings.MediaKindStorageConnectionString); - AssetContainerSas assetContainerSas = await client.Assets.ListContainerSasAsync( - this.settings.AzureMediaResourceGroup, - this.settings.AzureMediaAccountName, - inputAssetName, - permissions: AssetContainerPermission.Read, - expiryTime: DateTime.UtcNow.AddHours(1).ToUniversalTime()); + BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(assets.Properties.Container); + if (!await containerClient.ExistsAsync().ConfigureAwait(false)) + { + await containerClient.CreateIfNotExistsAsync().ConfigureAwait(false); + } - string sasUri = assetContainerSas.AssetContainerSasUrls.First(); + var filename1 = Regex.Replace(fileName, "[^a-zA-Z0-9.]", string.Empty); + filename1 = string.IsNullOrEmpty(filename1) ? "file.txt" : filename1; - var blobServiceClient = new BlobContainerClient(new Uri(sasUri)); - var blobClient = blobServiceClient.GetBlockBlobClient(fileName); + BlobClient blobClient = containerClient.GetBlobClient(filename1); var fileContent = await blobClient.DownloadContentAsync(); return fileContent; diff --git a/LearningHub.Nhs.WebUI/Controllers/AccountController.cs b/LearningHub.Nhs.WebUI/Controllers/AccountController.cs index 979c1ac33..37813a17c 100644 --- a/LearningHub.Nhs.WebUI/Controllers/AccountController.cs +++ b/LearningHub.Nhs.WebUI/Controllers/AccountController.cs @@ -581,7 +581,18 @@ public async Task CreateAccountSearchRole(AccountCreationViewMode { var accountCreation = await this.multiPageFormService.GetMultiPageFormData(MultiPageFormDataFeature.AddRegistrationPrompt, this.TempData); - return this.View("CreateAccountSearchRole", new AccountCreationViewModel { CountryId = accountCreationViewModel.CountryId }); + var currentJobRole = int.TryParse(accountCreation.CurrentRole, out int currentRole); + if (currentJobRole && currentRole > 0) + { + var filterText = await this.jobRoleService.GetByIdAsync(currentRole); + accountCreationViewModel.FilterText = filterText.Name; + var jobrole = await this.jobRoleService.GetByIdAsync(currentRole); + return this.View("CreateAccountCurrentRole", new AccountCreationListViewModel { RoleList = new List { jobrole }, AccountCreationPaging = new AccountCreationPagingModel { TotalItems = 1, PageSize = UserRegistrationContentPageSize, HasItems = jobrole != null, CurrentPage = 1 }, CurrentRole = accountCreation.CurrentRole, CountryId = accountCreation.CountryId, RegionId = accountCreation.RegionId, FilterText = accountCreationViewModel.FilterText, ReturnToConfirmation = accountCreationViewModel.ReturnToConfirmation }); + } + else + { + return this.View("CreateAccountSearchRole", new AccountCreationViewModel { CountryId = accountCreationViewModel.CountryId }); + } } /// diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/notification/notification.vue b/LearningHub.Nhs.WebUI/Scripts/vuesrc/notification/notification.vue index 9820ef63e..25ef12656 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/notification/notification.vue +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/notification/notification.vue @@ -30,7 +30,7 @@ {{ notification.title }} -
{{ item.text }}  @@ -45,7 +45,7 @@
- +
@@ -74,7 +74,10 @@   {{ notification.title }}
- + + + + @@ -170,7 +173,7 @@ .catch(e => console.log(e)); } }, - async deleteNotification() { + async deleteNotification() { await axios.delete( '/api/notification/' + this.selectedNotification.notificationId + '?userNotificationId=' + this.selectedNotification.id) .catch(e => console.log(e)); diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/notification/notifications.vue b/LearningHub.Nhs.WebUI/Scripts/vuesrc/notification/notifications.vue index 0a338d282..e35ee3089 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/notification/notifications.vue +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/notification/notifications.vue @@ -86,7 +86,7 @@ @@ -142,6 +142,13 @@ $('#deleteModalButton').modal('hide'); $('#deleteModal').modal(); }, + closeConfirmation() { + if (document.activeElement instanceof HTMLElement) { + document.activeElement.blur(); + } + document.body.focus(); + setTimeout(() => { $('#deleteModal').modal('hide'); }, 10); + }, showNotification(notification: NotificationModel) { this.selectedNotification = notification; this.showMessage = true; @@ -154,7 +161,7 @@ }, async deleteNotification() { await this.getSelectedComponent().deleteNotification(); - $('#deleteModal').modal('hide'); + this.closeConfirmation(); this.showMessage = false; }, notificationTypeContent() { diff --git a/LearningHub.Nhs.WebUI/Styles/nhsuk/pages/bookmark.scss b/LearningHub.Nhs.WebUI/Styles/nhsuk/pages/bookmark.scss index 6378eae15..126c5c35f 100644 --- a/LearningHub.Nhs.WebUI/Styles/nhsuk/pages/bookmark.scss +++ b/LearningHub.Nhs.WebUI/Styles/nhsuk/pages/bookmark.scss @@ -112,6 +112,23 @@ td.col-type { tr.bookmark-item:hover td { background-color: $nhsuk-white; } +.my-bookmark-btn:focus { + outline: none; + text-decoration: none !important; + color: $nhsuk-black !important; + background-color: $nhsuk-yellow !important; + box-shadow: 0 -2px $govuk-focus-highlight-yellow, 0 4px $nhsuk-black; +} + +.my-bookmark-btn:hover { + outline: none; + text-decoration: none !important; +} + +.my-bookmark-btn { + transition: none !important; + border-radius: 0 !important; +} @media (min-width: 768px) { diff --git a/LearningHub.Nhs.WebUI/Views/Bookmark/_BookmarkAction.cshtml b/LearningHub.Nhs.WebUI/Views/Bookmark/_BookmarkAction.cshtml index 5349fbb30..e3b338884 100644 --- a/LearningHub.Nhs.WebUI/Views/Bookmark/_BookmarkAction.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Bookmark/_BookmarkAction.cshtml @@ -6,7 +6,7 @@ @if (Model.IsFirst == false) { - } @@ -15,25 +15,25 @@ @if (Model.IsLast == false) { - } - + @if (Model.IsFolder == false) { - + } - + \ No newline at end of file diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/AzureBlobSettings.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/AzureBlobSettings.cs new file mode 100644 index 000000000..12d6da133 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/AzureBlobSettings.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Models.Configuration +{ + /// + /// The AzureBlobSettings. + /// + public class AzureBlobSettings + { + /// + /// Gets or sets the connectionString. + /// + public string ConnectionString { get; set; } = null!; + + /// + /// Gets or sets the catalogue collection id. + /// + public string UploadContainer { get; set; } = null!; + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/AzureConfig.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/AzureConfig.cs new file mode 100644 index 000000000..9b3ad76d1 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/AzureConfig.cs @@ -0,0 +1,17 @@ +namespace LearningHub.Nhs.OpenApi.Models.Configuration +{ + /// + /// The AzureConfig. + /// + public class AzureConfig + { + /// + /// Gets or sets the azure blob settings. + /// + public AzureBlobSettings AzureBlobSettings { get; set; } = null!; + /// + /// Gets or sets the azure storage queue. + /// + public string AzureStorageQueueConnectionString { get; set; } = null!; + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/FindwiseCollectionIdSettings.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/FindwiseCollectionIdSettings.cs index 3e97bbb53..ece9a6012 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/FindwiseCollectionIdSettings.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/FindwiseCollectionIdSettings.cs @@ -14,5 +14,10 @@ public class FindwiseCollectionIdSettings /// Gets or sets the catalogue collection id. ///
public string Catalogue { get; set; } = null!; + + /// + /// Gets or sets the AutoSuggestion collection id. + /// + public string AutoSuggestion { get; set; } = null!; } } diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/FindwiseConfig.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/FindwiseConfig.cs index dd84799c5..009509127 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/FindwiseConfig.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/FindwiseConfig.cs @@ -5,6 +5,11 @@ namespace LearningHub.Nhs.OpenApi.Models.Configuration /// public class FindwiseConfig { + /// + /// Gets or sets the base url for the Findwise Index endpoint. + /// + public string IndexUrl { get; set; } = null!; + /// /// Gets or sets the base url for the Findwise search service. /// @@ -25,6 +30,16 @@ public class FindwiseConfig /// public int DefaultItemLimitForSearch { get; set; } + /// + /// Gets or sets the description limit. + /// + public int DescriptionLengthLimit { get; set; } + + /// + /// Gets or sets the description length. + /// + public int MaximumDescriptionLength { get; set; } + /// /// Gets or sets the collection ids. /// @@ -34,5 +49,10 @@ public class FindwiseConfig /// Gets or sets the special search characters. /// public string SpecialSearchCharacters { get; set; } = null!; + + /// + /// Gets or sets the index method. + /// + public string IndexMethod { get; set; } = null!; } } diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/LearningHubConfig.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/LearningHubConfig.cs index 9e2086ee3..6ccd4f37c 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/LearningHubConfig.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/LearningHubConfig.cs @@ -14,5 +14,46 @@ public class LearningHubConfig /// Gets or sets . /// public string LaunchResourceEndpoint { get; set; } = null!; + + /// + /// Gets or sets . + /// + public string ContentServerUrl { get; set; } = null!; + + /// + /// Gets or sets . + /// + public int EmailConfirmationTokenExpiryMinutes { get; set; } = 0; + + /// + /// Gets or sets . + /// + public int LearningHubTenantId { get; set; } = 0; + + /// + /// Gets or sets . + /// + public string SupportPages { get; set; } = null!; + + /// + /// Gets or sets . + /// + public string SupportForm { get; set; } = null!; + + /// + /// Gets or sets a value indicating whether . + /// + public bool UseRedisCache { get; set; } = false; + + /// + /// Gets or sets . + /// + public string HierarchyEditPublishQueueName { get; set; } = null!; + + /// + /// Gets or sets . + /// + public string ResourcePublishQueueRouteName { get; set; } = null!; + } } diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityInteractionAnswerRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityInteractionAnswerRepository.cs new file mode 100644 index 000000000..30a798b72 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityInteractionAnswerRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Activity +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Activity; + + /// + /// The AssessmentResourceActivityInteractionAnswer interface. + /// + public interface IAssessmentResourceActivityInteractionAnswerRepository : IGenericRepository + { + /// + /// Get Assessment Resource Activity Interaction Answer By Id. + /// + /// The id. + /// AssessmentResourceActivityInteractionAnswer. + Task GetByIdAsync(int id); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityInteractionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityInteractionRepository.cs new file mode 100644 index 000000000..5d9f8c175 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityInteractionRepository.cs @@ -0,0 +1,43 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Activity +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Activity; + + /// + /// The AssessmentResourceActivityInteraction interface. + /// + public interface IAssessmentResourceActivityInteractionRepository : IGenericRepository + { + /// + /// Get Assessment Resource Activity Interaction By Id. + /// + /// The id. + /// AssessmentResourceActivityInteraction. + Task GetByIdAsync(int id); + + /// + /// Get the assessment resource activity interaction for the given user, activity, and question block. + /// + /// The user id. + /// The assessment resource activity id. + /// The question block id. + /// AssessmentResourceActivityInteraction. + Task GetInteractionForQuestion(int userId, int assessmentResourceActivityId, int questionBlockId); + + /// + /// Creates an assessment activity interaction. + /// + /// The user id. + /// The interaction. + /// The task. + Task CreateInteraction(int userId, AssessmentResourceActivityInteraction interaction); + + /// + /// Gets all the interactions for a given assessment resource activity. + /// + /// The assessment resource activity id. + /// The list of interactions. + Task> GetInteractionsForAssessmentResourceActivity(int assessmentResourceActivityId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityMatchQuestionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityMatchQuestionRepository.cs new file mode 100644 index 000000000..e08ecf2f9 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityMatchQuestionRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Activity +{ + using System.Collections.Generic; + using LearningHub.Nhs.Models.Entities.Activity; + + /// + /// The IAssessmentResourceActivityMatchQuestionRepository interface. + /// + public interface IAssessmentResourceActivityMatchQuestionRepository : IGenericRepository + { + /// + /// Get Assessment Resource Activity by Assessment Resource Activity Id. + /// + /// The assessment resource activity id. + /// The Assessment Resource Activity. + IEnumerable GetByAssessmentResourceActivityIdAsync(int id); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityRepository.cs new file mode 100644 index 000000000..ae7e74153 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IAssessmentResourceActivityRepository.cs @@ -0,0 +1,26 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Activity +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Activity; + + /// + /// The AssessmentResourceActivity interface. + /// + public interface IAssessmentResourceActivityRepository : IGenericRepository + { + /// + /// Get Assessment Resource Activity By Id. + /// + /// The id. + /// AssessmentResourceActivity. + Task GetByIdAsync(int id); + + /// + /// Gets the latest assessment resource activity for the given resource version id and user id. + /// + /// The resource version id. + /// The user id. + /// The assessment resource activity task. + Task GetLatestAssessmentResourceActivity(int resourceVersionId, int userId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IMediaResourceActivityInteractionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IMediaResourceActivityInteractionRepository.cs new file mode 100644 index 000000000..29c4faa12 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IMediaResourceActivityInteractionRepository.cs @@ -0,0 +1,27 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Activity +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Activity; + + /// + /// The MediaResourceActivityInteraction interface. + /// + public interface IMediaResourceActivityInteractionRepository : IGenericRepository + { + /// + /// Get Media Resource Activity Interaction By Id. + /// + /// The id. + /// MediaResourceActivityInteraction. + Task GetByIdAsync(int id); + + /// + /// Performs the analysis of media resource activity to populate the played segment data. + /// + /// The user id. + /// The resource version id. + /// The mediaResourceActivityId. + /// The . + Task CalculatePlayedMediaSegments(int userId, int resourceVersionId, int mediaResourceActivityId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IMediaResourceActivityRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IMediaResourceActivityRepository.cs new file mode 100644 index 000000000..2dd227402 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IMediaResourceActivityRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Activity +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Activity; + + /// + /// The MediaResourceActivity interface. + /// + public interface IMediaResourceActivityRepository : IGenericRepository + { + /// + /// Get Media Resource Activity By Id. + /// + /// The id. + /// MediaResourceActivity. + Task GetByIdAsync(int id); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/INodeActivityRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/INodeActivityRepository.cs new file mode 100644 index 000000000..3c16ea9af --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/INodeActivityRepository.cs @@ -0,0 +1,14 @@ +// +// Copyright (c) NHS England. +// +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Activity +{ + using LearningHub.Nhs.Models.Entities.Activity; + + /// + /// INodeActivityRepository. + /// + public interface INodeActivityRepository : IGenericRepository + { + } +} \ No newline at end of file diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IResourceActivityRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IResourceActivityRepository.cs new file mode 100644 index 000000000..0c778605c --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IResourceActivityRepository.cs @@ -0,0 +1,108 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Activity +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Activity; + using LearningHub.Nhs.Models.Enums; + using LearningHub.Nhs.Models.MyLearning; + + /// + /// The ResourceActivity interface. + /// + public interface IResourceActivityRepository : IGenericRepository + { + /// + /// Get Resource Activity By Id. + /// + /// The id. + /// ResourceActivity. + Task GetByIdAsync(int id); + + /// + /// Create activity record against a ResourceVersion. + /// + /// The user id. + /// The resource version id. + /// The node path id. + /// The launch resource activity id. + /// The activity Status Enum. + /// The activity Start. + /// The activity End. + /// Activity Id. + int CreateActivity( + int userId, + int resourceVersionId, + int nodePathId, + int? launchResourceActivityId, + ActivityStatusEnum activityStatusEnum, + DateTimeOffset? activityStart, + DateTimeOffset? activityEnd); + + /// + /// Get Resource Activity By user id. + /// + /// The user id. + /// ResourceActivity. + IQueryable GetByUserId(int userId); + + /// + /// Gets a list of incomplete media activities. Those that for any reason, the end of the user's activity was not recorded normally. For example - browser crash, power loss, connection loss. + /// + /// The user id. + /// The . + Task> GetIncompleteMediaActivities(int userId); + + /// + /// Gets a list of all the user's activities for a given resource. + /// + /// The user id.> + /// The resource id. + /// The . + Task> GetAllTheActivitiesFor(int userId, int resourceId); + + /// + /// Check if scorm activity has been completed. + /// + /// The user id. + /// The scormActivityId id. + /// The . + Task IsScormActivityFinished(int userId, int scormActivityId); + + /// + /// Get Resource Activity By user id. + /// + /// The user id. + /// requestModel. + /// detailedMediaActivityRecordingStartDate. + /// ResourceActivity. + Task> GetByUserIdFromSP(int userId, Nhs.Models.MyLearning.MyLearningRequestModel requestModel, DateTimeOffset detailedMediaActivityRecordingStartDate); + + /// + /// Check if scorm activity has been completed. + /// + /// The user id. + /// requestModel. + /// detailedMediaActivityRecordingStartDate. + /// The . + int GetTotalCount(int userId, MyLearningRequestModel requestModel, DateTimeOffset detailedMediaActivityRecordingStartDate); + + /// + /// Gets a list of all the user's activities for a given resource. + /// + /// The user id.> + /// The resource id. + /// The . + Task> GetAllTheActivitiesFromSP(int userId, int resourceId); + + /// + /// Get the assessment activity completion details. + /// + /// The userId. + /// The resourceVersionId. + /// The activityId. + /// The . + Task GetAssessmentActivityCompletionPercentage(int userId, int resourceVersionId, int activityId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IScormActivityRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IScormActivityRepository.cs new file mode 100644 index 000000000..19757c6d8 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Activity/IScormActivityRepository.cs @@ -0,0 +1,66 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Activity +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Dto; + using LearningHub.Nhs.Models.Entities.Activity; + + /// + /// The Scorm Activity interface. + /// + public interface IScormActivityRepository : IGenericRepository + { + /// + /// Get Scorm Activity By Id. + /// + /// The id. + /// Scorm Activity. + Task GetByIdAsync(int id); + + /// + /// The create activity. + /// + /// The user id. + /// The resource version id. + /// Scorm Activity Id. + int Create(int userId, int resourceVersionId); + + /// + /// Complete scorm activity. + /// Returns the resource activity id of the completion event. + /// + /// The user id. + /// The scorm activity id. + /// Resource Activity Id. + int Complete(int userId, int scormActivityId); + + /// + /// Resolve scorm activity. + /// + /// The scorm activity id. + void Resolve(int scormActivityId); + + /// + /// Gets the previously launched incomplete scrom activity id. + /// + /// userId. + /// resourceReferenceId. + /// ScormActivitySummaryDto. + ScormActivitySummaryDto GetScormActivitySummary(int userId, int resourceReferenceId); + + /// + /// Clones the incomplete scrom activity session with the newly created session. + /// + /// incompleteScromActivityId. + /// scromActivityId. + /// ScormActivity. + ScormActivity Clone(int incompleteScromActivityId, int scromActivityId); + + /// + /// Check user scorm activity data suspend data need to be cleared. + /// + /// last scorm activity id. + /// resource version id. + /// boolean. + Task CheckUserScormActivitySuspendDataToBeCleared(int lastScormActivityId, int resourceVersionId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/ICatalogueAccessRequestRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/ICatalogueAccessRequestRepository.cs new file mode 100644 index 000000000..05fa86695 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/ICatalogueAccessRequestRepository.cs @@ -0,0 +1,46 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Hierarchy +{ + using System.Linq; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Hierarchy; + + /// + /// The ICatalogueAccessRequestRepository interface. + /// + public interface ICatalogueAccessRequestRepository : IGenericRepository + { + /// + /// The GetByUserIdAndCatalogueId. + /// + /// The catalogueId. + /// The userId. + /// The catalogueAccessRequest. + CatalogueAccessRequest GetByUserIdAndCatalogueId(int catalogueNodeId, int userId); + + /// + /// The GetAllByUserIdAndCatalogueId. + /// + /// The catalogueId. + /// The userId. + /// The catalogueAccessRequest. + IQueryable GetAllByUserIdAndCatalogueId(int catalogueNodeId, int userId); + + /// + /// The CreateCatalogueAccessRequestAsync. + /// + /// The currentUserId. + /// The reference. + /// The message. + /// The roleId. + /// The catalogueManageAccessUrl. + /// The accessType. + /// The task. + Task CreateCatalogueAccessRequestAsync( + int currentUserId, + string reference, + string message, + int roleId, + string catalogueManageAccessUrl, + string accessType); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/ICatalogueNodeVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/ICatalogueNodeVersionRepository.cs new file mode 100644 index 000000000..e1137c520 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/ICatalogueNodeVersionRepository.cs @@ -0,0 +1,141 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Hierarchy +{ + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Catalogue; + using LearningHub.Nhs.Models.Dashboard; + using LearningHub.Nhs.Models.Entities.Hierarchy; + + /// + /// The ICatalogueNodeVersionRepository. + /// + public interface ICatalogueNodeVersionRepository : IGenericRepository + { + /// + /// The get catalogues. + /// + /// The catalogue ids. + /// A representing the result of the asynchronous operation. + Task> GetCatalogues(List catalogueIds); + + /// + /// The get catalogues. + /// + /// The . + Task> GetPublishedCatalogues(); + + /// + /// The get catalogues for user. + /// + /// The userId. + /// The . + IQueryable GetPublishedCataloguesForUserAsync(int userId); + + /// + /// The get basic catalogue. + /// + /// The catalogueNodeId. + /// The . + CatalogueNodeVersion GetBasicCatalogue(int catalogueNodeId); + + /// + /// The UpdateCatalogueAsync. + /// + /// The userId. + /// The catalogue view model. + /// The task. + Task UpdateCatalogueAsync(int userId, CatalogueViewModel vm); + + /// + /// The UpdateCatalogueOwnerAsync. + /// + /// The userId. + /// The catalogue owner view model. + /// The task. + Task UpdateCatalogueOwnerAsync(int userId, CatalogueOwnerViewModel vm); + + /// + /// The CreateCatalogueAsync. + /// + /// The userId. + /// The catalogue view model. + /// The catalogueNodeVersionId. + Task CreateCatalogueAsync(int userId, CatalogueViewModel vm); + + /// + /// Get Catlogue by reference. + /// + /// The reference. + /// The CatalogueViewModel. + Task GetCatalogueAsync(string reference); + + /// + /// Get list of Restricted Catalogue AccessRequests for the supplied request. + /// + /// The restrictedCatalogueAccessRequestsRequestViewModel. + /// A RestrictedCatalogueAccessRequestsViewModel. + List GetRestrictedCatalogueAccessRequests(RestrictedCatalogueAccessRequestsRequestViewModel restrictedCatalogueAccessRequestsRequestViewModel); + + /// + /// Get list of RestrictedCatalogueUsersRequestViewModel for the supplied request. + /// + /// The restrictedCatalogueUsersRequestViewModel. + /// A RestrictedCatalogueUsersViewModel. + RestrictedCatalogueUsersViewModel GetRestrictedCatalogueUsers(RestrictedCatalogueUsersRequestViewModel restrictedCatalogueUsersRequestViewModel); + + /// + /// The ShowCatalogue. + /// + /// The UserId. + /// The NodeId. + /// The Task. + Task ShowCatalogue(int userId, int nodeId); + + /// + /// Get Restricted Catalogue Summary for the supplied catalogue node id. + /// + /// The catalogueNodeId. + /// A RestrictedCatalogueUsersViewModel. + RestrictedCatalogueSummaryViewModel GetRestrictedCatalogueSummary(int catalogueNodeId); + + /// + /// Gets catalogues for dashboard based on type. + /// + /// The dashboard type. + /// The page Number. + /// The userId. + /// Catalogue totals and records. + (int TotalCount, List Catalogues) GetCatalogues(string dashboardType, int pageNumber, int userId); + + /// + /// Check if a Catalogue with a specific name exists or not. + /// + /// The catalogue name. + /// True if the catalogue exists, otherwise false. + Task ExistsAsync(string name); + + /// + /// Gets the Node Id for a particular catalogue name. + /// + /// The catalogue name. + /// The catalogue's node id. + Task GetNodeIdByCatalogueName(string catalogueName); + + /// + /// Gets the catalogues count in alphabet list. + /// + /// The userId. + /// The catalogues alphabet count list. + List GetAllCataloguesAlphaCount(int userId); + + /// + /// Gets catalogues based on filter character. + /// + /// The pageSize. + /// The filterChar. + /// The userId. + /// The catalogues. + Task> GetAllCataloguesAsync(int pageSize, string filterChar, int userId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IFolderNodeVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IFolderNodeVersionRepository.cs new file mode 100644 index 000000000..2facce74e --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IFolderNodeVersionRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Hierarchy +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Hierarchy; + + /// + /// The IFolderNodeVersionRepository. + /// + public interface IFolderNodeVersionRepository : IGenericRepository + { + /// + /// The GetFolder. + /// + /// The node version id. + /// The folder node version. + Task GetFolderAsync(int nodeVersionId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IHierarchyEditDetailRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IHierarchyEditDetailRepository.cs new file mode 100644 index 000000000..ae8f37969 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IHierarchyEditDetailRepository.cs @@ -0,0 +1,19 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Hierarchy +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Hierarchy; + + /// + /// The HierarchyEditDetailRepository interface. + /// + public interface IHierarchyEditDetailRepository : IGenericRepository + { + /// + /// The get root hierarchy detail by hierarchy edit id async. + /// + /// The hierarchy edit id. + /// The node id. + /// The . + Task GetByNodeIdAsync(long hierarchyEditId, int nodeId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IHierarchyEditRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IHierarchyEditRepository.cs new file mode 100644 index 000000000..3337ab4e1 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IHierarchyEditRepository.cs @@ -0,0 +1,177 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Hierarchy +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Hierarchy; + using LearningHub.Nhs.Models.Hierarchy; + + /// + /// The HierarchyEditRepository interface. + /// + public interface IHierarchyEditRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by root node id async. + /// + /// The id. + /// The . + Task> GetByRootNodeIdAsync(int rootNodeId); + + /// + /// The create. + /// + /// The root node id. + /// The user id. + /// The hierarchy edit id. + Task Create(int rootNodeId, int userId); + + /// + /// The discard. + /// + /// The root node id. + /// The user id. + /// The . + Task Discard(int hierarchyEditId, int userId); + + /// + /// Creates a new folder. + /// + /// The folderEditViewModel. + /// The user id. + /// The . + Task CreateFolder(FolderEditViewModel folderEditViewModel, int userId); + + /// + /// Updates a folder. + /// + /// The folderEditViewModel. + /// The user id. + /// The . + Task UpdateFolder(FolderEditViewModel folderEditViewModel, int userId); + + /// + /// Deletes a folder. + /// + /// The id. + /// The user id. + /// The . + Task DeleteFolder(int hierarchyEditDetailId, int userId); + + /// + /// Moves a node up. + /// + /// The id. + /// The user id. + /// The . + Task MoveNodeUp(int hierarchyEditDetailId, int userId); + + /// + /// Moves a node down. + /// + /// The id. + /// The user id. + /// The . + Task MoveNodeDown(int hierarchyEditDetailId, int userId); + + /// + /// Moves a node. + /// + /// The moveNodeViewModel . + /// The user id. + /// The . + Task MoveNode(MoveNodeViewModel moveNodeViewModel, int userId); + + /// + /// Moves a resource up in a hierarchy edit. + /// + /// The id. + /// The user id. + /// The . + Task HierarchyEditMoveResourceUp(int hierarchyEditDetailId, int userId); + + /// + /// Moves a resource down in a hierarchy edit. + /// + /// The id. + /// The user id. + /// The . + Task HierarchyEditMoveResourceDown(int hierarchyEditDetailId, int userId); + + /// + /// Moves a resource in a HierarchyEdit. + /// + /// The view model . + /// The user id. + /// The . + Task HierarchyEditMoveResource(HierarchyEditMoveResourceViewModel moveResourceViewModel, int userId); + + /// + /// Moves a resource up. + /// ITERATION 1 - Not moved within a hierarchy edit, update happens immediately. + /// + /// The id of the node containing the resource. + /// The resource id. + /// The user id. + /// The . + Task MoveResourceUp(int nodeId, int resourceId, int userId); + + /// + /// Moves a resource down. + /// ITERATION 1 - Not moved within a hierarchy edit, update happens immediately. + /// + /// The id of the node containing the resource. + /// The resource id. + /// The user id. + /// The . + Task MoveResourceDown(int nodeId, int resourceId, int userId); + + /// + /// Moves a resource. + /// ITERATION 1 - Not moved within a hierarchy edit, update happens immediately. + /// + /// The id of the node to move the resource from. + /// The id of the node to move the resource to. + /// The resource id. + /// The user id. + /// A list of nodeIds affected by the moved resource. The nodes that will need to be refreshed in the UI. + Task> MoveResource(int sourceNodeId, int destinationNodeId, int resourceId, int userId); + + /// + /// The publishing. + /// + /// The hierarchy edit id. + /// The user id. + void SubmitForPublishing(int hierarchyEditId, int userId); + + /// + /// The publish. + /// + /// The hierarchy edit id. + /// The is major revision. + /// The notes. + /// The user id. + /// The publication id. + int Publish(int hierarchyEditId, bool isMajorRevision, string notes, int userId); + + /// + /// Set hierarchy edit to "publishing". + /// + /// The hierarchy edit id. + /// The user id. + void Publishing(int hierarchyEditId, int userId); + + /// + /// Set hierarchy edit to "failed to publish". + /// + /// The hierarchy edit id. + /// The user id. + void FailedToPublish(int hierarchyEditId, int userId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodePathRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodePathRepository.cs new file mode 100644 index 000000000..a24b8c6d3 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodePathRepository.cs @@ -0,0 +1,34 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Hierarchy +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Hierarchy; + using LearningHub.Nhs.Models.Hierarchy; + + /// + /// The INodePathRepository. + /// + public interface INodePathRepository : IGenericRepository + { + /// + /// Gets the root catalogue nodeId for any given nodeId (i.e. folder/course). + /// + /// The folder/course nodeId. + /// The catalogue nodeId. + Task GetCatalogueRootNodeId(int folderNodeId); + + /// + /// Gets the node paths to the supplied node id. + /// + /// The nodeId. + /// The list of NodePaths. + Task> GetNodePathsForNodeId(int nodeId); + + /// + /// Gets the basic details of all Nodes in a particular NodePath. + /// + /// The NodePath id. + /// The . + Task> GetNodePathNodes(int nodePathId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodeRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodeRepository.cs new file mode 100644 index 000000000..297be93f1 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodeRepository.cs @@ -0,0 +1,53 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Hierarchy +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Hierarchy; + using LearningHub.Nhs.Models.Hierarchy; + + /// + /// The NodeRepository interface. + /// + public interface INodeRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// Gets the basic details of a node. Currently catalogues or folders. + /// + /// The node id. + /// The node details. + Task GetNodeDetails(int nodeId); + + /// + /// Gets the contents of a node for the catalogue landing page - i.e. published folders and published resources only. + /// Only returns the items found directly in the specified node, does not recurse down through subfolders. + /// + /// The node id. + /// Include Empty Folder or not. + /// The . + Task> GetNodeContentsForCatalogueBrowse(int nodeId, bool includeEmptyFolder); + + /// + /// Gets the contents of a node for the My Contributions page - i.e. published folders only, and all resources (i.e. all statuses). + /// Only returns the items found directly in the specified node, does not recurse down through subfolders. + /// + /// The node id. + /// The . + Task> GetNodeContentsForCatalogueEditor(int nodeId); + + /// + /// Gets the contents of a node (catalogue/folder/course) - i.e. returns a list of subfolders and resources. Only returns the + /// items from the first level down. Doesn't recurse through subfolders. + /// + /// The node id. + /// Set to true if read only data set is required. + /// The . + Task> GetNodeContentsAdminAsync(int nodeId, bool readOnly); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodeResourceLookupRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodeResourceLookupRepository.cs new file mode 100644 index 000000000..733b1e7eb --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodeResourceLookupRepository.cs @@ -0,0 +1,19 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Hierarchy +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Hierarchy; + + /// + /// The INodeResourceLookupRepository interface. + /// + public interface INodeResourceLookupRepository : IGenericRepository + { + /// + /// The get by node id async. + /// + /// The node id. + /// The . + Task> GetByNodeIdAsync(int nodeId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodeResourceRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodeResourceRepository.cs new file mode 100644 index 000000000..dce087b47 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/INodeResourceRepository.cs @@ -0,0 +1,53 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Hierarchy +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Catalogue; + using LearningHub.Nhs.Models.Entities.Hierarchy; + using LearningHub.Nhs.Models.Enums; + using LearningHub.Nhs.Models.Hierarchy; + + /// + /// The NodeResourceRepository interface. + /// + public interface INodeResourceRepository : IGenericRepository + { + /// + /// The get by resource id async. + /// + /// The resource id. + /// The . + Task> GetByResourceIdAsync(int resourceId); + + /// + /// The get catalogue locations for resource. + /// + /// The resource id. + /// The CatalogueLocationViewModel list. + List GetCatalogueLocationsForResource(int resourceId); + + /// + /// GetResourcesAsync. + /// + /// nodeId. + /// catalogueOrder. + /// offset. + /// A representing the result of the asynchronous operation. + Task GetResourcesAsync(int nodeId, CatalogueOrder catalogueOrder, int offset); + + /// + /// Get All published resources id. + /// + /// The . + Task> GetAllPublishedResourceAsync(); + + /// + /// Creates or updates the NodeResource record for a draft resource in a node. + /// + /// The nodeId. + /// The resourceId. + /// The userId. + /// The . + Task CreateOrUpdateAsync(int nodeId, int resourceId, int userId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IPublicationRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IPublicationRepository.cs new file mode 100644 index 000000000..ee6743a0e --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Hierarchy/IPublicationRepository.cs @@ -0,0 +1,48 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Hierarchy +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Hierarchy; + using LearningHub.Nhs.Models.Hierarchy; + + /// + /// The PublicationRepository interface. + /// + public interface IPublicationRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by id. + /// + /// The id. + /// The . + Publication GetById(int id); + + /// + /// The get by resourceVersionId. + /// + /// The resourceVersionId. + /// The Publication. + Task GetByResourceVersionIdAsync(int resourceVersionId); + + /// + /// Get cache operations for the supplied publication id. + /// + /// The publicationId. + /// A list of . + Task> GetCacheOperations(int publicationId); + + /// + /// Get resource first publication record. + /// + /// resource id. + /// publish view model. + Task GetResourceFirstPublication(int resourceId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IBookmarkRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IBookmarkRepository.cs new file mode 100644 index 000000000..35fefbefe --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IBookmarkRepository.cs @@ -0,0 +1,26 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities; + + /// + /// The IRoadmapRepository. + /// + public interface IBookmarkRepository : IGenericRepository + { + /// + /// The GetById. + /// + /// The bookmarkId. + /// The . + Task GetById(int bookmarkId); + + /// + /// DeleteFolder. + /// + /// bookmarkId. + /// userId. + /// A representing the result of the asynchronous operation. + Task DeleteFolder(int bookmarkId, int userId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IEmailChangeValidationTokenRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IEmailChangeValidationTokenRepository.cs new file mode 100644 index 000000000..390f1c39a --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IEmailChangeValidationTokenRepository.cs @@ -0,0 +1,72 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities; + + /// + /// The EmailChangeValidationTokenRepository interface. + /// + public interface IEmailChangeValidationTokenRepository + { + /// + /// The get by token. + /// + /// + /// The lookup. + /// + /// + /// The . + /// + Task GetByToken(string lookup); + + /// + /// The GetLastIssuedEmailChangeValidationToken. + /// + /// + /// The lookup. + /// + /// + /// The . + /// + Task GetLastIssuedEmailChangeValidationToken(int userId); + + /// + /// The expire email change validation token. + /// + /// + /// The lookup. + /// + /// + /// The . + /// + Task ExpireEmailChangeValidationToken(string lookup); + + /// + /// The create async. + /// + /// + /// The user id. + /// + /// + /// The email change validation token. + /// + /// + /// The . + /// + Task CreateAsync(int userId, EmailChangeValidationToken emailChangeValidationToken); + + /// + /// The create async. + /// + /// + /// The user id. + /// + /// + /// The email change validation token. + /// + /// + /// The . + /// + Task UpdateAsync(int userId, EmailChangeValidationToken emailChangeValidationToken); + } +} \ No newline at end of file diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IGenericRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IGenericRepository.cs new file mode 100644 index 000000000..25969ea32 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IGenericRepository.cs @@ -0,0 +1,43 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories +{ + using System.Linq; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities; + + /// + /// The GenericRepository interface. + /// + /// Imput type. + public interface IGenericRepository + where TEntity : EntityBase + { + /// + /// The get all. + /// + /// The . + IQueryable GetAll(); + + /// + /// The create async. + /// + /// The user id. + /// The entity. + /// The . + Task CreateAsync(int userId, TEntity entity); + + /// + /// The update async. + /// + /// The user id. + /// The entity. + /// The . + Task UpdateAsync(int userId, TEntity entity); + + /// + /// The update. + /// + /// The user id. + /// The entity. + void Update(int userId, TEntity entity); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/INotificationTemplateRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/INotificationTemplateRepository.cs new file mode 100644 index 000000000..b434a2095 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/INotificationTemplateRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories +{ + using LearningHub.Nhs.Models.Entities; + using LearningHub.Nhs.Models.Enums; + + /// + /// The INotificationTemplateRepository interface. + /// + public interface INotificationTemplateRepository : IGenericRepository + { + /// + /// The GetById. + /// + /// The templateId. + /// The notification template. + NotificationTemplate GetById(NotificationTemplates templateId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IProviderRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IProviderRepository.cs new file mode 100644 index 000000000..3e3e5ed7d --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IProviderRepository.cs @@ -0,0 +1,48 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories +{ + using System.Linq; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities; + + /// + /// The ProviderRepository interface. + /// + public interface IProviderRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by id async. + /// + /// The id. + /// The include children. + /// The . + Task GetByIdAsync(int id, bool includeChildren); + + /// + /// The get by user id async. + /// + /// The user id. + /// The . + IQueryable GetProvidersByUserIdAsync(int userId); + + /// + /// The get by resource version id async. + /// + /// The resource version id. + /// The . + IQueryable GetProvidersByResourceIdAsync(int resourceVersionId); + + /// + /// The get by node version id async. + /// + /// The node version id. + /// The . + IQueryable GetProvidersByCatalogueIdAsync(int nodeVersionId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IResourceRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IResourceRepository.cs index 52b3dee08..1b9d45411 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IResourceRepository.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IResourceRepository.cs @@ -4,25 +4,26 @@ namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories using System.Threading.Tasks; using LearningHub.Nhs.Models.Entities.Activity; using LearningHub.Nhs.Models.Entities.Resource; + using LearningHub.Nhs.Models.Enums; /// /// Resource repository interface. /// - public interface IResourceRepository + public interface IResourceRepository : IGenericRepository { /// /// Gets resources from ids. /// /// . /// Resources with details. - public Task> GetResourcesFromIds(IEnumerable resourceIds); + Task> GetResourcesFromIds(IEnumerable resourceIds); /// /// Gets resource references by their original resource reference Ids. /// /// . /// Resource references. - public Task> GetResourceReferencesByOriginalResourceReferenceIds( + Task> GetResourceReferencesByOriginalResourceReferenceIds( IEnumerable originalResourceReferenceIds); /// @@ -37,6 +38,39 @@ public Task> GetResourceReferencesByOriginalResou /// GetAchievedCertificatedResourceIds /// /// . - public Task> GetAchievedCertificatedResourceIds(int currentUserId); + Task> GetAchievedCertificatedResourceIds(int currentUserId); + + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + + /// + /// Returns true if the user has any resources published. + /// + /// The user id. + /// If the user has any resources published. + Task UserHasPublishedResourcesAsync(int userId); + + /// + /// The create resource async. + /// + /// The resource type. + /// The title. + /// The description. + /// The user id. + /// The . + Task CreateResourceAsync(ResourceTypeEnum resourceType, string title, string description, int userId); + + /// + /// The get by resourve version id async. + /// + /// The resource version id. + /// The . + Task GetByResourceVersionIdAsync(int resourceVersionId); + } } diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IRoleUserGroupRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IRoleUserGroupRepository.cs new file mode 100644 index 000000000..7fd1426a1 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IRoleUserGroupRepository.cs @@ -0,0 +1,67 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities; + using LearningHub.Nhs.Models.User; + + /// + /// The IRoleUserGroupRepository interface. + /// + public interface IRoleUserGroupRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by catalogueNodeId async. + /// + /// The role id. + /// The userGroup id. + /// The scope id. + /// The . + Task GetByRoleIdUserGroupIdScopeIdAsync(int roleId, int userGroupId, int scopeId); + + /// + /// The get by role id and catalogue id. + /// + /// The role id. + /// The catalogue node id. + /// The . + Task> GetByRoleIdCatalogueId(int roleId, int catalogueNodeId); + + /// + /// The get by role id and catalogue id that has users. + /// + /// The role id. + /// The catalogue node id. + /// The . + Task> GetByRoleIdCatalogueIdWithUsers(int roleId, int catalogueNodeId); + + /// + /// Get list of RoleUserGroupViewModel for a supplied User Group. + /// + /// The userGroupId. + /// A list of RoleUserGroupViewModel. + Task> GetRoleUserGroupViewModelsByUserGroupId(int userGroupId); + + /// + /// Get list of RoleUserGroupViewModel for a supplied User Group. + /// + /// The userGroupId. + /// A list of RoleUserGroupViewModel. + Task> GetRoleUserGroupViewModelsByUserId(int userId); + + /// + /// The get all for search. + /// + /// The catalogueNodeId. + /// The userId. + /// The . + Task> GetAllforSearch(int catalogueNodeId, int userId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/ITimezoneOffsetManager.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/ITimezoneOffsetManager.cs new file mode 100644 index 000000000..15f4b8bf1 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/ITimezoneOffsetManager.cs @@ -0,0 +1,22 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories +{ + using System; + + /// + /// The TimezoneOffsetManager interface. + /// + public interface ITimezoneOffsetManager + { + /// + /// Gets User Timezone Offset. + /// + int? UserTimezoneOffset { get; } + + /// + /// Converts a UTC DateTimeOffset to the timezone of the current user. + /// + /// The UTC DateTimeOffset to convert. + /// . + DateTimeOffset ConvertToUserTimezone(DateTimeOffset utcDate); + } +} \ No newline at end of file diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IUserProfileRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IUserProfileRepository.cs new file mode 100644 index 000000000..1611e99b3 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IUserProfileRepository.cs @@ -0,0 +1,32 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities; + + /// + /// The UserProfileRepository interface. + /// + public interface IUserProfileRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The GetByEmailAddressAsync. + /// + /// The email address. + /// The userProfile. + Task GetByEmailAddressAsync(string emailAddress); + + /// + /// The GetByUsernameAsync. + /// + /// The userName. + /// The userProfile. + Task GetByUsernameAsync(string userName); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IUserRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IUserRepository.cs new file mode 100644 index 000000000..ff8b6cb5b --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IUserRepository.cs @@ -0,0 +1,40 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities; + + /// + /// The UserRepository interface. + /// + public interface IUserRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by id include roles async. + /// + /// The id. + /// The . + Task GetByIdIncludeRolesAsync(int id); + + /// + /// The get by username async. + /// + /// The username. + /// The include roles. + /// The . + Task GetByUsernameAsync(string username, bool includeRoles); + + /// + /// Returns indication of whether the user in an Admin. + /// + /// The user id. + /// The . + bool IsAdminUser(int userId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IUserUserGroupRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IUserUserGroupRepository.cs new file mode 100644 index 000000000..ee39c0e79 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/IUserUserGroupRepository.cs @@ -0,0 +1,26 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities; + + /// + /// The UserUserGroupRepository interface. + /// + public interface IUserUserGroupRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// to get the user user group details by user id and usergroup id. + /// + /// userId. + /// userGroupId. + /// The . + Task GetByUserIdandUserGroupIdAsync(int userId, int userGroupId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Maintenance/IInternalSystemRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Maintenance/IInternalSystemRepository.cs new file mode 100644 index 000000000..e5b4b6304 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Maintenance/IInternalSystemRepository.cs @@ -0,0 +1,11 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Maintenance +{ + using LearningHub.Nhs.Models.Entities.Maintenance; + + /// + /// The InternalSystemRepository. + /// + public interface IInternalSystemRepository : IGenericRepository + { + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Messaging/IEmailTemplateRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Messaging/IEmailTemplateRepository.cs new file mode 100644 index 000000000..2ea140c2d --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Messaging/IEmailTemplateRepository.cs @@ -0,0 +1,17 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Messaging +{ + using LearningHub.Nhs.Models.Entities.Messaging; + + /// + /// The IEmailTemplateRepository. + /// + public interface IEmailTemplateRepository + { + /// + /// The GetTemplate. + /// + /// The email template id. + /// The Email Template. + EmailTemplate GetTemplate(int id); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Messaging/IMessageRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Messaging/IMessageRepository.cs new file mode 100644 index 000000000..67ed87b2a --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Messaging/IMessageRepository.cs @@ -0,0 +1,78 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Messaging +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Messaging; + + /// + /// The IMessageRepository class. + /// + public interface IMessageRepository + { + /// + /// Gets a list of all messages which have a message send which hasn't been sent. + /// + /// The messages. + IQueryable GetPendingMessages(); + + /// + /// Creates an email to be sent. + /// + /// The user id. + /// The subject. + /// The body. + /// The recipient user id. + /// The task. + Task CreateEmailAsync(int userId, string subject, string body, int recipientUserId); + + /// + /// The CreateEmailAsync. + /// + /// The user id. + /// The subject. + /// The body. + /// The recipientEmailAddress. + /// The task. + Task CreateEmailAsync(int userId, string subject, string body, string recipientEmailAddress); + + /// + /// The CreateNotificationForUserAsync. + /// + /// The userId. + /// The subject. + /// The body. + /// The recipientUserId. + /// The notificationStartDate. + /// The notificationEndDate. + /// The notificationPriority. + /// The notificationType. + /// The task. + Task CreateNotificationForUserAsync( + int userId, + string subject, + string body, + int recipientUserId, + DateTimeOffset notificationStartDate, + DateTimeOffset notificationEndDate, + int notificationPriority, + int notificationType); + + /// + /// Marks a message send as having been successful. + /// + /// The userId. + /// The messageSends. + /// The task. + Task MessageSendSuccess(int userId, List messageSends); + + /// + /// Either marks a message as failed, or queues it for a retry. + /// + /// The userId. + /// The messageSends. + /// The task. + Task MessageSendFailure(int userId, List messageSends); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Migrations/IMigrationSourceRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Migrations/IMigrationSourceRepository.cs new file mode 100644 index 000000000..f12fe6179 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Migrations/IMigrationSourceRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Migrations +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Migration; + + /// + /// The MigrationSourceRepository interface. + /// + public interface IMigrationSourceRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IArticleResourceVersionFileRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IArticleResourceVersionFileRepository.cs new file mode 100644 index 000000000..6907ae321 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IArticleResourceVersionFileRepository.cs @@ -0,0 +1,26 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The ArticleResourceVersionFileRepository interface. + /// + public interface IArticleResourceVersionFileRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by id async. + /// + /// The resourceVersionId. + /// The fileId. + /// The . + Task GetByResourceVersionAndFileAsync(int resourceVersionId, int fileId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IArticleResourceVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IArticleResourceVersionRepository.cs new file mode 100644 index 000000000..048fe9f4d --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IArticleResourceVersionRepository.cs @@ -0,0 +1,26 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The ArticleResourceVersionRepository interface. + /// + public interface IArticleResourceVersionRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by resource version id async. + /// + /// The id. + /// Allows deleted items to be returned. + /// The . + Task GetByResourceVersionIdAsync(int id, bool includeDeleted = false); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IAssessmentResourceVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IAssessmentResourceVersionRepository.cs new file mode 100644 index 000000000..028800c44 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IAssessmentResourceVersionRepository.cs @@ -0,0 +1,25 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The AssessmentResourceVersionRepository interface. + /// + public interface IAssessmentResourceVersionRepository : IGenericRepository + { + /// + /// The get by Assessment Version Id async. + /// + /// The Assessment Version Id. + /// The . + Task GetByResourceVersionIdAsync(int assessmentVersionId); + + /// + /// The get by Assessment Content Id async. + /// + /// The Assessment Content Id. + /// The . + Task GetByAssessmentContentBlockCollectionIdAsync(int assessmentContentId); + } +} \ No newline at end of file diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IAudioResourceVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IAudioResourceVersionRepository.cs new file mode 100644 index 000000000..9d1690217 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IAudioResourceVersionRepository.cs @@ -0,0 +1,26 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The AudioResourceVersionRepository interface. + /// + public interface IAudioResourceVersionRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by resource version id async. + /// + /// The id. + /// Allows deleted items to be returned. + /// The . + Task GetByResourceVersionIdAsync(int id, bool includeDeleted = false); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IBlockCollectionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IBlockCollectionRepository.cs new file mode 100644 index 000000000..cadadd20b --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IBlockCollectionRepository.cs @@ -0,0 +1,43 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource.Blocks; + using LearningHub.Nhs.Models.Enums; + + /// + /// The BlockRepository interface. + /// + public interface IBlockCollectionRepository : IGenericRepository + { + /// + /// Delete the Block Collection. + /// + /// The User Id. + /// The Block Collection Id. + /// The . + Task DeleteBlockCollection(int userId, int blockCollectionId); + + /// + /// Gets the Block Collection. + /// + /// The Block Collection Id. + /// The . + Task GetBlockCollection(int? blockCollectionId); + + /// + /// Gets the Question blocks for a particular blockCollectionId. + /// + /// The Block Collection Id. + /// The . + Task> GetQuestionBlocks(int blockCollectionId); + + /// + /// Gets the Case, AssessmentContent, AssessmentGuidance Block Collections (including child Blocks, TextBlocks, WholeSlideImageBlocks and Files) except that of the provided resource version. + /// + /// The excluded ResourceVersion Id. + /// The resource type. + /// The . + Task GetResourceBlockCollectionsFileAsync(int excludeResourceVersionId, ResourceTypeEnum resourceTypeEnum); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/ICaseResourceVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/ICaseResourceVersionRepository.cs new file mode 100644 index 000000000..af9c600bc --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/ICaseResourceVersionRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The CaseResourceVersionRepository interface. + /// + public interface ICaseResourceVersionRepository : IGenericRepository + { + /// + /// The get by Resource Version Id async. + /// + /// The Resource Version Id. + /// The . + Task GetByResourceVersionIdAsync(int resourceVersionId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IEmbeddedResourceVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IEmbeddedResourceVersionRepository.cs new file mode 100644 index 000000000..b35680f24 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IEmbeddedResourceVersionRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The EmbeddedResourceVersionRepository interface. + /// + public interface IEmbeddedResourceVersionRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IEquipmentResourceVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IEquipmentResourceVersionRepository.cs new file mode 100644 index 000000000..1f9807c7c --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IEquipmentResourceVersionRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The EquipmentResourceVersionRepository interface. + /// + public interface IEquipmentResourceVersionRepository : IGenericRepository + { + /// + /// The get by resource version id async. + /// + /// The id. + /// The . + Task GetByResourceVersionIdAsync(int id); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IFileChunkDetailRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IFileChunkDetailRepository.cs new file mode 100644 index 000000000..4f6b7dea4 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IFileChunkDetailRepository.cs @@ -0,0 +1,26 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The FileChunkDetailRepository interface. + /// + public interface IFileChunkDetailRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// Delete a file chunk detail. + /// + /// The file Chunk Detail id. + /// The user id. + /// The . + Task Delete(int fileChunkDetailId, int userId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IFileRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IFileRepository.cs new file mode 100644 index 000000000..7baf4ed9d --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IFileRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The FileRepository interface. + /// + public interface IFileRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IFileTypeRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IFileTypeRepository.cs new file mode 100644 index 000000000..33ca0ec23 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IFileTypeRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The FileTypeRepository interface. + /// + public interface IFileTypeRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IGenericFileResourceVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IGenericFileResourceVersionRepository.cs new file mode 100644 index 000000000..28eabdede --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IGenericFileResourceVersionRepository.cs @@ -0,0 +1,34 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The GenericFileResourceVersionRepository interface. + /// + public interface IGenericFileResourceVersionRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by resource version id async. + /// + /// The id. + /// Allows deleted items to be returned. + /// The . + Task GetByResourceVersionIdAsync(int id, bool includeDeleted = false); + + /// + /// The get by resource version id. + /// + /// The id. + /// Allows deleted items to be returned. + /// The generic file resource version. + GenericFileResourceVersion GetByResourceVersionId(int id, bool includeDeleted = false); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IHtmlResourceVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IHtmlResourceVersionRepository.cs new file mode 100644 index 000000000..3def3f0b9 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IHtmlResourceVersionRepository.cs @@ -0,0 +1,34 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The GenericFileResourceVersionRepository interface. + /// + public interface IHtmlResourceVersionRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by resource version id async. + /// + /// The id. + /// Allows deleted items to be returned. + /// The . + Task GetByResourceVersionIdAsync(int id, bool includeDeleted = false); + + /// + /// The get by resource version id. + /// + /// The id. + /// Allows deleted items to be returned. + /// The html resource version. + HtmlResourceVersion GetByResourceVersionId(int id, bool includeDeleted = false); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IImageResourceVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IImageResourceVersionRepository.cs new file mode 100644 index 000000000..1a2af621e --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IImageResourceVersionRepository.cs @@ -0,0 +1,26 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The ImageResourceVersionRepository interface. + /// + public interface IImageResourceVersionRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by resource version id async. + /// + /// The id. + /// Allows deleted items to be returned. + /// The . + Task GetByResourceVersionIdAsync(int id, bool includeDeleted = false); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IQuestionBlockRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IQuestionBlockRepository.cs new file mode 100644 index 000000000..ea88cc732 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IQuestionBlockRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource.Blocks; + + /// + /// The QuestionBlockRepository interface. + /// + public interface IQuestionBlockRepository : IGenericRepository + { + /// + /// The get by Block Collection Id async. + /// + /// The block collection Id. + /// The . + Task GetByQuestionBlockCollectionIdAsync(int blockCollectionId); + } +} \ No newline at end of file diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceLicenceRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceLicenceRepository.cs new file mode 100644 index 000000000..876227b27 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceLicenceRepository.cs @@ -0,0 +1,11 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The FileTypeRepository interface. + /// + public interface IResourceLicenceRepository : IGenericRepository + { + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceReferenceRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceReferenceRepository.cs new file mode 100644 index 000000000..2042a5c9a --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceReferenceRepository.cs @@ -0,0 +1,34 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The ResourceReferenceRepository interface. + /// + public interface IResourceReferenceRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The include NodePath. + /// The . + Task GetByIdAsync(int id, bool includeNodePath); + + /// + /// The get by original resource reference id async. + /// + /// The id. + /// The include NodePath. + /// The . + Task GetByOriginalResourceReferenceIdAsync(int id, bool includeNodePath); + + /// + /// The get default by resource id async. + /// + /// The resource id. + /// The . + Task GetDefaultByResourceIdAsync(int resourceId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionAuthorRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionAuthorRepository.cs new file mode 100644 index 000000000..e96c4cf09 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionAuthorRepository.cs @@ -0,0 +1,27 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The ResourceVersionAuthorRepository interface. + /// + public interface IResourceVersionAuthorRepository : IGenericRepository + { + /// + /// The delete async. + /// + /// The user id. + /// The resource version author id. + /// The . + Task DeleteAsync(int userId, int resourceVersionAuthorId); + + /// + /// The delete async. + /// + /// The resource version id. + /// The author id. + /// The . + Task GetByResourceVersionAndAuthorAsync(int resourceVersionId, int authorId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionFlagRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionFlagRepository.cs new file mode 100644 index 000000000..ba4876732 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionFlagRepository.cs @@ -0,0 +1,36 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Linq; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + using LearningHub.Nhs.Models.Validation; + + /// + /// The ResourceVersionFlagRepository interface. + /// + public interface IResourceVersionFlagRepository : IGenericRepository + { + /// + /// The get by resource version id async. + /// + /// The resource version id. + /// The . + IQueryable GetByResourceVersionIdAsync(int resourceVersionId); + + /// + /// The update resource version flag async. + /// + /// The user id. + /// The resource version flag. + /// The . + Task UpdateResourceVersionFlagAsync(int userId, ResourceVersionFlag resourceVersionFlag); + + /// + /// The delete async. + /// + /// The user id. + /// The resource version flag id. + /// The . + Task DeleteAsync(int userId, int resourceVersionFlagId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionKeywordRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionKeywordRepository.cs new file mode 100644 index 000000000..78127d86f --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionKeywordRepository.cs @@ -0,0 +1,35 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The ResourceVersionKeywordRepository interface. + /// + public interface IResourceVersionKeywordRepository : IGenericRepository + { + /// + /// The delete async. + /// + /// The user id. + /// The resource version keyword id. + /// The . + Task DeleteAsync(int userId, int resourceVersionKeywordId); + + /// + /// The delete async. + /// + /// The resource version id. + /// The keyword id. + /// The . + Task GetByResourceVersionAndKeywordAsync(int resourceVersionId, int keywordId); + + /// + /// Check if a specific keyword exists for the Resource Version. + /// + /// The resource version id. + /// The keyword. + /// The . + Task DoesResourceVersionKeywordAlreadyExistAsync(int resourceVersionId, string keyword); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionProviderRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionProviderRepository.cs new file mode 100644 index 000000000..6a1bb065b --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionProviderRepository.cs @@ -0,0 +1,28 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The ResourceVersionEventRepository interface. + /// + public interface IResourceVersionProviderRepository : IGenericRepository + { + /// + /// Delete resource version provider. + /// + /// resource version id. + /// provider id. + /// user id. + /// The . + Task DeleteAsync(int resourceVersionId, int providerId, int userId); + + /// + /// Delete all resource version provider. + /// + /// resource version id. + /// user id. + /// The . + Task DeleteAllAsync(int resourceVersionId, int userId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionRepository.cs new file mode 100644 index 000000000..b2e296682 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionRepository.cs @@ -0,0 +1,303 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Dashboard; + using LearningHub.Nhs.Models.Entities.Resource; + using LearningHub.Nhs.Models.Enums; + using LearningHub.Nhs.Models.Resource; + using LearningHub.Nhs.Models.Resource.ResourceDisplay; + + /// + /// The ResourceVersionRepository interface. + /// + public interface IResourceVersionRepository : IGenericRepository + { + /// + /// The get all admin search. + /// + /// The userId. + /// The . + IQueryable GetAllAdminSearch(int userId); + + /// + /// The get by id async. + /// + /// The id. + /// The include events. + /// The . + Task GetByIdAsync(int id, bool includeEvents); + + /// + /// The get basic by id async. + /// + /// The id. + /// The . + Task GetBasicByIdAsync(int id); + + /// + /// The contribution totals. + /// + /// The user id. + /// The catalogue id. + /// The MyContributionsTotalsViewModel. + MyContributionsTotalsViewModel GetMyContributionTotals(int userId, int catalogueId); + + /// + /// Get resource cards. + /// + /// The include events. + /// The . + Task> GetResourceCards(bool includeEvents); + + /// + /// The get current for resource async. + /// + /// The resource Id. + /// The . + Task GetCurrentForResourceAsync(int resourceId); + + /// + /// The get current resource for resourceid async. + /// + /// The resource Id. + /// The . + Task GetCurrentResourceDetailsAsync(int resourceId); + + /// + /// The get resource version details by id async. + /// + /// The resourceVersionId. + /// The . + Task GetByResourceVersionByIdAsync(int resourceVersionId); + + /// + /// The check dev id already exists in the table async. + /// + /// The devId. + /// The . + Task DoesDevIdExistsAync(string devId); + + /// + /// The get current published for resource async. + /// + /// The resource id. + /// The . + Task GetCurrentPublicationForResourceAsync(int resourceId); + + /// + /// The get current for resource reference id async. + /// + /// The resource reference id. + /// The . + Task GetCurrentForResourceReferenceIdAsync(int resourceReferenceId); + + /// + /// The get current resource for resource reference id async. + /// + /// The resource reference id. + /// The . + Task GetCurrentResourceForResourceReferenceIdAsync(int resourceReferenceId); + + /// + /// The get current published for resource reference id async. + /// + /// The resource reference id. + /// The . + Task GetCurrentPublicationForResourceReferenceIdAsync(int resourceReferenceId); + + /// + /// The set resource type. + /// + /// The resource version id. + /// The resource type enum. + /// The user id. + void SetResourceType(int resourceVersionId, ResourceTypeEnum resourceTypeEnum, int userId); + + /// + /// Gets the resource type of a ResourceVersion. + /// + /// The resourceVersionId. + /// The . + Task GetResourceType(int resourceVersionId); + + /// + /// The publish. + /// + /// The resource version id. + /// The is major revision. + /// The notes. + /// The publication date. Set to null if not giving the resource a publication date in the past. This parameter is intended for use by the migration tool. + /// The user id. + /// The publication id. + int Publish(int resourceVersionId, bool isMajorRevision, string notes, DateTimeOffset? publicationDate, int userId); + + /// + /// The unpublish. + /// + /// The resource version id. + /// The details. + /// The user id. + void Unpublish(int resourceVersionId, string details, int userId); + + /// + /// The revert to draft. + /// + /// The resource version id. + /// The user id. + void RevertToDraft(int resourceVersionId, int userId); + + /// + /// Delete a resource version. + /// + /// The resource version id. + /// The user id. + void Delete(int resourceVersionId, int userId); + + /// + /// The get resource versions. + /// + /// The resource id. + /// The . + Task> GetResourceVersionsAsync(int resourceId); + + ///// + ///// The create activity. + ///// + ///// + ///// The user id. + ///// + ///// + ///// The resource version id. + ///// + ///// + ///// The activity status enum. + ///// + ///// + ///// The activity start. + ///// + ///// + ///// The activity end. + ///// + ////void CreateActivity( + // int userId, + // int resourceVersionId, + // ActivityStatusEnum activityStatusEnum, + // DateTimeOffset activityStart, + // DateTimeOffset activityEnd); + + /// + /// Check if a user has completed the activity corresponding to the resource version. + /// + /// The user id. + /// The resource version id. + /// A boolean. + Task HasUserCompletedActivity(int userId, int resourceVersionId); + + /// + /// Return whether a version at a specific status currently exists. + /// + /// The resource id. + /// The resource version status id. + /// Whether the resource version exists or not. + Task DoesVersionExist(int resourceId, VersionStatusEnum draft); + + /// + /// Return whether a version at a specific status currently exists. + /// + /// The resource id. + /// The user id. + /// Returns the new resource version id. + Task CreateNextVersionAsync(int resourceId, int userId); + + /// + /// Duplicates a resource version. + /// + /// The resource id. + /// The user id. + /// Returns the new resource version id. + Task CreateDuplicateVersionAsync(int resourceId, int userId); + + /// + /// The publishing. + /// + /// The resource version id. + /// The user id. + void Publishing(int resourceVersionId, int userId); + + /// + /// "Failed to publish". + /// + /// The resource version id. + /// The user id. + void FailedToPublish(int resourceVersionId, int userId); + + /// + /// The submit publishing. + /// + /// The resource version id. + /// The user id. + void SubmitForPublishing(int resourceVersionId, int userId); + + /// + /// Create resource version event. + /// + /// resourceVersionId. + /// resourceVersionEventType. + /// details. + /// user id. + void CreateResourceVersionEvent(int resourceVersionId, ResourceVersionEventTypeEnum resourceVersionEventType, string details, int userId); + + /// + /// Get Contributions. + /// + /// The userId. + /// The ResourceContributionsRequestViewModel. + /// A list of contributed resources. + List GetContributions(int userId, ResourceContributionsRequestViewModel resourceContributionsRequestViewModel); + + /// + /// The GetResourceVersionForIdList. + /// + /// List of resource version ids. + /// The resource version list. + Task> GetResourceVersionsForSearchSubmission(List resourceVersionIds); + + /// + /// Gets resources for dashboard based on type. + /// + /// The dashboard type. + /// The page Number. + /// The userId. + /// resources. + (int resourceCount, List resources) GetResources(string dashboardType, int pageNumber, int userId); + + /// + /// Copy the blocks from source to destination. + /// + /// The user id. + /// The source block collection id. + /// The destination block collection id. + /// The blocks to be duplicated. + /// The . + Task FractionalDuplication(int userId, int sourceBlockCollectionId, int destinationBlockCollectionId, List blocks); + + /// + /// Gets external content details. + /// + /// resourceVersionId. + /// userId. + /// A representing the result of the asynchronous operation. + Task GetExternalContentDetails(int resourceVersionId, int userId); + + /// + /// To update dev id details. + /// + /// The userId. + /// The resourceVersionDevIdViewModel. + /// The . + Task UpdateDevIdAsync(int userId, ResourceVersionDevIdViewModel resourceVersionDevIdViewModel); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionUserAcceptanceRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionUserAcceptanceRepository.cs new file mode 100644 index 000000000..4b0c1bc5a --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionUserAcceptanceRepository.cs @@ -0,0 +1,11 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The ResourceVersionUserAcceptanceRepository interface. + /// + public interface IResourceVersionUserAcceptanceRepository : IGenericRepository + { + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionValidationResultRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionValidationResultRepository.cs new file mode 100644 index 000000000..202df4ce1 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IResourceVersionValidationResultRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + + /// + /// The IResourceVersionValidationResultRepository interface. + /// + public interface IResourceVersionValidationResultRepository : IGenericRepository + { + /// + /// The GetByResourceVersionIdAsync. + /// + /// The resourceVersionId. + /// ResourceVersionValidationResult. + Task GetByResourceVersionIdAsync(int resourceVersionId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IScormResourceVersionRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IScormResourceVersionRepository.cs new file mode 100644 index 000000000..2fefbe739 --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IScormResourceVersionRepository.cs @@ -0,0 +1,50 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource; + using LearningHub.Nhs.Models.Resource; + + /// + /// The ScormResourceVersionRepository interface. + /// + public interface IScormResourceVersionRepository : IGenericRepository + { + /// + /// The get by id async. + /// + /// The id. + /// The . + Task GetByIdAsync(int id); + + /// + /// The get by resource version id async. + /// + /// The id. + /// The includeDeleted. + /// The . + Task GetByResourceVersionIdAsync(int id, bool includeDeleted = false); + + /// + /// Gets the content details for a particular Learning Hub external reference (guid). + /// + /// The external reference (guid). + /// A ContentServerViewModel. + Task GetContentServerDetailsByLHExternalReference(string externalReference); + + /// + /// Gets the SCORM content details for a particular historic external URL. These historic URLs have to be supported to + /// allow historic ESR links on migrated resources to continue to work. + /// + /// The external Url. + /// A ContentServerViewModel. + Task GetScormContentServerDetailsByHistoricExternalUrl(string externalUrl); + + /// + /// GetExternalReferenceByResourceId. + /// + /// Resource id. + /// External Reference. + Task> GetExternalReferenceByResourceId(int resourceId); + } +} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IVideoRepository.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IVideoRepository.cs new file mode 100644 index 000000000..26ebf43ad --- /dev/null +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/Repositories/Resources/IVideoRepository.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.OpenApi.Repositories.Interface.Repositories.Resources +{ + using System.Threading.Tasks; + using LearningHub.Nhs.Models.Entities.Resource.Blocks; + + /// + /// The video repository interface. + /// + public interface IVideoRepository : IGenericRepository