Skip to content

Commit

Permalink
Merge branch 'release/3.800.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vc-ci committed Jan 29, 2024
2 parents ab0efac + 56b1039 commit 87b72d2
Show file tree
Hide file tree
Showing 41 changed files with 894 additions and 587 deletions.
2 changes: 1 addition & 1 deletion .deployment/module/cloudDeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"environmentId" : "dev",
"environmentName" : "Development",
"environmentType" : "staging",
"environmentUrl" : "https://vcmp-dev.paas.govirto.com/"
"environmentUrl" : "https://vcmp-dev.govirto.com/"
}
}
32 changes: 32 additions & 0 deletions .github/workflows/publish-nugets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# v3.200.36
name: Publish nuget

on:
workflow_dispatch:
inputs:
publishAlpha:
description: 'Publish nuget as alpha version.'
required: true
default: true
type: boolean

jobs:
build:
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.200.36
with:
uploadPackage: 'true'
uploadDocker: 'false'
forceVersionSuffix: ${{ github.event.inputs.publishAlpha }}
secrets:
envPAT: ${{ secrets.REPO_TOKEN }}

publish-nuget:
needs:
[build]
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.200.36
with:
fullKey: ${{ needs.build.outputs.packageFullKey }}
forceGithub: false
secrets:
envPAT: ${{ secrets.GITHUB_TOKEN }}
nugetKey: ${{ secrets.NUGET_KEY }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,6 @@ ASALocalRun/
# Webpack output
dist/
.history

# MacOS
.DS_Store
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<VersionPrefix>3.401.0</VersionPrefix>
<VersionPrefix>3.800.0</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,28 +163,28 @@ public async Task Import_exist_product_from_csv_product_isnt_updated()
public async Task Import_product_with_properties_properties_metadata_resoved()
{
// Arrange
var propertyValue = new PropertyValue()
var propertyValue = new PropertyValue
{
PropertyName = "Dictionary",
};
var allCategoryProperties = new Property[]
{
new Property()
new()
{
Name = "Dictionary",
Dictionary = true,
ValueType = PropertyValueType.ShortText,
}
};
_propDictItemSearchService.Setup(a => a.SearchAsync(It.IsAny<PropertyDictionaryItemSearchCriteria>())).ReturnsAsync(new PropertyDictionaryItemSearchResult()
_propDictItemSearchService.Setup(a => a.SearchAsync(It.IsAny<PropertyDictionaryItemSearchCriteria>(), It.IsAny<bool>())).ReturnsAsync(new PropertyDictionaryItemSearchResult
{
Results = new PropertyDictionaryItem[]
Results = new[]
{
new PropertyDictionaryItem()
new PropertyDictionaryItem
{
Alias = "AliasTest"
}
}
Alias = "AliasTest",
},
},
});

// Act
Expand All @@ -197,7 +197,7 @@ public async Task Import_product_with_properties_properties_metadata_resoved()

private static object[] GetProducts()
{
return new object[] { new CatalogProduct()
return new object[] { new CatalogProduct
{
CategoryId = "TestCategoryId",
OuterId = "TestOuterId",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -10,15 +10,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ICategoryService categoryService

public async Task WriteAsync(object[] items, ImportContext context)
{
var products = items.Cast<CatalogProduct>();
var products = items.Cast<CatalogProduct>().ToArray();

//Load properties metadata for product before save
await LoadPropertiesMetadata(products, context);
Expand All @@ -46,7 +46,7 @@ public async Task WriteAsync(object[] items, ImportContext context)
{
OuterIds = products.Select(x => x.OuterId).ToArray()
});
var searchResultOuterId = searchResult.Results.Select(x => x.OuterId);
var searchResultOuterIds = searchResult.Results.Select(x => x.OuterId).ToArray();

foreach (var product in products)
{
Expand All @@ -56,7 +56,7 @@ public async Task WriteAsync(object[] items, ImportContext context)
{
try
{
if (!searchResultOuterId.Contains(product.OuterId))
if (!searchResultOuterIds.Contains(product.OuterId))
{
await _itemService.SaveChangesAsync(new[] { product });
}
Expand Down Expand Up @@ -117,28 +117,29 @@ public void Dispose()
protected virtual void Dispose(bool disposing)
{
}
private async Task LoadPropertiesMetadata(IEnumerable<CatalogProduct> products, ImportContext context)

private async Task LoadPropertiesMetadata(IList<CatalogProduct> products, ImportContext context)
{
var createNewDictItemIfNotFound = context.ImportProfile.Settings.GetSettingValue(CsvProductSettings.CreateDictionaryValues.Name, (bool)CsvProductSettings.CreateDictionaryValues.DefaultValue);
var createNewDictItemIfNotFound = context.ImportProfile.Settings.GetValue<bool>(CsvProductSettings.CreateDictionaryValues);

var categoriesIds = products.Select(x => x.CategoryId).Distinct().ToArray();
var categories = await _categoryService.GetByIdsAsync(categoriesIds, null);
var categories = await _categoryService.GetAsync(categoriesIds, null) ?? Array.Empty<Category>();
var categoriesByIdDict = categories.ToDictionary(x => x.Id).WithDefaultValue(null);

foreach (var product in products)
{
var allCategoryProperties = categoriesByIdDict[product.CategoryId]?.Properties?.ToArray();
if (allCategoryProperties != null)
{
foreach (var propertyValue in product.Properties?.SelectMany(x => x.Values))
foreach (var propertyValue in product.Properties?.SelectMany(x => x.Values) ?? Enumerable.Empty<PropertyValue>())
{
var property = await _propertyMetadataLoader.TryLoadMetadata(propertyValue, allCategoryProperties, createNewDictItemIfNotFound);
if (property != null && property.Dictionary && propertyValue.ValueId == null)
{
var errorInfo = new ErrorInfo
{
ErrorMessage = $"The '{propertyValue.Alias}' dictionary item is not found in '{propertyValue.PropertyName}' dictionary",
ErrorCode = "ImportError"
ErrorCode = "ImportError",
};
context.ErrorCallback(errorInfo);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using VirtoCommerce.CatalogModule.Core.Model;
Expand Down Expand Up @@ -35,14 +36,14 @@ public async Task<Property> TryLoadMetadata(PropertyValue propertyValue, Propert
{
PropertyIds = new[] { metadata.Id },
Keyword = propertyValue.Value?.ToString()
})).Results
}, true)).Results
.FirstOrDefault();

//TODO: Finding value by localized value
if (dictItem == null && createNewDictItemIfNotExists == true)
if (dictItem == null && createNewDictItemIfNotExists)
{
dictItem = new PropertyDictionaryItem { Alias = propertyValue.Value.ToString(), PropertyId = metadata.Id };
await _propDictItemService.SaveChangesAsync(new[] { dictItem });
dictItem = new PropertyDictionaryItem { Alias = propertyValue.Value?.ToString(), PropertyId = metadata.Id };
await _propDictItemService.SaveChangesAsync((IList<PropertyDictionaryItem>)new[] { dictItem });
}
if (dictItem != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace VirtoCommerce.ImportSampleModule.Web.Importers
{
public class TestImporter : IDataImporter
{
public virtual string TypeName { get; } = nameof(TestImporter);
public virtual string TypeName => nameof(TestImporter);
public virtual Dictionary<string, string> Metadata { get; }
public virtual SettingDescriptor[] AvailSettings { get; set; }
public IAuthorizationRequirement AuthorizationRequirement { get; set; }
Expand All @@ -26,17 +26,12 @@ public IImportDataWriter OpenWriter(ImportContext context)

public object Clone()
{
return base.MemberwiseClone();
return MemberwiseClone();
}

public Task<ValidationResult> ValidateAsync(ImportContext context)
{
return Task.FromResult(new ValidationResult());
}

public async Task OnImportCompletedAsync()
{
//do nothing
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task<ProductSearchResult> SearchAsync(ExtendedProductSearchCriteria
.AsNoTracking()
.ToArrayAsync();

result.Results = (await _itemService.GetByIdsAsync(ids, criteria.ResponseGroup)).OrderBy(x => Array.IndexOf(ids, x.Id)).ToList();
result.Results = (await _itemService.GetAsync(ids, criteria.ResponseGroup)).OrderBy(x => Array.IndexOf(ids, x.Id)).ToList();
}
}
return result;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Library</OutputType>
</PropertyGroup>

Expand All @@ -11,8 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="VirtoCommerce.CatalogModule.Core" Version="3.261.0" />
<PackageReference Include="VirtoCommerce.CatalogModule.Data" Version="3.261.0" />
<PackageReference Include="VirtoCommerce.CatalogModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.CatalogModule.Data" Version="3.800.0" />
</ItemGroup>
<ItemGroup>
<None Update="_module.manifest">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>true</IsPackable>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand All @@ -15,10 +15,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="VirtoCommerce.CustomerModule.Core" Version="3.400.0" />
<PackageReference Include="VirtoCommerce.NotificationsModule.Core" Version="3.400.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.400.0" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.400.0" />
<PackageReference Include="VirtoCommerce.CustomerModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.NotificationsModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.801.0" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.801.0" />
</ItemGroup>
</Project>

14 changes: 7 additions & 7 deletions src/VirtoCommerce.ImportModule.CsvHelper/CsvDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,17 @@ public async Task<object[]> ReadNextPageAsync(ImportContext context)

protected virtual CsvConfiguration GetConfiguration(ImportContext context)
{
var csvConfigurarion = new CsvConfiguration(CultureInfo.InvariantCulture)
var csvConfiguration = new CsvConfiguration(CultureInfo.InvariantCulture)
{
Delimiter = context.ImportProfile.Settings.GetSettingValue(CsvSettings.Delimiter.Name, (string)CsvSettings.Delimiter.DefaultValue),
PrepareHeaderForMatch = (PrepareHeaderForMatchArgs args) =>
Delimiter = context.ImportProfile.Settings.GetValue<string>(CsvSettings.Delimiter),
PrepareHeaderForMatch = args =>
{
var result = args.Header.ToLower();
return result;
},
Mode = CsvMode.RFC4180,
BadDataFound = null,
//TODO: Temporary disable since it cause false positive errors on CsvMapping when access to csv cell by name in custom mapping converters args.Row["Name"]
//TODO: Temporary disable since it cause false positive errors on CsvMapping when access to csv cell by name in custom mapping converters args.Row["Name"]
//BadDataFound = args =>
//{
// var errorInfo = new ErrorInfo
Expand All @@ -158,7 +158,7 @@ protected virtual CsvConfiguration GetConfiguration(ImportContext context)

if (context.ErrorCallback != null)
{
csvConfigurarion.ReadingExceptionOccurred = args =>
csvConfiguration.ReadingExceptionOccurred = args =>
{
var errorInfo = new ErrorInfo
{
Expand All @@ -170,7 +170,7 @@ protected virtual CsvConfiguration GetConfiguration(ImportContext context)
return false;
};

csvConfigurarion.MissingFieldFound = args =>
csvConfiguration.MissingFieldFound = args =>
{
var errorInfo = new ErrorInfo
{
Expand All @@ -184,7 +184,7 @@ protected virtual CsvConfiguration GetConfiguration(ImportContext context)
context.ErrorCallback(errorInfo);
};
}
return csvConfigurarion;
return csvConfiguration;
}

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void SetContext(ImportProfile importProfile)
}
_reportUrl = importProfile.ImportReportUrl;

_delimiter = importProfile.Settings.GetSettingValue(CsvSettings.Delimiter.Name, (string)CsvSettings.Delimiter.DefaultValue);
_delimiter = importProfile.Settings.GetValue<string>(CsvSettings.Delimiter);
}

public async Task<string> SaveErrorsAsync(List<ErrorInfo> errorsToSave)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>true</IsPackable>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand All @@ -15,8 +15,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CsvHelper" Version="27.1.1" />
<PackageReference Include="VirtoCommerce.AssetsModule.Core" Version="3.400.0" />
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="VirtoCommerce.AssetsModule.Core" Version="3.800.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 87b72d2

Please sign in to comment.