-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/grad-release' into GRAD2-2768
- Loading branch information
Showing
30 changed files
with
913 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
api/src/main/java/ca/bc/gov/educ/api/trax/controller/v2/DistrictController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package ca.bc.gov.educ.api.trax.controller.v2; | ||
|
||
import ca.bc.gov.educ.api.trax.model.dto.institute.District; | ||
import ca.bc.gov.educ.api.trax.service.institute.DistrictService; | ||
import ca.bc.gov.educ.api.trax.util.EducGradTraxApiConstants; | ||
import ca.bc.gov.educ.api.trax.util.GradValidation; | ||
import ca.bc.gov.educ.api.trax.util.PermissionsConstants; | ||
import ca.bc.gov.educ.api.trax.util.ResponseHelper; | ||
import io.swagger.v3.oas.annotations.OpenAPIDefinition; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.info.Info; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.security.SecurityRequirement; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
@CrossOrigin | ||
@RestController("districtControllerV2") | ||
@Slf4j | ||
@OpenAPIDefinition(info = @Info(title = "API for School Data.", description = "This Read API is for Reading school data.", version = "2"), | ||
security = {@SecurityRequirement(name = "OAUTH2", scopes = {"READ_GRAD_SCHOOL_DATA"})}) | ||
public class DistrictController { | ||
|
||
DistrictService districtService; | ||
GradValidation validation; | ||
ResponseHelper response; | ||
|
||
@Autowired | ||
public DistrictController(DistrictService districtService, GradValidation validation, ResponseHelper response) { | ||
this.districtService = districtService; | ||
this.validation = validation; | ||
this.response = response; | ||
} | ||
|
||
@GetMapping(EducGradTraxApiConstants.GRAD_DISTRICT_URL_MAPPING_V2 + EducGradTraxApiConstants.GET_DISTRICT_BY_DISTNO_MAPPING) | ||
@PreAuthorize(PermissionsConstants.READ_SCHOOL_DATA) | ||
@Operation(summary = "Find a District by District Number V2", description = "Get District by District Number V2", tags = { "District" }) | ||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")}) | ||
public ResponseEntity<District> getDistrictDetailsByDistNo(@PathVariable String distNo) { | ||
if(distNo.length() <=3) { | ||
District distResponse = districtService.getDistrictByDistNoFromRedisCache(distNo); | ||
if (distResponse != null) { | ||
return response.GET(distResponse); | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
@GetMapping(EducGradTraxApiConstants.GRAD_DISTRICT_URL_MAPPING_V2 + EducGradTraxApiConstants.GET_DISTRICTS_BY_SCHOOL_CATEGORY_MAPPING) | ||
@PreAuthorize(PermissionsConstants.READ_SCHOOL_DATA) | ||
@Operation(summary = "Get District by school category code V2", description = "Get District by school category code V2", tags = { "School" }) | ||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), | ||
@ApiResponse(responseCode = "204", description = "NO CONTENT")}) | ||
public ResponseEntity<List<District>> getDistrictsBySchoolCategoryCode(@RequestParam(required = false) String schoolCategoryCode) { | ||
return response.GET(districtService.getDistrictsBySchoolCategoryCode(schoolCategoryCode)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
api/src/main/java/ca/bc/gov/educ/api/trax/repository/redis/SchoolDetailRedisRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
package ca.bc.gov.educ.api.trax.repository.redis; | ||
|
||
import ca.bc.gov.educ.api.trax.model.entity.institute.SchoolDetailEntity; | ||
import ca.bc.gov.educ.api.trax.model.entity.institute.SchoolEntity; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface SchoolDetailRedisRepository extends CrudRepository<SchoolDetailEntity, String> { | ||
String HASH_KEY = "SchoolDetail"; | ||
|
||
List<SchoolDetailEntity> findBySchoolCategoryCode(String schoolCategoryCode); | ||
|
||
SchoolDetailEntity findByMincode(String mincode); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.