Browse Source

Simplified BeerController

Matt Raible 7 years ago
parent
commit
8acd621f9a
1 changed files with 2 additions and 7 deletions
  1. 2
    7
      server/src/main/java/com/example/beer/BeerController.java

+ 2
- 7
server/src/main/java/com/example/beer/BeerController.java View File

@@ -19,16 +19,11 @@ public class BeerController {
19 19
 
20 20
     @GetMapping("/good-beers")
21 21
     @CrossOrigin(origins = {"http://localhost:8100","file://"})
22
-    public Collection<Map<String, String>> goodBeers() {
22
+    public Collection<Beer> goodBeers() {
23 23
 
24 24
         return repository.findAll().stream()
25 25
                 .filter(this::isGreat)
26
-                .map(b -> {
27
-                    Map<String, String> m = new HashMap<>();
28
-                    m.put("id", b.getId().toString());
29
-                    m.put("name", b.getName());
30
-                    return m;
31
-                }).collect(Collectors.toList());
26
+                .collect(Collectors.toList());
32 27
     }
33 28
 
34 29
     private boolean isGreat(Beer beer) {