Skip to content

VCST-4710: Add AddressService and AddressSearchService#293

Open
ksavosteev wants to merge 17 commits intodevfrom
feat/VCST-4710
Open

VCST-4710: Add AddressService and AddressSearchService#293
ksavosteev wants to merge 17 commits intodevfrom
feat/VCST-4710

Conversation

@ksavosteev
Copy link
Copy Markdown
Contributor

@ksavosteev ksavosteev commented Mar 10, 2026

Description

References

QA-test:

Jira-link:

https://virtocommerce.atlassian.net/browse/VCST-4710

Artifact URL:

https://vc3prerelease.blob.core.windows.net/packages/VirtoCommerce.Customer_3.1003.0-pr-293-fd7c.zip


Note

Medium Risk
Adds new address search/query surface (filtering, faceting, and favorite-based sorting) and introduces additional caching invalidation paths; also bumps multiple VirtoCommerce Platform package versions, which can have broader runtime impact.

Overview
Adds a dedicated read-only AddressService plus AddressSearchService to retrieve and search customer addresses independently of Member, including keyword/member filtering, faceted aggregation (country/region/city), and optional sorting by a computed favorite flag via IFavoriteAddressService.

Updates the data layer to support the new CRUD/search pipeline (address events, Address now implements IEntity, AddressEntity implements IDataEntity and repository adds GetAddresssByIdsAsync), and extends MemberService cache invalidation to expire address search/item cache tokens when members/addresses change.

Bumps VirtoCommerce.Platform.* package references and module manifest platformVersion to 3.1008.0-alpha.13210-vcst-4710, and registers the new services in DI.

Written by Cursor Bugbot for commit fd7cae5. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Autofix Details

Bugbot Autofix prepared fixes for all 3 issues found in the latest run.

  • ✅ Fixed: FromModel ignores PrimaryKeyResolvingMap breaking entity-model ID mapping
    • Updated AddressEntity.FromModel(Address, PrimaryKeyResolvingMap) to register the model-entity pair via pkMap?.AddPair(model, this) before mapping fields.
  • ✅ Fixed: Lazy getter caches stale scalar value in search criteria
    • Changed scalar setters in AddressSearchCriteria (MemberId, RegionId, CountryCode, City) to clear their cached list fields so list getters reflect later scalar updates.
  • ✅ Fixed: DeleteAsync not blocked on read-only address service
    • Overrode AddressService.DeleteAsync(IList<string>, bool) to throw NotImplementedException, matching the service’s read-only contract.

Create PR

Or push these changes by commenting:

@cursor push 7151dfb5af
Preview (7151dfb5af)
diff --git a/src/VirtoCommerce.CustomerModule.Core/Model/Search/AddressSearchCriteria.cs b/src/VirtoCommerce.CustomerModule.Core/Model/Search/AddressSearchCriteria.cs
--- a/src/VirtoCommerce.CustomerModule.Core/Model/Search/AddressSearchCriteria.cs
+++ b/src/VirtoCommerce.CustomerModule.Core/Model/Search/AddressSearchCriteria.cs
@@ -5,7 +5,19 @@
 
 public class AddressSearchCriteria : SearchCriteriaBase
 {
-    public string MemberId { get; set; }
+    private string _memberId;
+    public string MemberId
+    {
+        get => _memberId;
+        set
+        {
+            if (_memberId != value)
+            {
+                _memberId = value;
+                _membersIds = null;
+            }
+        }
+    }
 
     private IList<string> _membersIds;
     public IList<string> MembersIds
@@ -24,7 +36,19 @@
         }
     }
 
-    public string RegionId { get; set; }
+    private string _regionId;
+    public string RegionId
+    {
+        get => _regionId;
+        set
+        {
+            if (_regionId != value)
+            {
+                _regionId = value;
+                _regionIds = null;
+            }
+        }
+    }
 
     private IList<string> _regionIds;
     public IList<string> RegionIds
@@ -44,7 +68,19 @@
     }
 
 
-    public string CountryCode { get; set; }
+    private string _countryCode;
+    public string CountryCode
+    {
+        get => _countryCode;
+        set
+        {
+            if (_countryCode != value)
+            {
+                _countryCode = value;
+                _countryCodes = null;
+            }
+        }
+    }
 
     private IList<string> _countryCodes;
     public IList<string> CountryCodes
@@ -63,7 +99,19 @@
         }
     }
 
-    public string City { get; set; }
+    private string _city;
+    public string City
+    {
+        get => _city;
+        set
+        {
+            if (_city != value)
+            {
+                _city = value;
+                _cities = null;
+            }
+        }
+    }
 
     private IList<string> _cities;
 

diff --git a/src/VirtoCommerce.CustomerModule.Data/Model/AddressEntity.cs b/src/VirtoCommerce.CustomerModule.Data/Model/AddressEntity.cs
--- a/src/VirtoCommerce.CustomerModule.Data/Model/AddressEntity.cs
+++ b/src/VirtoCommerce.CustomerModule.Data/Model/AddressEntity.cs
@@ -147,6 +147,7 @@
 
         public AddressEntity FromModel(Address model, PrimaryKeyResolvingMap pkMap)
         {
+            pkMap?.AddPair(model, this);
             return FromModel(model);
         }
 

diff --git a/src/VirtoCommerce.CustomerModule.Data/Services/AddressService.cs b/src/VirtoCommerce.CustomerModule.Data/Services/AddressService.cs
--- a/src/VirtoCommerce.CustomerModule.Data/Services/AddressService.cs
+++ b/src/VirtoCommerce.CustomerModule.Data/Services/AddressService.cs
@@ -30,4 +30,9 @@
     {
         throw new NotImplementedException("This service is read-only. Save addresses via the Member entity.");
     }
+
+    public override Task DeleteAsync(IList<string> ids, bool softDelete)
+    {
+        throw new NotImplementedException("This service is read-only. Delete addresses via the Member entity.");
+    }
 }
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Comment thread src/VirtoCommerce.CustomerModule.Data/Model/AddressEntity.cs
Comment thread src/VirtoCommerce.CustomerModule.Core/Model/Search/AddressSearchCriteria.cs Outdated
Comment thread src/VirtoCommerce.CustomerModule.Data/Services/AddressService.cs
Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.993
Timestamp: 10-03-2026T10:29:34

Comment thread src/VirtoCommerce.CustomerModule.Data/Model/AddressEntity.cs Outdated
Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.91
Timestamp: 10-03-2026T12:31:16

Comment thread src/VirtoCommerce.CustomerModule.Core/Model/Search/AddressSearchResult.cs Outdated
Comment thread src/VirtoCommerce.CustomerModule.Data/Services/MemberService.cs
Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.718
Timestamp: 11-03-2026T08:52:48

Comment thread src/VirtoCommerce.CustomerModule.Data/Services/MemberService.cs
Comment thread src/VirtoCommerce.CustomerModule.Data/Services/AddressService.cs
Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.832
Timestamp: 11-03-2026T09:13:39

Comment thread src/VirtoCommerce.CustomerModule.Data/Services/MemberService.cs
Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.743
Timestamp: 11-03-2026T10:06:34

Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 8.98
Timestamp: 17-03-2026T12:33:20

Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 8.111
Timestamp: 18-03-2026T08:32:45

Comment thread src/VirtoCommerce.CustomerModule.Core/Model/Search/AddressSearchCriteria.cs Outdated
Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.926
Timestamp: 18-03-2026T09:18:09

Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.427
Timestamp: 18-03-2026T10:37:22

Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 8.242
Timestamp: 18-03-2026T11:12:38

Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 8.135
Timestamp: 18-03-2026T17:06:40

Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.982
Timestamp: 19-03-2026T14:57:39

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread src/VirtoCommerce.CustomerModule.Data/Services/AddressSearchService.cs Outdated
Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.712
Timestamp: 19-03-2026T17:26:34

Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.898
Timestamp: 20-03-2026T10:53:36

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.632
Timestamp: 20-03-2026T13:31:04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants