Skip to content

VCST-4710: Add AddressService and AddressSearchService#293

Merged
ksavosteev merged 21 commits into
devfrom
feat/VCST-4710
Apr 28, 2026
Merged

VCST-4710: Add AddressService and AddressSearchService#293
ksavosteev merged 21 commits into
devfrom
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.1007.0-pr-293-1928.zip


Note

Medium Risk
Adds new search/faceting and caching invalidation paths that can impact query performance and cache correctness; also bumps core platform dependencies which may introduce subtle behavioral changes.

Overview
Introduces first-class address CRUD/search APIs: IAddressService (read-only CrudService wrapper) and IAddressSearchService with new AddressSearchCriteria/AddressSearchResult supporting keyword + member/country/region/city filters, facet aggregation, and sorting by a virtual IsFavorite column using IFavoriteAddressService.

Updates caching so address searches and favorites invalidate correctly when members or favorite addresses change, adds address change events, and extends repository/entity plumbing (IMemberRepository.GetAddressesByIdsAsync, AddressEntity implementing IDataEntity, Address implementing IEntity). Also bumps platform package references and module.manifest platform version to 3.1025.0, and wires the new services into DI.

Reviewed by Cursor Bugbot for commit 1928592. Bugbot is set up for automated code reviews on this repo. 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
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

@vc-ci
Copy link
Copy Markdown
Contributor

vc-ci commented Apr 23, 2026

🧪 Katalon Test Report — ✅ PASSED

🔢 Total ✅ Passed ❌ Failed
13 13 0
📋 Suite details
Suite Test Suites/Modules/module_Assets
Failures 0
Errors 0
Timestamp 28-04-2026T08:11:10

🔗 View run · Commit: 0ab0c6a

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.

Reviewed by Cursor Bugbot for commit 011f0d9. Configure here.

Comment thread src/VirtoCommerce.CustomerModule.Data/Repositories/IMemberRepository.cs Outdated
@sonarqubecloud
Copy link
Copy Markdown

@ksavosteev ksavosteev merged commit 9632eef into dev Apr 28, 2026
8 checks passed
@ksavosteev ksavosteev deleted the feat/VCST-4710 branch April 28, 2026 08:19
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