Skip to content

Commit

Permalink
Merge branch 'release/3.807.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vc-ci committed Jun 20, 2024
2 parents a1ddb04 + 06c7d86 commit 4b2058c
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<!-- These properties will be shared for all projects -->
<PropertyGroup>
<VersionPrefix>3.806.0</VersionPrefix>
<VersionPrefix>3.807.0</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
Expand Down
26 changes: 26 additions & 0 deletions src/VirtoCommerce.CoreModule.Core/Seo/CompositeSeoResolver.cs
Original file line number Diff line number Diff line change
@@ -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<ISeoResolver> _resolvers;
private readonly CompositeSeoBySlugResolver _seoBySlugResolver;

public CompositeSeoResolver(IEnumerable<ISeoResolver> resolvers, CompositeSeoBySlugResolver seoBySlugResolver)
{
_resolvers = resolvers;
_seoBySlugResolver = seoBySlugResolver;
}

public async Task<IList<SeoInfo>> 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();
}
}

9 changes: 9 additions & 0 deletions src/VirtoCommerce.CoreModule.Core/Seo/ISeoResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Collections.Generic;
using System.Threading.Tasks;

namespace VirtoCommerce.CoreModule.Core.Seo;

public interface ISeoResolver
{
Task<IList<SeoInfo>> FindSeoAsync(SeoSearchCriteria criteria);
}
11 changes: 11 additions & 0 deletions src/VirtoCommerce.CoreModule.Core/Seo/SeoSearchCriteria.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}
1 change: 1 addition & 0 deletions src/VirtoCommerce.CoreModule.Web/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void Initialize(IServiceCollection serviceCollection)
serviceCollection.AddTransient<ITenantUniqueNumberGenerator, SequenceNumberGeneratorService>();

serviceCollection.AddTransient<CompositeSeoBySlugResolver>();
serviceCollection.AddTransient<CompositeSeoResolver>();

// Money rounding
serviceCollection.AddTransient<IMoneyRoundingPolicy, DefaultMoneyRoundingPolicy>();
Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.CoreModule.Web/module.manifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<id>VirtoCommerce.Core</id>
<version>3.806.0</version>
<version>3.807.0</version>
<version-tag />
<platformVersion>3.825.0</platformVersion>
<title>Commerce core module</title>
Expand Down

0 comments on commit 4b2058c

Please sign in to comment.