+ return
+ adderRecordHandler
+ .getState()
+ .entrySet()
+ .stream()
+ .collect(Collectors.toMap(
+ entry -> entry.getKey(),
+ entry -> entry.getValue().getState()));
+ }
+
+ @GetMapping("state/{user}")
+ public ResponseEntity<Long> seen(@PathVariable String user)
+ {
+ for (AdderBusinessLogic adderBusinessLogic : adderRecordHandler.getState().values())
+ {
+ Optional<Long> sum = adderBusinessLogic.getSum(user);
+ if (sum.isPresent())
+ return ResponseEntity.ok(sum.get());
+ }
+
+ return ResponseEntity.notFound().build();
+ }
+
+
+ @ExceptionHandler
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ public ErrorResponse illegalStateException(IllegalStateException e)
+ {
+ return new ErrorResponse(e.getMessage(), HttpStatus.BAD_REQUEST.value());