fix: refresh dimension config response

This commit is contained in:
2026-09-04 15:44:00 +08:00
parent eba86bb666
commit c3f45c6bff
5 changed files with 28 additions and 14 deletions
@@ -63,7 +63,7 @@ public class CustomerDimensionConfigService {
throw staleConfiguration();
}
}
return response(tenantId, existing);
return response(tenantId, requireCompleteRules(repository.findAll(tenantId)));
}
@Transactional
@@ -140,6 +140,20 @@ class CustomerDimensionConfigServiceTest {
verify(repository, times(2)).update(any());
}
@Test
void returnsPersistedVersionsAfterUpdatingAllRules() {
List<CustomerDimensionConfigEntity> existing = defaultConfigs("registration-1");
List<CustomerDimensionConfigEntity> persisted = defaultConfigs("registration-1");
persisted.forEach(value -> value.setVersion(1));
when(repository.findAll(8L)).thenReturn(existing, persisted);
when(repository.update(any())).thenReturn(1);
GroupResponse result = service.update(8L, 100L, updateRequest(0));
assertThat(result.rules()).extracting(rule -> rule.version()).containsOnly(1);
verify(repository, times(2)).findAll(8L);
}
@Test
void savesAndReturnsTheCustomerDefaultCalculationMode() {
List<CustomerDimensionConfigEntity> existing = defaultConfigs("registration-1");