Skip to content

Commit

Permalink
GRAD2-2587 (#319)
Browse files Browse the repository at this point in the history
* GRAD2-2587

* GRAD2-2587
  • Loading branch information
kamal-mohammed authored Apr 4, 2024
1 parent 1375dbd commit 3c6aaab
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,12 @@ public ResponseEntity<TraxStudentNo> saveTraxStudentNo(@RequestBody TraxStudentN
logger.debug("saveTraxStudentNo : ");
return response.GET(traxCommonService.saveTraxStudentNo(traxStudentNo));
}

@DeleteMapping(EducGradTraxApiConstants.DELETE_TRAX_STUDENT_NO_MAPPING)
@PreAuthorize(PermissionsConstants.UPDATE_GRAD_TRAX_STUDENT_DATA)
@Operation(summary = "Delete TraxStudentNo", description = "Delete TraxStudentNo ", tags = {"Student"})
public ResponseEntity<TraxStudentNo> deleteTraxStudentNo(@PathVariable String pen) {
logger.debug("deleteTraxStudentNo : ");
return response.GET(traxCommonService.deleteTraxStudentNo(pen));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ public interface TraxStudentNoRepository extends PagingAndSortingRepository<Trax
Optional<TraxStudentNoEntity> findById(String studNo);

TraxStudentNoEntity save(TraxStudentNoEntity entity);

Optional<TraxStudentNoEntity> deleteById(String studNo);
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ public TraxStudentNo saveTraxStudentNo(TraxStudentNo traxStudentNo) {
return traxStudentNo;
}

@Transactional
public TraxStudentNo deleteTraxStudentNo(String pen) {
Optional<TraxStudentNoEntity> optional = traxStudentNoRepository.findById(pen);
if (optional.isPresent()) {
return traxStudentNoTransformer.transformToDTO(traxStudentNoRepository.deleteById(pen));
}
return null;
}

private List<ConvGradStudent> buildConversionGradStudents(List<Object[]> traxStudents) {
List<ConvGradStudent> students = new ArrayList<>();
traxStudents.forEach(result -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class EducGradTraxApiConstants {
public static final String GET_COURSE_RESTRICTION_LIST_MAPPING = "/course-restrictions";
public static final String GET_COURSE_REQUIREMENT_LIST_MAPPING = "/course-requirements";
public static final String POST_SAVE_TRAX_STUDENT_NO_MAPPING = "/trax-student-no";
public static final String DELETE_TRAX_STUDENT_NO_MAPPING = "/trax-student-no/{pen}";

//Default Attribute value constants
public static final String DEFAULT_CREATED_BY = "API_GRAD_TRAX";
Expand Down

0 comments on commit 3c6aaab

Please sign in to comment.