-
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.
Creates endpoint for fetching student merges
- Loading branch information
1 parent
24de8e2
commit ca134f1
Showing
8 changed files
with
188 additions
and
0 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
24 changes: 24 additions & 0 deletions
24
api/src/main/java/ca/bc/gov/educ/eas/api/controller/v1/PENRecordController.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,24 @@ | ||
package ca.bc.gov.educ.eas.api.controller.v1; | ||
|
||
import ca.bc.gov.educ.eas.api.endpoint.v1.PENRecordEndpoint; | ||
import ca.bc.gov.educ.eas.api.service.v1.PENRecordService; | ||
import ca.bc.gov.educ.eas.api.struct.v1.StudentMerge; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@Slf4j | ||
@RestController | ||
public class PENRecordController implements PENRecordEndpoint { | ||
private final PENRecordService penRecordService; | ||
|
||
public PENRecordController(PENRecordService penRecordService){ | ||
this.penRecordService = penRecordService; | ||
} | ||
|
||
@Override | ||
public List<StudentMerge> getMergedStudentsForDateRange(String createDateStart, String createDateEnd){ | ||
return penRecordService.getMergedStudentsForDateRange(createDateStart, createDateEnd); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
api/src/main/java/ca/bc/gov/educ/eas/api/endpoint/v1/PENRecordEndpoint.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,25 @@ | ||
package ca.bc.gov.educ.eas.api.endpoint.v1; | ||
|
||
import ca.bc.gov.educ.eas.api.constants.v1.URL; | ||
import ca.bc.gov.educ.eas.api.struct.v1.StudentMerge; | ||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
|
||
import java.util.List; | ||
|
||
@RequestMapping(URL.BASE_URL + "/pen-records/createDateInRange") | ||
public interface PENRecordEndpoint { | ||
|
||
@GetMapping() | ||
@PreAuthorize("hasAuthority('SCOPE_READ_EAS_STUDENT')") | ||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")}) | ||
@Tag(name = "PEN Records", description = "Endpoints to retrieve PEN records.") | ||
List<StudentMerge> getMergedStudentsForDateRange(@RequestParam(name = "createDateStart") String createDateStart, @RequestParam(name = "createDateEnd") String createDateEnd) throws JsonProcessingException; | ||
|
||
} |
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
24 changes: 24 additions & 0 deletions
24
api/src/main/java/ca/bc/gov/educ/eas/api/service/v1/PENRecordService.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,24 @@ | ||
package ca.bc.gov.educ.eas.api.service.v1; | ||
|
||
import ca.bc.gov.educ.eas.api.rest.RestUtils; | ||
import ca.bc.gov.educ.eas.api.struct.v1.StudentMerge; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@Service | ||
public class PENRecordService { | ||
|
||
private final RestUtils restUtils; | ||
|
||
@Autowired | ||
public PENRecordService(RestUtils restUtils){ | ||
this.restUtils = restUtils; | ||
} | ||
|
||
public List<StudentMerge> getMergedStudentsForDateRange(String createDateStart, String createDateEnd){ | ||
return restUtils.getMergedStudentsForDateRange(UUID.randomUUID(), createDateStart, createDateEnd); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
api/src/main/java/ca/bc/gov/educ/eas/api/struct/v1/StudentMerge.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,52 @@ | ||
package ca.bc.gov.educ.eas.api.struct.v1; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* The type Student merge. | ||
*/ | ||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
@SuperBuilder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class StudentMerge extends BaseRequest implements Serializable { | ||
/** | ||
* The constant serialVersionUID. | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* The Student merge id. | ||
*/ | ||
String studentMergeID; | ||
/** | ||
* The Student id. | ||
*/ | ||
@NotNull(message = "Student ID can not be null.") | ||
String studentID; | ||
/** | ||
* The Merge student id. | ||
*/ | ||
@NotNull(message = "Merge Student ID can not be null.") | ||
String mergeStudentID; | ||
/** | ||
* The Student merge direction code. | ||
*/ | ||
@NotNull(message = "Student Merge Direction Code can not be null.") | ||
String studentMergeDirectionCode; | ||
/** | ||
* The Student merge source code. | ||
*/ | ||
@NotNull(message = "Student Merge Source Code can not be null.") | ||
String studentMergeSourceCode; | ||
} |
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