This commit is contained in:
@@ -52,13 +52,7 @@ public class EmployeeController {
|
||||
}
|
||||
Employee employee = employeeService.getEmployeeByCode(code);
|
||||
List<Booking> bookings = bookingRepository.findByEmployeeId(employee.getId());
|
||||
Map<String, Map<String, Object>> bookingMap = new LinkedHashMap<>();
|
||||
|
||||
for (Booking b : bookings) {
|
||||
bookingMap.put(
|
||||
b.getDate().toString(),
|
||||
Map.of("id", b.getId(), "place", b.getPlace().getPlace()));
|
||||
}
|
||||
Map<String, List<Map<String, Object>>> bookingMap = bookings.stream().collect(Collectors.groupingBy(b -> b.getDate().toString(),LinkedHashMap::new,Collectors.mapping(b -> Map.of("id", b.getId(),"place", b.getPlace().getPlace()), Collectors.toList())));
|
||||
Map<String, Object> response = new LinkedHashMap<>();
|
||||
response.put("name", employee.getName());
|
||||
response.put("photoUrl", employee.getPhotoUrl());
|
||||
@@ -73,5 +67,4 @@ public class EmployeeController {
|
||||
.body("Unexpected error");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user