Commit 6a849250 authored by jay pratap singh's avatar jay pratap singh
Browse files

changes for verified and rejected case

parent c0930f07
1 merge request!8adding code for pending verifications of enrolments
Showing with 19 additions and 7 deletions
+19 -7
......@@ -91,13 +91,9 @@ public class StudentController {
}
@PutMapping("/{studentId}/verify")
public ResponseEntity<Student> verifyStudent(@PathVariable Long studentId, @RequestParam("status") VerificationStatus status, @RequestParam("remarks") String remarks,@RequestParam("verificationDate") LocalDate verificationDate) {
Student student = studentService.findById(studentId);
student.setVerificationStatus(status);
student.setAdminRemarks(remarks);
student.setVerificationDate(verificationDate);
studentService.save(student);
return ResponseEntity.ok(student);
public ResponseEntity<Student> verifyStudent(@PathVariable Long studentId, @RequestParam("status") VerificationStatus status, @RequestParam("remarks") String remarks, @RequestParam("verificationDate") LocalDate verificationDate) {
Student updatedStudent = studentService.verifyStudent(studentId, status, remarks, verificationDate);
return ResponseEntity.ok(updatedStudent);
}
@GetMapping("/pendingVerification")
public ResponseEntity<List<Student>> getStudentsPendingVerification() {
......
......@@ -57,6 +57,7 @@ public class Student {
private String adminRemarks;
private LocalDate enrollmentDate;
private LocalDate verificationDate;
private boolean requiresRevision;
@ManyToOne
@JoinColumn(name = "course_id")
......
......@@ -43,6 +43,7 @@ public class StudentDto {
private String adminRemarks;
private LocalDate enrollmentDate;
private LocalDate verificationDate;
private boolean requiresRevision;
private MultipartFile highSchoolMarksheet;
private MultipartFile highSchoolCertificate;
......
......@@ -189,6 +189,20 @@ public class StudentService {
student.setVerificationStatus(status);
return studentRepository.save(student);
}
public Student verifyStudent(Long studentId, VerificationStatus status, String remarks, LocalDate verificationDate) {
Student student = this.findById(studentId);
student.setVerificationStatus(status);
student.setAdminRemarks(remarks);
student.setVerificationDate(verificationDate);
if (status == VerificationStatus.VERIFIED) {
String enrollmentNumber = "EN" + LocalDate.now().getYear() + student.getCenterCode() + student.getId();
student.setProvisionalEnrollmentNumber(enrollmentNumber);
} else if (status == VerificationStatus.REJECTED) {
student.setRequiresRevision(true);
}
return this.save(student);
}
public List<Student> findByVerificationStatus(VerificationStatus status) {
return studentRepository.findByVerificationStatus(status);
}
......
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