Skip to content

Commit

Permalink
GRAD2-3162: the new endpoint to search school-clob by mincode. (#382)
Browse files Browse the repository at this point in the history
GRAD2-3162: the new endpoint to search school-clob by mincode.
  • Loading branch information
infstar authored Dec 5, 2024
1 parent 3337804 commit 0c150af
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ public ResponseEntity<School> getSchoolForClobDataBySchoolId(@PathVariable UUID
}
}

@GetMapping(EducGradTraxApiConstants.GRAD_SCHOOL_CLOB_URL_MAPPING_V2 + EducGradTraxApiConstants.GET_SCHOOL_SEARCH_MAPPING)
@PreAuthorize(PermissionsConstants.READ_SCHOOL_DATA)
@Operation(summary = "Find a School Clob data by MinCode for GRAD Algorithm Data from cache", description = "Get a School Clob data by MinCode for GRAD Algorithm Data from cache", tags = { "Algorithm Data" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "400", description = "BAD REQUEST"),
@ApiResponse(responseCode = "422", description = "UNPROCESSABLE CONTENT"),
@ApiResponse(responseCode = "204", description = "NO CONTENT")})
public ResponseEntity<School> getSchoolForClobDataByMinCode(@RequestParam(value = "mincode", required = false) String mincode) {
log.debug("getSchoolClobData by minCode: {}", mincode);
return response.GET(commonService.getSchoolForClobDataByMinCodeFromRedisCache(mincode));

}

@GetMapping(EducGradTraxApiConstants.GRAD_SCHOOLS_BY_DISTRICT_URL_MAPPING_V2 + EducGradTraxApiConstants.GET_DISTRICT_BY_DISTNO_MAPPING)
@PreAuthorize(PermissionsConstants.READ_SCHOOL_DATA)
@Operation(summary = "Find Schools Clob data by District Number for GRAD Algorithm Data from cache", description = "Get Schools Clob data by District Number for GRAD Algorithm Data from cache", tags = { "Algorithm Data" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,18 @@ public void testGetSchoolClobData_whenMinCode_isNot_Found() {
Mockito.verify(commonService).getSchoolForClobDataBySchoolIdFromRedisCache(schoolId);
}

@Test
public void testGetSchoolClobDataByParams() {
School school = new School();
UUID schoolId = UUID.randomUUID();
school.setSchoolId(schoolId.toString());
school.setSchoolName("Test School");
school.setMinCode("12345678");

Mockito.when(commonService.getSchoolForClobDataByMinCodeFromRedisCache(school.getMinCode())).thenReturn(school);
commonController.getSchoolForClobDataByMinCode(school.getMinCode());
Mockito.verify(commonService).getSchoolForClobDataByMinCodeFromRedisCache(school.getMinCode());
}


}

0 comments on commit 0c150af

Please sign in to comment.