feat(system): limit the label search to given codes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-12-02 14:47:36 +08:00
1 parent a24291edd2
commit 89662d0eb2
4 files changed
+28 -2

No files matched your search

@@ -85,6 +85,23 @@ class MessageServiceTranslationsTest {
assertThat(codes(page)).containsExactly("A3");
}
@Test
void codesLimitTheListIgnoringCaseAndCombineWithTheOtherFilters() {
when(repository.findAllByArea(Area.A)).thenReturn(List.of(
msg(1, "Leads", "Leads", "线索"), msg(2, "OrderPayment", "Order payment", null), msg(3, "Users", "Users", null)));
MessageSearchRequest own = req(null, null, 0, 10);
own.setCodes(List.of("leads", "USERS"));
assertThat(codes(service.search(own))).containsExactly("Leads", "Users");
own.setMissingLocale("zh_CN");
Page<Message> missing = service.search(own);
assertThat(codes(missing)).containsExactly("Users");
assertThat(missing.getTotalElements()).isEqualTo(1);
assertThat(codes(service.search(req(null, "zh_CN", 0, 10)))).containsExactly("OrderPayment", "Users");
}
@Test
void savingAnExistingLabelBumpsTheVersion() {
Message stored = msg(7, "Leads", "Leads", "线索");