Unverified Commit 8d7c1465 authored by Shishir Suman's avatar Shishir Suman Committed by GitHub
Browse files

Merge pull request #191 from Radheshhathwar/development

Changes for assign alternative examCenter
Showing with 13 additions and 2 deletions
+13 -2
package com.tarento.upsmf.examsAndAdmissions.model; package com.tarento.upsmf.examsAndAdmissions.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tarento.upsmf.examsAndAdmissions.enums.ApprovalStatus; import com.tarento.upsmf.examsAndAdmissions.enums.ApprovalStatus;
import lombok.*; import lombok.*;
...@@ -43,6 +44,16 @@ public class ExamCenter { ...@@ -43,6 +44,16 @@ public class ExamCenter {
private Boolean alternateExamCenterAssigned = false; private Boolean alternateExamCenterAssigned = false;
@OneToOne @OneToOne
@JoinColumn(name = "alternate_exam_center_id") @JoinColumn(name = "alternate_exam_center_id")
// @JsonIgnore // Ignore this field during JSON serialization
private ExamCenter alternateExamCenter; private ExamCenter alternateExamCenter;
@Override
public String toString() {
return "ExamCenter{" +
"id=" + id +
", name='" + name + '\'' +
// ... (other fields)
", alternateExamCenter=" + (alternateExamCenter != null ? alternateExamCenter.getId() : null) + // Handle alternateExamCenter to break the cyclic reference
'}';
}
} }
...@@ -78,13 +78,13 @@ public class ExamCenterService { ...@@ -78,13 +78,13 @@ public class ExamCenterService {
// Set the alternate exam center for the unverified exam center // Set the alternate exam center for the unverified exam center
unverifiedExamCenter.setAlternateExamCenter(alternateExamCenter); unverifiedExamCenter.setAlternateExamCenter(alternateExamCenter);
unverifiedExamCenter.setAlternateExamCenterAssigned(true); unverifiedExamCenter.setAlternateExamCenterAssigned(true);
examCenterRepository.save(unverifiedExamCenter); unverifiedExamCenter = examCenterRepository.save(unverifiedExamCenter);
// Save the updated registrations // Save the updated registrations
List<StudentExamRegistration> updatedRegistrations = studentExamRegistrationRepository.saveAll(affectedRegistrations); List<StudentExamRegistration> updatedRegistrations = studentExamRegistrationRepository.saveAll(affectedRegistrations);
response.put("message", "Alternate Exam Center assigned successfully."); response.put("message", "Alternate Exam Center assigned successfully.");
response.put(Constants.RESPONSE, updatedRegistrations); response.put(Constants.RESPONSE, unverifiedExamCenter);
response.setResponseCode(HttpStatus.OK); response.setResponseCode(HttpStatus.OK);
} }
} catch (EntityNotFoundException e) { } catch (EntityNotFoundException e) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment