Skip to content

Commit

Permalink
fix(FSADT1-1426): fixed multi-address issue (#1061)
Browse files Browse the repository at this point in the history
in case of bc registry data with multiple addresses, we order to have the mailing first, and we remove any other location on the frontend
  • Loading branch information
paulushcgcj committed Aug 7, 2024
1 parent 2fa7421 commit 2df41c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import io.micrometer.observation.annotation.Observed;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -446,6 +447,7 @@ private Mono<ClientDetailsDto> buildAddress(
loadProvince(address.country().value(), address.province().value())
.map(address::withProvince)
)
.sort(Comparator.comparing(ClientAddressDto::locationName).reversed())
.collectList()
.defaultIfEmpty(new ArrayList<>())
.flatMap(addresses ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ watch([detailsData], () => {
const forestClientDetails: ForestClientDetailsDto = detailsData.value;
if (!features.BCEID_MULTI_ADDRESS) {
// To prevent multiple addresses from breaking the validations
if (Array.isArray(forestClientDetails?.addresses) && forestClientDetails.addresses.length > 1) {
forestClientDetails.addresses.pop();
}
forestClientDetails?.contacts?.forEach((contact) => {
contact.locationNames = [{ ...defaultLocation }];
});
Expand Down

0 comments on commit 2df41c1

Please sign in to comment.