Skip to content

Commit

Permalink
Merge pull request #319 from bcgov/GRAD2-2465-km
Browse files Browse the repository at this point in the history
GRAD2-2465 - Delete a student and related data
  • Loading branch information
arybakov-cgi authored Mar 18, 2024
2 parents 7caeeb9 + 895e189 commit e69aa06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ca.bc.gov.educ.api.dataconversion.service.student;

import ca.bc.gov.educ.api.dataconversion.model.*;
import ca.bc.gov.educ.api.dataconversion.util.EducGradDataConversionApiConstants;
import ca.bc.gov.educ.api.dataconversion.util.RestUtils;
import io.github.resilience4j.retry.annotation.Retry;
import jakarta.transaction.Transactional;
Expand All @@ -12,7 +11,6 @@
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;

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

Expand All @@ -36,7 +34,7 @@ public Student getStudentByPen(String pen, String accessToken) {
logger.debug("Get Student by PEN [Service]");

Student student;
List<Student> gradStudentList = new ArrayList<>();
List<Student> gradStudentList;

try {
gradStudentList = restUtils.getStudentsByPen(pen, accessToken);
Expand Down Expand Up @@ -83,7 +81,7 @@ Delete All student related data ({STUDENT_API}/api/v1/student/conv/studentid/{st
/*
Update TRAX_STUDENT_NO status to NULL
*/
restUtils.updateTraxStudentNo(pen, accessToken);
restUtils.updateTraxStudentNo(new TraxStudentNo(pen, null, null), accessToken);
}
return pen;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class RestUtils {

private final EducGradDataConversionApiConstants constants;

private ResponseObjCache responseObjCache;
private final ResponseObjCache responseObjCache;

private final WebClient webClient;

Expand Down Expand Up @@ -360,13 +360,14 @@ public TraxStudentNo saveTraxStudentNo(TraxStudentNo traxStudentNo, String acces
.retrieve().bodyToMono(TraxStudentNo.class).block();
}

public TraxStudentNo updateTraxStudentNo(String pen, String accessToken) {
public TraxStudentNo updateTraxStudentNo(TraxStudentNo traxStudentNo, String accessToken) {
return webClient.put()
.uri(String.format(constants.getSaveTraxStudentNoUrl(), pen))
.uri(constants.getSaveTraxStudentNoUrl())
.headers(h -> {
h.setBearerAuth(accessToken);
h.set(EducGradDataConversionApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID());
})
.body(BodyInserters.fromValue(traxStudentNo))
.retrieve().bodyToMono(TraxStudentNo.class).block();
}

Expand Down

0 comments on commit e69aa06

Please sign in to comment.