Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ public ResponseEntity<?> updateStudent(@PathVariable int id, @RequestBody Studen
return new ResponseEntity<>("User not found", HttpStatus.NOT_FOUND);
}

Cohort cohort = cohortRepository.findById(studentRequest.getCohortId()).orElse(null);
if (cohort == null) {
return new ResponseEntity<>("Cohort not found", HttpStatus.NOT_FOUND);
}

Profile profile = profileRepository.findById(user.getProfile().getId()).orElse(null);
if (profile == null) {
Expand Down Expand Up @@ -194,12 +190,11 @@ public ResponseEntity<?> updateStudent(@PathVariable int id, @RequestBody Studen
profile.setGithubUrl(studentRequest.getGithub_username());
}

Cohort cohort = cohortRepository.findById(studentRequest.getCohortId()).orElse(null);
if (cohort!=null) {
profile.setCohort(cohort);
}

profile.setCohort(cohort);


if (studentRequest.getEmail() != null) {
boolean emailExists = userRepository.existsByEmail(studentRequest.getEmail());
Expand Down
Loading