Skip to content

Commit

Permalink
Merge pull request #264 from bcgov/feature/GRAD2-3098
Browse files Browse the repository at this point in the history
GRAD2-3098 - Update DTOs, entities and related code in ASSESSMENT-API
  • Loading branch information
mightycox authored Dec 2, 2024
2 parents b34decc + 2d0c302 commit 6f9284d
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 85 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package ca.bc.gov.educ.api.assessment.model.dto;

import jakarta.validation.constraints.NotBlank;
import lombok.Data;

@Data
public class BaseDTO {
private String createUser;
private String createDate;
@NotBlank(message = "updateUser must not be null or empty")
private String updateUser;
private String updateDate;
}
106 changes: 30 additions & 76 deletions api/src/main/java/ca/bc/gov/educ/api/assessment/model/dto/School.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,85 +5,39 @@

@Data
@Component
public class School {

private String minCode;
private String schoolName;
private String districtName;
private String transcriptEligibility;
private String certificateEligibility;
private String independentDesignation;
private String mailerType;
private String address1;
private String address2;
private String city;
private String provCode;
private String provinceName;
private String countryCode;
private String countryName;
private String postal;
private String independentAffiliation;
private String openFlag;
private String signatureDistrict;
public class School extends BaseDTO{

private String schoolId;
private String districtId;
private String mincode;
private String independentAuthorityId;
private String schoolNumber;
private String faxNumber;
private String phoneNumber;
private String email;
private String website;
private String displayName;
private String displayNameNoSpecialChars;
private String schoolReportingRequirementCode;
private String schoolOrganizationCode;
private String schoolCategoryCode;
private String facilityTypeCode;
private String openedDate;
private String closedDate;
private boolean canIssueTranscripts;
private boolean canIssueCertificates;

public String getSchoolName() {
return schoolName != null ? schoolName.trim(): null;
}

public String getDistrictName() {
return districtName != null ? districtName.trim(): null;
}

public String getAddress1() {
return address1 != null ? address1.trim(): null;
}

public String getAddress2() {
return address2 != null ? address2.trim(): null;
}

public String getCity() {
return city != null ? city.trim(): null;
}

public String getProvinceName() {
return provinceName != null ? provinceName.trim(): null;
}

public String getCountryName() {
return countryName != null ? countryName.trim(): null;
}

public String getPostal() {
return postal != null ? postal.trim(): null;
}

public String getIndependentDesignation() {
return independentDesignation != null ? independentDesignation.trim(): null;
}

public String getIndependentAffiliation() {
return independentAffiliation != null ? independentAffiliation.trim(): null;
}

public String getOpenFlag() {
return openFlag != null ? openFlag.trim(): null;
}

public String getSignatureDistrict() {
return signatureDistrict != null ? signatureDistrict.trim(): null;
}


@Override
public String toString() {
return "School [minCode=" + minCode + ", schoolName=" + schoolName + ", districtName=" + districtName
+ ", transcriptEligibility=" + transcriptEligibility + ", certificateEligibility="
+ certificateEligibility + ", independentDesignation=" + independentDesignation + ", mailerType="
+ mailerType + ", address1=" + address1 + ", address2=" + address2 + ", city=" + city + ", provCode="
+ provCode + ", provinceName=" + provinceName + ", countryCode=" + countryCode + ", countryName="
+ countryName + ", postal=" + postal + ", independentAffiliation=" + independentAffiliation
+ ", openFlag=" + openFlag + ", signatureDistrict=" + signatureDistrict + "]";
return String.format("School [ schoolId:%s, districtId:%s, mincode:%s, independentAuthorityId:%s, schoolNumber:%s, " +
"faxNumber:%s, phoneNumber:%s, email:%s, website:%s, displayName:%s, displayNameNoSpecialChars:%s, " +
"schoolReportingRequirementCode:%s, schoolOrganizationCode:%s, schoolCategoryCode:%s, facilityTypeCode:%s, " +
"openedDate:%s, closedDate:%s, canIssueTranscripts:%s, canIssueCertificates:%s, createUser:%s, createDate:%s, " +
"updateUser:%s, updateDate:%s ]",
schoolId, districtId, mincode, independentAuthorityId, schoolNumber, faxNumber, phoneNumber, email, website,
displayName, displayNameNoSpecialChars, schoolReportingRequirementCode, schoolOrganizationCode, schoolCategoryCode,
facilityTypeCode, openedDate, closedDate, canIssueTranscripts, canIssueCertificates, getCreateUser(), getCreateDate(),
getUpdateUser(), getUpdateDate());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void populateFields(List<StudentAssessment> studentAssessmentList, Strin
.bodyToMono(School.class)
.block();
if (schObj != null)
sA.setMincodeAssessmentName(schObj.getSchoolName());
sA.setMincodeAssessmentName(schObj.getDisplayName());
sA.setHasMoreInfo(true);
}
});
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ springdoc:
endpoint:
grad-trax-api:
school-name-by-mincode:
url: ${GRAD_TRAX_API}api/v1/trax/school/%s
url: ${GRAD_TRAX_API}api/v2/trax/school/search?mincode=%s
grad-program-api:
rule-detail:
url : ${GRAD_PROGRAM_API}api/v1/program/programrules/%s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public void testGetStudentAssessmentList() {
assessment.setAssessmentName("asdas");

School school = new School();
school.setMinCode("12345678");
school.setSchoolName("Test School");
school.setMincode("12345678");
school.setDisplayName("Test School");

when(studentAssessmentRepo.findByPen(studentAssessmentId.getPen())).thenReturn(List.of(studentAssessmentEntity));
when(assessmentRepo.findByAssessmentCode("LTE10")).thenReturn(Optional.of(assessment));
Expand All @@ -103,7 +103,7 @@ public void testGetStudentAssessmentList() {
StudentAssessment responseStudentAssessment = result.get(0);
assertThat(responseStudentAssessment.getAssessmentCode()).isEqualTo(assessment.getAssessmentCode());
assertThat(responseStudentAssessment.getSpecialCase()).isEqualTo(studentAssessmentEntity.getSpecialCase());
assertThat(responseStudentAssessment.getMincodeAssessmentName()).isEqualTo(school.getSchoolName());
assertThat(responseStudentAssessment.getMincodeAssessmentName()).isEqualTo(school.getDisplayName());
}

@Test
Expand All @@ -124,8 +124,8 @@ public void testGetStudentAssessment() {
assessment.setAssessmentName("asdas");

School school = new School();
school.setMinCode("12345678");
school.setSchoolName("Test School");
school.setMincode("12345678");
school.setDisplayName("Test School");

when(studentAssessmentRepo.findByAssessmentKeyPenAndAssessmentKeyAssessmentCode(studentAssessmentId.getPen(), studentAssessmentId.getAssessmentCode())).thenReturn(List.of(studentAssessmentEntity));
when(assessmentRepo.findByAssessmentCode("LTE10")).thenReturn(Optional.of(assessment));
Expand All @@ -142,6 +142,6 @@ public void testGetStudentAssessment() {
StudentAssessment responseStudentAssessment = result.get(0);
assertThat(responseStudentAssessment.getAssessmentCode()).isEqualTo(assessment.getAssessmentCode());
assertThat(responseStudentAssessment.getSpecialCase()).isEqualTo(studentAssessmentEntity.getSpecialCase());
assertThat(responseStudentAssessment.getMincodeAssessmentName()).isEqualTo(school.getSchoolName());
assertThat(responseStudentAssessment.getMincodeAssessmentName()).isEqualTo(school.getDisplayName());
}
}
2 changes: 1 addition & 1 deletion api/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ springdoc:
endpoint:
grad-trax-api:
school-name-by-mincode:
url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/trax/school/%s
url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/trax/school/search?mincode=%s
grad-program-api:
rule-detail:
url : https://educ-grad-program-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/program/programrules/%s
Expand Down

0 comments on commit 6f9284d

Please sign in to comment.