Skip to content

Commit

Permalink
VCST-464: db agnostic (#90)
Browse files Browse the repository at this point in the history
feat: Added DB Agnostic support.
feat: Resolve VC0005 warnings.
  • Loading branch information
OlegoO committed Feb 12, 2024
1 parent 612779c commit 43a6538
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 108 deletions.
51 changes: 26 additions & 25 deletions .github/workflows/module-ci.yml
@@ -1,4 +1,5 @@
# v3.800.1
# v3.800.2
# https://virtocommerce.atlassian.net/browse/VCST-349
name: Module CI

on:
Expand Down Expand Up @@ -56,13 +57,13 @@ jobs:

steps:

- name: Set up Node 18
uses: actions/setup-node@v3
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- name: Set up Java 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
Expand All @@ -72,22 +73,22 @@ jobs:
run: |
echo "RELEASE_STATUS=true" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install VirtoCommerce.GlobalTool
uses: VirtoCommerce/vc-github-actions/setup-vcbuild@master
uses: VirtoCommerce/vc-github-actions/setup-vcbuild@VCST-349

- name: Install dotnet-sonarscanner
run: dotnet tool install --global dotnet-sonarscanner

- name: Get Changelog
id: changelog
uses: VirtoCommerce/vc-github-actions/changelog-generator@master
uses: VirtoCommerce/vc-github-actions/changelog-generator@VCST-349

- name: Get Artifact Version
uses: VirtoCommerce/vc-github-actions/get-image-version@master
uses: VirtoCommerce/vc-github-actions/get-image-version@VCST-349
id: artifact_ver

- name: Set VERSION_SUFFIX variable
Expand All @@ -99,12 +100,12 @@ jobs:
fi;
- name: Add version suffix
if: ${{ github.ref != 'refs/heads/master' }}
uses: VirtoCommerce/vc-github-actions/add-version-suffix@master
uses: VirtoCommerce/vc-github-actions/add-version-suffix@VCST-349
with:
versionSuffix: ${{ env.VERSION_SUFFIX }}

- name: SonarCloud Begin
uses: VirtoCommerce/vc-github-actions/sonar-scanner-begin@master
uses: VirtoCommerce/vc-github-actions/sonar-scanner-begin@VCST-349
with:
repoOrg: ${{ github.repository_owner }}
sonarOrg: ${{secrets.SONAR_ORG_KEY}}
Expand All @@ -116,10 +117,10 @@ jobs:
run: vc-build Test -skip

- name: SonarCloud End
uses: VirtoCommerce/vc-github-actions/sonar-scanner-end@master
uses: VirtoCommerce/vc-github-actions/sonar-scanner-end@VCST-349

- name: Quality Gate
uses: VirtoCommerce/vc-github-actions/sonar-quality-gate@master
uses: VirtoCommerce/vc-github-actions/sonar-quality-gate@VCST-349
with:
login: ${{secrets.SONAR_TOKEN}}

Expand All @@ -128,19 +129,19 @@ jobs:

- name: Publish Nuget
if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch' }}
uses: VirtoCommerce/vc-github-actions/publish-nuget@master
uses: VirtoCommerce/vc-github-actions/publish-nuget@VCST-349

- name: Publish to Blob
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master') }}
id: blobRelease
uses: VirtoCommerce/vc-github-actions/publish-blob-release@master
uses: VirtoCommerce/vc-github-actions/publish-blob-release@VCST-349
with:
blobSAS: ${{ secrets.BLOB_TOKEN }}
blobUrl: ${{ vars.BLOB_URL }}

- name: Add Jira link
if: ${{ github.event_name == 'pull_request' }}
uses: VirtoCommerce/vc-github-actions/publish-jira-link@master
uses: VirtoCommerce/vc-github-actions/publish-jira-link@VCST-349
with:
branchName: ${{ github.head_ref }}
repoOrg: ${{ github.repository_owner }}
Expand All @@ -149,7 +150,7 @@ jobs:

- name: Add link to PR
if: ${{ github.event_name == 'pull_request' }}
uses: VirtoCommerce/vc-github-actions/publish-artifact-link@master
uses: VirtoCommerce/vc-github-actions/publish-artifact-link@VCST-349
with:
artifactUrl: ${{ steps.blobRelease.outputs.packageUrl }}
repoOrg: ${{ github.repository_owner }}
Expand All @@ -161,7 +162,7 @@ jobs:
with:
changelog: ${{ steps.changelog.outputs.changelog }}
organization: ${{ github.repository_owner }}
uses: VirtoCommerce/vc-github-actions/publish-github-release@master
uses: VirtoCommerce/vc-github-actions/publish-github-release@VCST-349

- name: Set artifactUrl value
id: artifactUrl
Expand All @@ -174,7 +175,7 @@ jobs:
- name: Create deployment matrix
if: ${{ github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master'}}
uses: VirtoCommerce/vc-github-actions/cloud-create-deploy-matrix@master
uses: VirtoCommerce/vc-github-actions/cloud-create-deploy-matrix@VCST-349
id: deployment-matrix
with:
deployConfigPath: '.deployment/module/cloudDeploy.json'
Expand All @@ -192,18 +193,18 @@ jobs:
- name: Setup Git Credentials
if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && github.event_name != 'workflow_dispatch' }}
uses: VirtoCommerce/vc-github-actions/setup-git-credentials-github@master
uses: VirtoCommerce/vc-github-actions/setup-git-credentials-github@VCST-349
with:
githubToken: ${{ secrets.REPO_TOKEN }}

- name: Publish Manifest
if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && github.event_name != 'workflow_dispatch' }}
uses: VirtoCommerce/vc-github-actions/publish-manifest@master
uses: VirtoCommerce/vc-github-actions/publish-manifest@VCST-349
with:
packageUrl: ${{ steps.artifactUrl.outputs.download_url }}

- name: Parse Jira Keys from All Commits
uses: VirtoCommerce/vc-github-actions/get-jira-keys@master
uses: VirtoCommerce/vc-github-actions/get-jira-keys@VCST-349
if: always()
id: jira_keys
with:
Expand All @@ -214,7 +215,7 @@ jobs:
- name: Push Build Info to Jira
if: ${{ env.CLOUD_INSTANCE_BASE_URL != 0 && env.CLIENT_ID != 0 && env.CLIENT_SECRET != 0 && steps.jira_keys.outputs.jira-keys != '' && always() }}
id: push_build_info_to_jira
uses: VirtoCommerce/jira-upload-build-info@master
uses: VirtoCommerce/jira-upload-build-info@VCST-349
with:
cloud-instance-base-url: '${{ secrets.CLOUD_INSTANCE_BASE_URL }}'
client-id: '${{ secrets.CLIENT_ID }}'
Expand All @@ -240,7 +241,7 @@ jobs:
if: ${{ ((github.ref == 'refs/heads/dev') && (github.event_name == 'push') && (needs.ci.outputs.run-e2e == 'true')) ||
(github.event_name == 'workflow_dispatch')}}
needs: 'ci'
uses: VirtoCommerce/.github/.github/workflows/e2e.yml@v3.800.0
uses: VirtoCommerce/.github/.github/workflows/e2e.yml@VCST-349
with:
katalonRepo: 'VirtoCommerce/vc-quality-gate-katalon'
katalonRepoBranch: 'dev'
Expand All @@ -260,7 +261,7 @@ jobs:
(github.ref == 'refs/heads/dev')) &&
github.event_name == 'push' }}
needs: ci
uses: VirtoCommerce/.github/.github/workflows/deploy-cloud.yml@v3.800.0
uses: VirtoCommerce/.github/.github/workflows/deploy-cloud.yml@VCST-349
with:
releaseSource: module
moduleId: ${{ needs.ci.outputs.moduleId }}
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/publish-nugets.yml
@@ -1,4 +1,5 @@
# v3.800.0
# v3.800.2
# https://virtocommerce.atlassian.net/browse/VCST-349
name: Publish nuget

on:
Expand All @@ -12,12 +13,12 @@ on:

jobs:
test:
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.0
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@VCST-349
secrets:
sonarToken: ${{ secrets.SONAR_TOKEN }}

build:
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.0
uses: VirtoCommerce/.github/.github/workflows/build.yml@VCST-349
with:
uploadPackage: 'true'
uploadDocker: 'false'
Expand All @@ -28,7 +29,7 @@ jobs:
publish-nuget:
needs:
[build, test]
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.0
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@VCST-349
with:
fullKey: ${{ needs.build.outputs.packageFullKey }}
forceGithub: false
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
@@ -1,11 +1,12 @@
# v3.800.0
# v3.800.2
# https://virtocommerce.atlassian.net/browse/VCST-349
name: Release

on:
workflow_dispatch:

jobs:
release:
uses: VirtoCommerce/.github/.github/workflows/release.yml@v3.800.0
uses: VirtoCommerce/.github/.github/workflows/release.yml@VCST-349
secrets:
envPAT: ${{ secrets.REPO_TOKEN }}
envPAT: ${{ secrets.REPO_TOKEN }}

This file was deleted.

This file was deleted.

Expand Up @@ -3,12 +3,12 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using VirtoCommerce.AssetsModule.Core.Assets;
using VirtoCommerce.CustomerExportImportModule.Core;
using VirtoCommerce.CustomerExportImportModule.Core.Models;
using VirtoCommerce.CustomerExportImportModule.Core.Services;
using VirtoCommerce.CustomerModule.Core.Model;
using VirtoCommerce.Platform.Core;
using VirtoCommerce.AssetsModule.Core.Assets;
using VirtoCommerce.Platform.Core.Common;
using VirtoCommerce.Platform.Core.DynamicProperties;
using VirtoCommerce.Platform.Core.Exceptions;
Expand Down Expand Up @@ -52,7 +52,7 @@ public async Task ExportAsync(ExportDataRequest request, Action<ExportProgressIn
exportProgress.Description = "Fetching...";
progressCallback(exportProgress);

var dynamicProperties = await _dynamicPropertySearchService.SearchDynamicPropertiesAsync(new DynamicPropertySearchCriteria()
var dynamicProperties = await _dynamicPropertySearchService.SearchAsync(new DynamicPropertySearchCriteria()
{
ObjectTypes = new List<string> { typeof(Contact).FullName, typeof(Organization).FullName },
Skip = 0,
Expand Down
Expand Up @@ -2,10 +2,10 @@
using System.Linq;
using System.Threading.Tasks;
using CsvHelper.Configuration;
using VirtoCommerce.AssetsModule.Core.Assets;
using VirtoCommerce.CustomerExportImportModule.Core.Models;
using VirtoCommerce.CustomerExportImportModule.Core.Services;
using VirtoCommerce.CustomerExportImportModule.Data.ExportImport;
using VirtoCommerce.AssetsModule.Core.Assets;
using VirtoCommerce.Platform.Core.DynamicProperties;

namespace VirtoCommerce.CustomerExportImportModule.Data.Services
Expand All @@ -25,7 +25,7 @@ public CustomerImportPagedDataSourceFactory(IBlobStorageProvider blobStorageProv

public async Task<ICustomerImportPagedDataSource<TCsvCustomer>> CreateAsync<TCsvCustomer, TCustomer>(string filePath, int pageSize, CsvConfiguration configuration = null) where TCsvCustomer : CsvMember
{
var dynamicPropertiesSearchResult = await _dynamicPropertySearchService.SearchDynamicPropertiesAsync(new DynamicPropertySearchCriteria
var dynamicPropertiesSearchResult = await _dynamicPropertySearchService.SearchAsync(new DynamicPropertySearchCriteria
{
ObjectTypes = new List<string> { typeof(TCustomer).FullName },
Skip = 0,
Expand All @@ -37,7 +37,7 @@ public CustomerImportPagedDataSourceFactory(IBlobStorageProvider blobStorageProv
foreach (var dynamicProperty in dynamicProperties.Where(dynamicProperty => dynamicProperty.IsDictionary))
{
var dynamicPropertyDictionaryItemsSearchResult =
await _dynamicPropertyDictionaryItemsSearchService.SearchDictionaryItemsAsync(new DynamicPropertyDictionaryItemSearchCriteria { PropertyId = dynamicProperty.Id });
await _dynamicPropertyDictionaryItemsSearchService.SearchAsync(new DynamicPropertyDictionaryItemSearchCriteria { PropertyId = dynamicProperty.Id });
dynamicPropertyDictionaryItems.Add(dynamicProperty.Id, dynamicPropertyDictionaryItemsSearchResult.Results);
}

Expand Down
Expand Up @@ -140,7 +140,7 @@ private void AttachValidators()
RuleFor(x => x.Record.AccountStatus)
.MustAsync(async (accountStatus, _) =>
{
var accountStatuses = await _settingsManager.GetObjectSettingAsync(PlatformConstants.Settings.Other.AccountStatuses.Name);
var accountStatuses = await _settingsManager.GetObjectSettingAsync(PlatformConstants.Settings.Security.AccountStatuses.Name);
return accountStatuses.AllowedValues.Contains(accountStatus);
})
.When(x => !string.IsNullOrEmpty(x.Record.AccountStatus))
Expand Down
Expand Up @@ -46,7 +46,8 @@ private void AttachValidators()
})
.WithInvalidValueCodeAndMessage("Emails")
.WithImportState()
.DependentRules(() => {
.DependentRules(() =>
{
RuleFor(x => x.Record.Emails)
.Must(emailsColumnValue =>
{
Expand Down Expand Up @@ -92,7 +93,7 @@ private async Task LoadDynamicPropertyDictionaryItems(ICollection<DynamicObjectP
foreach (var dynamicProperty in dynamicProperties.Where(dynamicProperty => dynamicProperty.IsDictionary))
{
var dynamicPropertyDictionaryItemsSearchResult =
await _dynamicPropertyDictionaryItemsSearchService.SearchDictionaryItemsAsync(new DynamicPropertyDictionaryItemSearchCriteria { PropertyId = dynamicProperty.Id });
await _dynamicPropertyDictionaryItemsSearchService.SearchAsync(new DynamicPropertyDictionaryItemSearchCriteria { PropertyId = dynamicProperty.Id });
dynamicPropertyDictionaryItems.AddRange(dynamicPropertyDictionaryItemsSearchResult.Results);
}
}
Expand Down
Expand Up @@ -15,18 +15,12 @@
<Folder Include="Caching\" />
<Folder Include="Handlers\" />
<Folder Include="Models\" />
<Folder Include="Repositories\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.AssetsModule.Data" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.CustomerModule.Data" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.Platform.Hangfire" Version="3.800.0" />
</ItemGroup>
</Project>

0 comments on commit 43a6538

Please sign in to comment.