Commit 89e585a9 authored by Pratik Shrivastava's avatar Pratik Shrivastava

feat: add set-special-admission-interview API

parent fd80213d
Pipeline #332 failed with stages
......@@ -158,7 +158,7 @@ public class AdmissionFormController {
}
@GetMapping(
value = "/admission-form/set-admission-interview",
value = "/admission-form/set-special-admission-interview",
produces = MediaType.APPLICATION_JSON_VALUE
)
@ApiResponses(value = {
......@@ -167,7 +167,7 @@ public class AdmissionFormController {
@ApiResponse(code = 500, message = "Exception Occurred")
})
@ApiOperation(value = "")
public Object setFinalAdmissionInterview(
public Object setSpecialAdmissionInterview(
HttpServletRequest request,
@RequestHeader("apikey") String apiKey,
@RequestParam(defaultValue = "") String formIds,
......@@ -186,7 +186,7 @@ public class AdmissionFormController {
formIdList.forEach(formId -> {
try {
if (!admissionFormDAOController
.updateAdmissionDateTime(formId, admissionDate, admissionTime)) {
.updateSpecialAdmissionDateTime(formId, admissionDate, admissionTime)) {
partiallyFailed.set(true);
}
} catch (Exception e) {
......@@ -207,6 +207,57 @@ public class AdmissionFormController {
),
HttpStatus.OK);
}
@GetMapping(
value = "/admission-form/set-admission-interview",
produces = MediaType.APPLICATION_JSON_VALUE
)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "SUCCESS"),
@ApiResponse(code = 400, message = "FAILED"),
@ApiResponse(code = 500, message = "Exception Occurred")
})
@ApiOperation(value = "")
public Object setFinalAdmissionInterview(
HttpServletRequest request,
@RequestHeader("apikey") String apiKey,
@RequestParam(defaultValue = "") String formIds,
@RequestParam("admissionDate") String admissionDate,
@RequestParam("admissionTime") String admissionTime
) throws Exception {
List<Long> formIdList = Stream.of(formIds.split(","))
.map(Long::valueOf)
.toList();
if (formIdList.isEmpty()) {
throw new Exception("Provide formIds to schedule interview");
}
AtomicBoolean partiallyFailed = new AtomicBoolean(false);
formIdList.forEach(formId -> {
try {
if (!admissionFormDAOController
.updateAdmissionDateTime(formId, admissionDate, admissionTime)) {
partiallyFailed.set(true);
}
} catch (Exception e) {
partiallyFailed.set(true);
}
});
if (partiallyFailed.get()) {
throw new Exception("For Some of the forms failed to schedule admission");
}
return new ResponseEntity<>(
new GeneralResponse(
true,
AppConstants.RESPONSE_SUCCESS_STATUS_CODE,
"Admission Date and Time Set Successfully",
null
),
HttpStatus.OK);
}
@GetMapping(
value = "/admission-form/get-all",
......
Markdown is supported
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