fix: issues found in the invitations live check
- guest list failed when no guest was linked yet (Map.of().get(null)) - counter errors arrive as ProblemDetail: read the reason code from detail; drop the counter error advice the core handler always overrode - emails published with a null sender failed the NOT NULL column Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
aed9473aba
commit
fbbc5d0980
10 files changed
+115
-87
No files matched your search
-18
@@ -1,18 +0,0 @@
|
||||
package com.solvway.services.counter.controller;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/** Puts the reason of a ResponseStatusException into the body as `code`, which mobile-api reads. Limited to the invitation feature. */
|
||||
@RestControllerAdvice(assignableTypes = {EventGuestController.class, EventCheckInController.class, EventController.class})
|
||||
public class ApiErrorAdvice {
|
||||
@ExceptionHandler(ResponseStatusException.class)
|
||||
public ResponseEntity<Map<String, String>> handle(ResponseStatusException e) {
|
||||
String reason = e.getReason() == null ? "" : e.getReason();
|
||||
return ResponseEntity.status(e.getStatusCode()).body(Map.of("code", reason, "message", reason));
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class EventGuestService {
|
||||
List<Long> leadIds = guests.stream().map(EventGuest::getEventLeadId).filter(Objects::nonNull).toList();
|
||||
Map<Long, EventLead> leads = leadIds.isEmpty() ? Map.of()
|
||||
: eventLeadRepository.findAllById(leadIds).stream().collect(Collectors.toMap(EventLead::getId, l -> l));
|
||||
return guests.stream().map(g -> row(g, leads.get(g.getEventLeadId()))).toList();
|
||||
return guests.stream().map(g -> row(g, g.getEventLeadId() == null ? null : leads.get(g.getEventLeadId()))).toList();
|
||||
}
|
||||
|
||||
private static GuestRow row(EventGuest g, EventLead lead) {
|
||||
|
||||
Reference in new issue
Block a user