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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@
<PackageReference Include="NLog.Web.AspNetCore" Version="4.15.0" />
</ItemGroup>

<ItemGroup>
<Folder Include="Services\Findwise\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public class CatalogueService : ICatalogueService
private readonly IBookmarkRepository bookmarkRepository;
private readonly INodeRepository nodeRepository;
private readonly INodeActivityRepository nodeActivityRepository;
private readonly IFindwiseApiFacade findwiseApiFacade;
private readonly LearningHubConfig learningHubConfig;
private readonly FindwiseConfig findwiseConfig;
private readonly INotificationSenderService notificationSenderService;
Expand All @@ -78,8 +77,7 @@ public class CatalogueService : ICatalogueService
/// <param name="emailSenderService"></param>
/// <param name="bookmarkRepository"></param>
/// <param name="nodeActivityRepository"></param>
/// <param name="findwiseApiFacade"></param>
public CatalogueService(ICatalogueRepository catalogueRepository, ICategoryService categoryService, INodeRepository nodeRepository, IUserUserGroupRepository userUserGroupRepository, IMapper mapper, IOptions<FindwiseConfig> findwiseConfig, IOptions<LearningHubConfig> learningHubConfig, ICatalogueNodeVersionRepository catalogueNodeVersionRepository, INodeResourceRepository nodeResourceRepository, IResourceVersionRepository resourceVersionRepository, IRoleUserGroupRepository roleUserGroupRepository, IProviderService providerService, ICatalogueAccessRequestRepository catalogueAccessRequestRepository, IUserRepository userRepository, IUserProfileRepository userProfileRepository, IEmailSenderService emailSenderService, IBookmarkRepository bookmarkRepository,INodeActivityRepository nodeActivityRepository, IFindwiseApiFacade findwiseApiFacade, INotificationSenderService notificationSenderService, ITimezoneOffsetManager timezoneOffsetManager)
public CatalogueService(ICatalogueRepository catalogueRepository, ICategoryService categoryService, INodeRepository nodeRepository, IUserUserGroupRepository userUserGroupRepository, IMapper mapper, IOptions<FindwiseConfig> findwiseConfig, IOptions<LearningHubConfig> learningHubConfig, ICatalogueNodeVersionRepository catalogueNodeVersionRepository, INodeResourceRepository nodeResourceRepository, IResourceVersionRepository resourceVersionRepository, IRoleUserGroupRepository roleUserGroupRepository, IProviderService providerService, ICatalogueAccessRequestRepository catalogueAccessRequestRepository, IUserRepository userRepository, IUserProfileRepository userProfileRepository, IEmailSenderService emailSenderService, IBookmarkRepository bookmarkRepository,INodeActivityRepository nodeActivityRepository, INotificationSenderService notificationSenderService, ITimezoneOffsetManager timezoneOffsetManager)
{
this.catalogueRepository = catalogueRepository;
this.categoryService = categoryService;
Expand All @@ -97,7 +95,6 @@ public CatalogueService(ICatalogueRepository catalogueRepository, ICategoryServi
this.emailSenderService = emailSenderService;
this.bookmarkRepository = bookmarkRepository;
this.nodeActivityRepository = nodeActivityRepository;
this.findwiseApiFacade = findwiseApiFacade;
this.learningHubConfig = learningHubConfig.Value;
this.findwiseConfig = findwiseConfig.Value;
this.timezoneOffsetManager = timezoneOffsetManager;
Expand Down Expand Up @@ -575,24 +572,6 @@ public async Task<LearningHubValidationResult> CreateCatalogueAsync(int userId,

var catalogueNodeVersionId = await this.catalogueNodeVersionRepository.CreateCatalogueAsync(userId, catalogue);

// Catalogue is in database, push to findwise
var cnv = this.catalogueNodeVersionRepository.GetAll()
.Include(x => x.NodeVersion).ThenInclude(x => x.Node)
.Include(x => x.Keywords)
.Include(x => x.CatalogueNodeVersionProvider)
.SingleOrDefault(x => x.Id == catalogueNodeVersionId);

if (cnv != null)
{
var searchModel = this.mapper.Map<SearchCatalogueRequestModel>(cnv);
if (searchModel.Description.Length > this.findwiseConfig.DescriptionLengthLimit)
{
searchModel.Description = searchModel.Description.Substring(0, this.findwiseConfig.DescriptionLengthLimit - 4) + "</p>";
}

await this.findwiseApiFacade.AddOrReplaceAsync(new List<SearchCatalogueRequestModel> { searchModel });
}

return new LearningHubValidationResult(true)
{
CreatedId = catalogueNodeVersionId,
Expand Down Expand Up @@ -809,24 +788,6 @@ public async Task<LearningHubValidationResult> UpdateCatalogueAsync(int userId,

await this.catalogueNodeVersionRepository.UpdateCatalogueAsync(userId, catalogue);

// Update catalogue in findwise
var cnv = this.catalogueNodeVersionRepository.GetAll()
.Include(x => x.NodeVersion).ThenInclude(x => x.Node)
.Include(x => x.Keywords)
.Include(x => x.CatalogueNodeVersionProvider)
.SingleOrDefault(x => x.Id == catalogue.CatalogueNodeVersionId);

if (cnv != null)
{
var searchModel = this.mapper.Map<SearchCatalogueRequestModel>(cnv);
if (searchModel.Description.Length > this.findwiseConfig.DescriptionLengthLimit)
{
searchModel.Description = searchModel.Description.Substring(0, this.findwiseConfig.DescriptionLengthLimit - 4) + "</p>";
}

await this.findwiseApiFacade.AddOrReplaceAsync(new List<SearchCatalogueRequestModel> { searchModel });
}

return new LearningHubValidationResult(true);
}

Expand All @@ -853,24 +814,6 @@ public async Task<LearningHubValidationResult> ShowCatalogueAsync(int userId, in

await this.catalogueNodeVersionRepository.ShowCatalogue(userId, nodeId);

var cnv = this.catalogueNodeVersionRepository.GetAll()
.Include(x => x.NodeVersion).ThenInclude(x => x.Node)
.Include(x => x.Keywords)
.Include(x => x.CatalogueNodeVersionProvider)
.SingleOrDefault(x => x.NodeVersion.NodeId == nodeId);

// update findwise
if (cnv != null)
{
var searchModel = this.mapper.Map<SearchCatalogueRequestModel>(cnv);
if (searchModel.Description.Length > this.findwiseConfig.DescriptionLengthLimit)
{
searchModel.Description = searchModel.Description.Substring(0, this.findwiseConfig.DescriptionLengthLimit - 4) + "</p>";
}

await this.findwiseApiFacade.AddOrReplaceAsync(new List<SearchCatalogueRequestModel> { searchModel });
}

return new LearningHubValidationResult(true);
}

Expand Down Expand Up @@ -927,23 +870,6 @@ public async Task HideCatalogueAsync(int userId, int nodeId)

node.Hidden = true;
await this.nodeRepository.UpdateAsync(userId, node);

// update findwise
var cnv = this.catalogueNodeVersionRepository.GetAll()
.Include(x => x.NodeVersion).ThenInclude(x => x.Node)
.Include(x => x.Keywords)
.Include(x => x.CatalogueNodeVersionProvider)
.SingleOrDefault(x => x.NodeVersion.NodeId == nodeId);
if (cnv != null)
{
var searchModel = this.mapper.Map<SearchCatalogueRequestModel>(cnv);
if (searchModel.Description.Length > this.findwiseConfig.DescriptionLengthLimit)
{
searchModel.Description = searchModel.Description.Substring(0, this.findwiseConfig.DescriptionLengthLimit - 4) + "</p>";
}

await this.findwiseApiFacade.AddOrReplaceAsync(new List<SearchCatalogueRequestModel> { searchModel });
}
}


Expand Down

This file was deleted.

This file was deleted.

Loading
Loading