feat(notifications): bell alerts for assigned leads and web sign-ups

InvitationWiringTest registers StaffNotifier and asserts it is wired.

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 19:54:57 +08:00
1 parent 66e2e488d9
commit e3f08bc6cf
12 files changed
+495 -8

No files matched your search

@@ -163,6 +163,7 @@ public class AdminEventLeadService {
body.put("nextFollowUpDate", followUp == null ? null : followUp.toString());
body.put("notes", trimmed(r.notes()));
body.put("doneBy", caller.getUsername());
body.put("doneByUserId", caller.getId()); // add-lead-notifications: self-assignment is silent
try {
return view(restTemplateUtil.postForEntity(url(RestApiCounterServiceConstants.API_REST_COUNTER_EVENT_LEAD_CAPTURE), MAP, body).getBody(),
known, new HashMap<>());
@@ -281,6 +282,7 @@ public class AdminEventLeadService {
body.put("notes", trimmed(r.notes()));
body.put("attended", r.attended());
body.put("doneBy", caller.getUsername());
body.put("doneByUserId", caller.getId()); // add-lead-notifications: self-assignment is silent
Map<String, Object> saved = restTemplateUtil.postForEntity(url(RestApiCounterServiceConstants.API_REST_COUNTER_EVENT_LEAD_UPDATE), MAP, body).getBody();
// field names only: follow-up values are personal data
List<String> changed = new ArrayList<>();
@@ -302,6 +302,16 @@ class AdminEventLeadServiceTest {
.containsEntry("eventUuid", String.valueOf(EV)).containsEntry("leadType", "NEW").containsEntry("mobile", "+60123456789");
}
@Test
void captureAndUpdateSendTheActingUsersIdSoSelfAssignmentIsSilent() {
// add-lead-notifications: the counter skips the bell when the actor is the new salesperson.
service.capture(String.valueOf(EV), capture(null, "Aisyah", "+60 12-345 6789", null));
assertThat(sent(CAPTURE)).containsEntry("doneByUserId", 21L);
stubStored(EV, 23L, List.of());
service.update(String.valueOf(EV), String.valueOf(EL), new AdminEventLeadUpdateRequest(23L, null, "CONTACTED", List.of(), null, null));
assertThat(sent(UPDATE)).containsEntry("doneByUserId", 21L);
}
@Test
void neitherMobileNorEmailIsRefusedNamingBoth() {
assertThatThrownBy(() -> service.capture(String.valueOf(EV), capture(null, "Aisyah", "", " ")))