Skip to content

Commit

Permalink
Merge pull request #590 from bcgov/feature/GRAD2-2389
Browse files Browse the repository at this point in the history
GRAD2-2389, 2390, 2412: task is complete.
  • Loading branch information
infstar authored Nov 30, 2023
2 parents 641a0f5 + 170090f commit 209fe29
Show file tree
Hide file tree
Showing 10 changed files with 450 additions and 90 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package ca.bc.gov.educ.api.gradstudent.constant;

public enum FieldName {
SCHOOL_OF_RECORD,
GRAD_PROGRAM,
ADULT_START_DATE,
SLP_DATE,
STUDENT_GRADE,
CITIZENSHIP,
STUDENT_STATUS,

RECALC_GRAD_ALG,
RECALC_TVR

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ca.bc.gov.educ.api.gradstudent.constant;

public enum FieldType {
STRING,
DATE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package ca.bc.gov.educ.api.gradstudent.constant;

public enum TraxEventType {
/* ===========================================================
Incremental updates from Trax to Grad
=============================================================*/
/**
* Trax update type
*/
NEWSTUDENT,
UPD_DEMOG,
UPD_GRAD,
UPD_STD_STATUS,
XPROGRAM,
ASSESSMENT,
COURSE,
FI10ADD
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,20 @@ public class DataConversionController {
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<GraduationStudentRecord> saveStudentGradStatus(@PathVariable String studentID,
@RequestParam(value = "ongoingUpdate", required = false, defaultValue = "false") boolean ongoingUpdate,
@RequestBody GraduationStudentRecord graduationStatus,
@RequestHeader(name="Authorization") String accessToken) {
@RequestBody GraduationStudentRecord graduationStatus) {
logger.debug("Save Graduation Student Record for Student ID");
var result = dataConversionService.saveGraduationStudentRecord(UUID.fromString(studentID),graduationStatus, ongoingUpdate, accessToken.replace(BEARER, ""));
var result = dataConversionService.saveGraduationStudentRecord(UUID.fromString(studentID),graduationStatus, ongoingUpdate);
return response.GET(result);
}

@PostMapping(EducGradStudentApiConstants.CONV_GRADUATION_STATUS_FOR_ONGOING_UPDATES)
@PreAuthorize(PermissionsConstants.UPDATE_GRADUATION_STUDENT)
@Operation(summary = "Update Graduation Status At Field Level for Ongoing Updates", description = "Update Graduation Status At Field Level for Ongoing Updates", tags = { "Data Conversion" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<GraduationStudentRecord> updateGraduationStatusForOngoingUpdates(@RequestBody OngoingUpdateRequestDTO requestDTO,
@RequestHeader(name="Authorization") String accessToken) {
logger.debug("Save Graduation Student Record for Student ID");
var result = dataConversionService.updateGraduationStatusByFields(requestDTO, accessToken.replace(BEARER, ""));
return response.GET(result);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package ca.bc.gov.educ.api.gradstudent.model.dto;

import ca.bc.gov.educ.api.gradstudent.constant.FieldName;
import ca.bc.gov.educ.api.gradstudent.constant.FieldType;
import lombok.Builder;
import lombok.Data;

import java.util.Objects;

@Builder
@Data
public class OngoingUpdateFieldDTO {
private FieldType type;
private FieldName name;
private Object value;

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OngoingUpdateFieldDTO that = (OngoingUpdateFieldDTO) o;
return getName() == that.getName();
}

@Override
public int hashCode() {
return Objects.hash(getName());
}

@Override
public String toString() {
return "OngoingUpdateFieldDTO{" +
"type=" + type +
", name=" + name +
", value=" + value +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ca.bc.gov.educ.api.gradstudent.model.dto;

import ca.bc.gov.educ.api.gradstudent.constant.TraxEventType;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@NoArgsConstructor
@Data
public class OngoingUpdateRequestDTO {
private String studentID;
private String pen;
private TraxEventType eventType;
private List<OngoingUpdateFieldDTO> updateFields = new ArrayList<>();
}
Loading

0 comments on commit 209fe29

Please sign in to comment.