Re-done session coach on creation

This commit is contained in:
Alexis Leboeuf
2026-01-09 12:54:37 +01:00
parent 34f37b99cc
commit 29bb452d19
3 changed files with 6 additions and 4 deletions

View File

@@ -44,7 +44,8 @@ public class SessionResource {
public ResponseEntity<?> create(@RequestBody SessionDTO dto) {
try {
Session session = maptoEntity(dto);
session.setCoach(coachDAO.findById(dto.getCoachId()).orElse(null));
Coach c = coachDAO.findById(dto.getCoachId()).orElse(null);
session.setCoach(c);
sessionDAO.save(session);
return ResponseEntity.status(HttpStatus.CREATED).body(maptoDTO(session));
} catch (Exception ex) {