Commit c822ce2d authored by Deep Dey's avatar Deep Dey

feat: add api to set interview for candidate

parent b57f1d23
...@@ -68,6 +68,39 @@ public class AdmissionFormController { ...@@ -68,6 +68,39 @@ public class AdmissionFormController {
HttpStatus.OK); HttpStatus.OK);
} }
@GetMapping(
value = "/admission-form/set-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 setAdmissionInterview(
HttpServletRequest request,
@RequestHeader("apikey") String apiKey,
@RequestParam(defaultValue = "0" ) Long formId,
@RequestParam("interactionDate") String interactionDate,
@RequestParam("interactionTime") String interactionTime
) throws Exception {
if (!admissionFormDAOController
.updateInteractionDateTime(formId, interactionDate, interactionTime)) {
throw new Exception("Failed to set interview date and time");
}
return new ResponseEntity<>(
new GeneralResponse(
true,
AppConstants.RESPONSE_SUCCESS_STATUS_CODE,
"Interview Date and Time Set Successfully",
null
),
HttpStatus.OK);
}
@GetMapping( @GetMapping(
value = "/admission-form/get-all", value = "/admission-form/get-all",
produces = MediaType.APPLICATION_JSON_VALUE produces = MediaType.APPLICATION_JSON_VALUE
......
...@@ -64,4 +64,13 @@ public class AdmissionFormDAOController { ...@@ -64,4 +64,13 @@ public class AdmissionFormDAOController {
return admissionFormDataRepository.getAdmissionFormDataListByIds(idList); return admissionFormDataRepository.getAdmissionFormDataListByIds(idList);
} }
public boolean updateInteractionDateTime(
Long id,
String interactionDate,
String interactionTime
) {
return admissionFormDataRepository
.updateInteractionDateTime(id, interactionDate, interactionTime);
}
} }
...@@ -152,4 +152,20 @@ public class AdmissionFormDataRepository { ...@@ -152,4 +152,20 @@ public class AdmissionFormDataRepository {
return namedParameterJdbcTemplate.query(sql, parameters, new AdmissionFormMapper()); return namedParameterJdbcTemplate.query(sql, parameters, new AdmissionFormMapper());
} }
public boolean updateInteractionDateTime(
Long admissionFormId,
String interactionDate,
String interactionTime
) {
String sql = "UPDATE admission_form_data SET interaction_date = :interactionDate, interaction_time = :interactionTime WHERE id = :admissionFormId";
MapSqlParameterSource params =
new MapSqlParameterSource()
.addValue("interactionDate", interactionDate)
.addValue("interactionTime", interactionTime)
.addValue("admissionFormId", admissionFormId);
int rowsAffected = namedParameterJdbcTemplate.update(sql, params);
return rowsAffected > 0;
}
} }
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