Skip to content

Commit

Permalink
Student Lesson Regis Endpoint Fixes (#98)
Browse files Browse the repository at this point in the history
* getStudentLessonRegistrationDetailByStudentId Method Has Been Updated to getStudentLessonRegistrationIdByStudentId Method

* getStudentLessonRegistrationDetailByRegistrationId and getStudentLessonRegistrationIdByStudentId Methods Endpoints Have Been Fixed
agitrubard authored May 1, 2022
1 parent 464f847 commit 196e140
Showing 4 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -23,7 +23,6 @@

import static com.graduationproject.studentinformationsystem.common.config.SisSwaggerConfiguration.STUDENT_LESSON_REGISTRATION_API_TAG;
import static com.graduationproject.studentinformationsystem.common.util.controller.endpoint.SisControllerEndpoint.Path.STUDENT_LESSON_REGISTRATION;
import static com.graduationproject.studentinformationsystem.common.util.controller.response.SisResponseUtil.failResponse;
import static com.graduationproject.studentinformationsystem.common.util.controller.response.SisResponseUtil.successResponse;

@RestController
@@ -44,7 +43,7 @@ public ResponseEntity<SisBaseApiResponse<List<StudentLessonRegistrationResponse>
return successResponse(registrationResponses);
}

@GetMapping(StudentLessonRegistrationControllerEndpoint.BY_REGISTRATION_ID)
@GetMapping(StudentLessonRegistrationControllerEndpoint.DETAIL_BY_REGISTRATION_ID)
@ApiOperation(value = "Get Student Lesson Registration By Registration ID")
public ResponseEntity<SisBaseApiResponse<StudentLessonRegistrationDetailResponse>> getStudentLessonRegistrationDetailByRegistrationId(
@PathVariable final String registrationId) throws SisNotExistException {
@@ -54,15 +53,14 @@ public ResponseEntity<SisBaseApiResponse<StudentLessonRegistrationDetailResponse
return successResponse(registrationDetailResponse);
}

@GetMapping(StudentLessonRegistrationControllerEndpoint.BY_STUDENT_ID)
@GetMapping(StudentLessonRegistrationControllerEndpoint.ID_BY_STUDENT_ID)
@ApiOperation(value = "Get Student Lesson Registrations Detail By Student ID")
public ResponseEntity<SisBaseApiResponse<Object>> getStudentLessonRegistrationDetailByStudentId(
public ResponseEntity<SisBaseApiResponse<String>> getStudentLessonRegistrationIdByStudentId(
@PathVariable @StudentID final Long studentId)
throws SisNotExistException {

final StudentLessonRegistrationDetailResponse registrationDetailResponse = studentLessonRegistrationService
.getStudentLessonRegistrationDetailByStudentId(studentId);
return successResponse(registrationDetailResponse);
final String registrationId = studentLessonRegistrationService.getStudentLessonRegistrationIdByStudentId(studentId);
return successResponse(registrationId);
}

@PostMapping(StudentLessonRegistrationControllerEndpoint.SAVE)
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@ public class StudentLessonRegistrationControllerEndpoint {
private StudentLessonRegistrationControllerEndpoint() {
}

public static final String BY_REGISTRATION_ID = "/{registrationId}";
public static final String BY_STUDENT_ID = "/{studentId}";
public static final String DETAIL_BY_REGISTRATION_ID = "/detail/{registrationId}";
public static final String ID_BY_STUDENT_ID = "/id/{studentId}";
public static final String SAVE = "/save";
public static final String APPROVE = "/approve";
public static final String REJECT = "/reject";
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ public interface StudentLessonRegistrationService {
StudentLessonRegistrationDetailResponse getStudentLessonRegistrationDetailByRegistrationId(String registrationId)
throws SisNotExistException;

StudentLessonRegistrationDetailResponse getStudentLessonRegistrationDetailByStudentId(Long studentId)
String getStudentLessonRegistrationIdByStudentId(Long studentId)
throws SisNotExistException;

StudentLessonRegistrationDetailResponse saveStudentLessonRegistration(StudentLessonRegistrationSaveRequest saveRequest)
Original file line number Diff line number Diff line change
@@ -58,18 +58,16 @@ public StudentLessonRegistrationDetailResponse getStudentLessonRegistrationDetai
}

@Override
public StudentLessonRegistrationDetailResponse getStudentLessonRegistrationDetailByStudentId(final Long studentId)
public String getStudentLessonRegistrationIdByStudentId(final Long studentId)
throws SisNotExistException {

ifStudentIsNotExistThrowNotExistException(studentId);

final String registrationId = studentLessonRegistrationRepository.getRegistrationId(studentId);
ifStudentLessonRegistrationIsNotExistThrowNotExistException(registrationId);

final StudentLessonRegistrationEntity registrationEntity = studentLessonRegistrationRepository
.getStudentLessonRegistrationByRegistrationId(registrationId);
ifStudentLessonRegistrationIsNotExistThrowNotExistException(registrationId);

return studentLessonRegistrationInfoConverter.entityToResponse(registrationEntity);
return registrationId;
}

@Override

0 comments on commit 196e140

Please sign in to comment.