Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRAD2-3064 - Refactor institute endpoints - Obsolete - DO NOT MERGE #377

Open
wants to merge 2 commits into
base: grad-release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableScheduling;

Expand All @@ -14,6 +15,7 @@
@EnableScheduling
@EnableRetry
@EnableSchedulerLock(defaultLockAtMostFor = "1s")
@EnableJpaRepositories
public class EducGradTraxApiApplication {

private static Logger logger = LoggerFactory.getLogger(EducGradTraxApiApplication.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
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 com.electronwill.nightconfig.core.conversion.Path;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.info.Info;
Expand Down Expand Up @@ -122,12 +123,27 @@ public ResponseEntity<List<SchoolDetail>> getSchoolsBySchoolCategory(@RequestPar
return response.GET(schoolService.getSchoolDetailsBySchoolCategoryCode(schoolCategoryCode));
}

@GetMapping(EducGradTraxApiConstants.GRAD_SCHOOL_DETAIL_URL_MAPPING_V2 + EducGradTraxApiConstants.GET_SCHOOL_BY_CODE_MAPPING)
@GetMapping(EducGradTraxApiConstants.GRAD_SCHOOL_DETAIL_URL_MAPPING_V2 + EducGradTraxApiConstants.GET_SCHOOL_BY_SCHOOL_ID)
@PreAuthorize(PermissionsConstants.READ_SCHOOL_DATA)
@Operation(summary = "Find School Details by ID from cache", description = "Get School Details by ID from cache", tags = { "School" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "204", description = "NO CONTENT")})
public ResponseEntity<SchoolDetail> getSchoolDetailsById(@PathVariable UUID schoolId) {
log.debug("getSchoolDetails V2 : ");
SchoolDetail schoolDetailResponse = schoolService.getSchoolDetailBySchoolId(schoolId);
if(schoolDetailResponse != null) {
return response.GET(schoolDetailResponse);
}else {
return response.NOT_FOUND();
}
}

@GetMapping(EducGradTraxApiConstants.GRAD_SCHOOL_DETAIL_URL_MAPPING_V2 + EducGradTraxApiConstants.GET_SCHOOL_DETAIL_SEARCH_MAPPING)
@PreAuthorize(PermissionsConstants.READ_SCHOOL_DATA)
@Operation(summary = "Find School Details by Mincode from cache", description = "Get School Details by Mincode from cache", tags = { "School" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "204", description = "NO CONTENT")})
public ResponseEntity<SchoolDetail> getSchoolDetailsByMincode(@PathVariable String minCode) {
public ResponseEntity<SchoolDetail> getSchoolDetailsByParams(@RequestParam(required = false) String minCode) {
log.debug("getSchoolDetails V2 : ");
SchoolDetail schoolDetailResponse = schoolService.getSchoolDetailByMincodeFromRedisCache(minCode);
if(schoolDetailResponse != null) {
Expand All @@ -136,15 +152,26 @@ public ResponseEntity<SchoolDetail> getSchoolDetailsByMincode(@PathVariable Stri
return response.NOT_FOUND();
}
}

/**
* School wildcard Search with given params
* @param districtId
* @param mincode
* @param displayName
* @param distNo
* @return
*/
@GetMapping(EducGradTraxApiConstants.GRAD_SCHOOL_URL_MAPPING_V2 + EducGradTraxApiConstants.GET_SCHOOL_SEARCH_MAPPING)
@PreAuthorize(PermissionsConstants.READ_SCHOOL_DATA)
@Operation(summary = "Search for a school", description = "Search for a School", tags = { "School" })
@Operation(summary = "Search for a school v2", description = "Search for a School v2", tags = { "School" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "400", description = "BAD REQUEST")})
public ResponseEntity<List<School>> getSchoolsByParams(
@RequestParam(value = "districtId", required = false) UUID districtId,
@RequestParam(value = "mincode", required = false) String mincode) {
return response.GET(schoolService.getSchoolsByParams(districtId, mincode));
@RequestParam(value = "districtId", required = false) String districtId,
@RequestParam(value = "mincode", required = false) String mincode,
@RequestParam(value = "displayName", required = false) String displayName,
@RequestParam(value = "distNo", required = false) String distNo)
{
return response.GET(schoolService.getSchoolsByParams(districtId, mincode, displayName, distNo));
}

}
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

import java.io.Serializable;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("DistrictAddress")
public class DistrictAddressEntity {
public class DistrictAddressEntity implements Serializable {

@Id
private String districtAddressId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

import java.io.Serializable;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("DistrictContact")
public class DistrictContactEntity {
public class DistrictContactEntity implements Serializable {

@Id
private String districtContactId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

import java.util.List;

@Entity(name = "districtRedisEntity")
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("District")
public class DistrictEntity {

@org.springframework.data.annotation.Id
@Id
private String districtId;
@Indexed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

import java.io.Serializable;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("Grade")
public class GradeEntity {
public class GradeEntity implements Serializable {

@Id
private String schoolGradeId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

import java.io.Serializable;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("NeighborhoodLearning")
public class NeighborhoodLearningEntity {
public class NeighborhoodLearningEntity implements Serializable {

@Id
private String neighborhoodLearningId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

import java.io.Serializable;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("Note")
public class NoteEntity {
public class NoteEntity implements Serializable {

@Id
private String noteId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

import java.io.Serializable;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("SchoolAddress")
public class SchoolAddressEntity {
public class SchoolAddressEntity implements Serializable {

@Id
private String schoolAddressId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("SchoolCategoryCode")
public class SchoolCategoryCodeEntity {

@org.springframework.data.annotation.Id
@Id
private String schoolCategoryCode;
private String label;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

import java.io.Serializable;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("SchoolContact")
public class SchoolContactEntity {
public class SchoolContactEntity implements Serializable {

@Id
private String schoolContactId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

import java.util.List;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("SchoolDetail")
public class SchoolDetailEntity {

@org.springframework.data.annotation.Id
@Id
private String schoolId;
@Indexed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

@Entity(name = "schoolRedisEntity")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@RedisHash("School")
public class SchoolEntity {

@org.springframework.data.annotation.Id
@Id
private String schoolId;
@Indexed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("SchoolFundingGroupCode")
public class SchoolFundingGroupCodeEntity {

@org.springframework.data.annotation.Id
@Id
private String schoolFundingGroupCode;
private String label;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package ca.bc.gov.educ.api.trax.model.entity.institute;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

import java.io.Serializable;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@RedisHash("SchoolFundingGroup")
public class SchoolFundingGroupEntity {
public class SchoolFundingGroupEntity implements Serializable {

@org.springframework.data.annotation.Id
@Id
private String schoolFundingGroupID;
@Indexed
Expand Down
Loading
Loading