From 64094f0f90428efc087cffa319caa59474da194d Mon Sep 17 00:00:00 2001 From: vc-ci Date: Wed, 15 May 2024 22:47:02 +0000 Subject: [PATCH 1/2] 3.807.0 --- Directory.Build.props | 2 +- src/VirtoCommerce.CoreModule.Web/module.manifest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index d7980b9f..f1134b83 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ - 3.806.0 + 3.807.0 $(VersionSuffix)-$(BuildNumber) diff --git a/src/VirtoCommerce.CoreModule.Web/module.manifest b/src/VirtoCommerce.CoreModule.Web/module.manifest index a194de69..869c9bb9 100644 --- a/src/VirtoCommerce.CoreModule.Web/module.manifest +++ b/src/VirtoCommerce.CoreModule.Web/module.manifest @@ -1,7 +1,7 @@ VirtoCommerce.Core - 3.806.0 + 3.807.0 3.825.0 Commerce core module From 06c7d861fbd162b3dfada220f13e258b26ef7f12 Mon Sep 17 00:00:00 2001 From: Basil Kotov Date: Thu, 20 Jun 2024 14:52:12 +0200 Subject: [PATCH 2/2] VCST-1363: add seo resolver (#226) * add seo resolver * rename relativeUrl to permalink in SeoSearchCriteria * change interface * remove region --- .../Seo/CompositeSeoResolver.cs | 26 +++++++++++++++++++ .../Seo/ISeoResolver.cs | 9 +++++++ .../Seo/SeoSearchCriteria.cs | 11 ++++++++ src/VirtoCommerce.CoreModule.Web/Module.cs | 1 + 4 files changed, 47 insertions(+) create mode 100644 src/VirtoCommerce.CoreModule.Core/Seo/CompositeSeoResolver.cs create mode 100644 src/VirtoCommerce.CoreModule.Core/Seo/ISeoResolver.cs create mode 100644 src/VirtoCommerce.CoreModule.Core/Seo/SeoSearchCriteria.cs diff --git a/src/VirtoCommerce.CoreModule.Core/Seo/CompositeSeoResolver.cs b/src/VirtoCommerce.CoreModule.Core/Seo/CompositeSeoResolver.cs new file mode 100644 index 00000000..a0562fc6 --- /dev/null +++ b/src/VirtoCommerce.CoreModule.Core/Seo/CompositeSeoResolver.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace VirtoCommerce.CoreModule.Core.Seo; + +public class CompositeSeoResolver : ISeoResolver +{ + private readonly IEnumerable _resolvers; + private readonly CompositeSeoBySlugResolver _seoBySlugResolver; + + public CompositeSeoResolver(IEnumerable resolvers, CompositeSeoBySlugResolver seoBySlugResolver) + { + _resolvers = resolvers; + _seoBySlugResolver = seoBySlugResolver; + } + + public async Task> FindSeoAsync(SeoSearchCriteria criteria) + { + var tasks = _resolvers.Select(x => x.FindSeoAsync(criteria)).ToArray(); + var result = (await Task.WhenAll(tasks)).SelectMany(x => x).Where(x => x.ObjectId != null && x.ObjectType != null).Distinct(); + var fallbackResults = await _seoBySlugResolver.FindSeoBySlugAsync(criteria.Slug); + return result.Union(fallbackResults).ToList(); + } +} + diff --git a/src/VirtoCommerce.CoreModule.Core/Seo/ISeoResolver.cs b/src/VirtoCommerce.CoreModule.Core/Seo/ISeoResolver.cs new file mode 100644 index 00000000..2f486da8 --- /dev/null +++ b/src/VirtoCommerce.CoreModule.Core/Seo/ISeoResolver.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace VirtoCommerce.CoreModule.Core.Seo; + +public interface ISeoResolver +{ + Task> FindSeoAsync(SeoSearchCriteria criteria); +} diff --git a/src/VirtoCommerce.CoreModule.Core/Seo/SeoSearchCriteria.cs b/src/VirtoCommerce.CoreModule.Core/Seo/SeoSearchCriteria.cs new file mode 100644 index 00000000..ad508ff6 --- /dev/null +++ b/src/VirtoCommerce.CoreModule.Core/Seo/SeoSearchCriteria.cs @@ -0,0 +1,11 @@ +using VirtoCommerce.Platform.Core.Common; + +namespace VirtoCommerce.CoreModule.Core.Seo +{ + public class SeoSearchCriteria : SearchCriteriaBase + { + public string Slug { get; set; } + public string StoreId { get; set; } + public string Permalink { get; set; } + } +} diff --git a/src/VirtoCommerce.CoreModule.Web/Module.cs b/src/VirtoCommerce.CoreModule.Web/Module.cs index 2eb55f76..559a3a30 100644 --- a/src/VirtoCommerce.CoreModule.Web/Module.cs +++ b/src/VirtoCommerce.CoreModule.Web/Module.cs @@ -72,6 +72,7 @@ public void Initialize(IServiceCollection serviceCollection) serviceCollection.AddTransient(); serviceCollection.AddTransient(); + serviceCollection.AddTransient(); // Money rounding serviceCollection.AddTransient();