1 package de.juplo.kafka;
3 import lombok.RequiredArgsConstructor;
4 import org.springframework.data.mongodb.core.aggregation.ArithmeticOperators;
5 import org.springframework.http.ResponseEntity;
6 import org.springframework.web.bind.annotation.*;
10 import java.util.Optional;
11 import java.util.stream.Collectors;
15 @RequiredArgsConstructor
16 public class ApplicationController
18 private final AdderResults results;
21 @GetMapping("results")
22 public Map<Integer, Map<String, List<AdderResult>>> results()
24 return results.getState();
27 @GetMapping("results/{user}")
28 public ResponseEntity<List<AdderResult>> results(@PathVariable String user)
30 for (Map<String, List<AdderResult>> resultsByUser : this.results.getState().values())
32 List<AdderResult> results = resultsByUser.get(user);
34 return ResponseEntity.ok(results);
37 return ResponseEntity.notFound().build();