import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
public class DriverController
{
private final EndlessConsumer consumer;
- private final SumRecordHandler wordcount;
+ private final SumRecordHandler sumRecordHandler;
@PostMapping("start")
@GetMapping("seen")
- public Map<Integer, Map<String, Map<String, Long>>> seen()
+ public Map<Integer, Map<String, List<Long>>> seen()
{
- return wordcount.getSeen();
+ return sumRecordHandler.getSeen();
}
@GetMapping("seen/{user}")
- public ResponseEntity<Map<String, Long>> seen(@PathVariable String user)
+ public ResponseEntity<List<Long>> seen(@PathVariable String user)
{
- for (Map<String, Map<String, Long>> users : wordcount.getSeen().values())
+ for (Map<String, List<Long>> users : sumRecordHandler.getSeen().values())
{
- Map<String, Long> words = users.get(user);
- if (words != null)
- return ResponseEntity.ok(words);
+ List<Long> results = users.get(user);
+ if (results != null)
+ return ResponseEntity.ok(results);
}
return ResponseEntity.notFound().build();