Skip to content

Commit

Permalink
elinks:make active flag false in user profile when profile received i…
Browse files Browse the repository at this point in the history
…n elinks deleted api (#711)

* active flag changes

* active flag changes

* active flag changes

* active flag changes

* fixing build issues

* fixing build

* fixing Pr build

* fixing pr build

---------

Co-authored-by: vasthav-patta <112877261+vasthav-patta@users.noreply.github.com>
  • Loading branch information
arshinsalim and vasthav-patta authored Jan 16, 2024
1 parent 30f8bfc commit 604cf43
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions config/owasp/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<cve>CVE-2023-5590</cve>
<cve>CVE-2023-4586</cve>
<cve>CVE-2023-36052</cve>
<cve>CVE-2023-33202</cve>
<cve>CVE-2023-34055</cve>
<cve>CVE-2023-46589</cve>
<cve>CVE-2023-6378</cve>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ void verifyDeletedJrdAuditFunctionality() {
assertEquals(false, userprofile.get(13).getDeletedFlag());
assertEquals("2022-07-10", userprofile.get(13).getDeletedOn().toLocalDate().toString());


List<ElinkDataSchedularAudit> elinksAudit = elinkSchedularAuditRepository.findAll();

ElinkDataSchedularAudit auditEntry = elinksAudit.get(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNull;
import static uk.gov.hmcts.reform.judicialapi.elinks.util.RefDataElinksConstants.BASE_LOCATION_DATA_LOAD_SUCCESS;
import static uk.gov.hmcts.reform.judicialapi.elinks.util.RefDataElinksConstants.LOCATIONAPI;
Expand Down Expand Up @@ -225,9 +224,7 @@ private void validateUserProfile() {
assertEquals("Jones", userprofile.get(12).getSurname());
assertEquals("District Judge Rachel Jones", userprofile.get(12).getFullName());
assertEquals(null, userprofile.get(12).getPostNominals());
assertEquals("DJ.Rachel.Jones@ejudiciary.net",
userprofile.get(12).getEmailId());
assertTrue(userprofile.get(12).getActiveFlag());
assertEquals("DJ.Rachel.Jones@ejudiciary.net", userprofile.get(12).getEmailId());
assertEquals("5f8b26ba-0c8b-4192-b5c7-311d737f0cae", userprofile.get(12).getObjectId());
assertNull(userprofile.get(12).getSidamId());
assertEquals("RJ",userprofile.get(12).getInitials());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ private void validateDeletedData(List<ElinkDataSchedularAudit> elinksAudit) {
assertEquals(2, deletedUserProfile.size());
assertEquals("4913085", deletedUserProfile.get(0).getPersonalCode());
assertEquals(true, deletedUserProfile.get(0).getDeletedFlag());
assertEquals(false, deletedUserProfile.get(0).getActiveFlag());
assertEquals("2023-07-13",deletedUserProfile.get(0).getDeletedOn().toLocalDate().toString());
assertNotNull(deletedUserProfile.get(0).getLastLoadedDate());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ private void validateDeleted(List<ElinkDataSchedularAudit> elinksAudit) {
assertEquals(2, deletedUserProfile.size());
assertEquals("4913085", deletedUserProfile.get(1).getPersonalCode());
assertEquals(true, deletedUserProfile.get(1).getDeletedFlag());
assertEquals(false, deletedUserProfile.get(1).getActiveFlag());
assertEquals("2023-07-13",deletedUserProfile.get(1).getDeletedOn().toLocalDate().toString());

ElinkDataSchedularAudit auditEntry = elinksAudit.get(3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ public void updateDeleted(List<DeletedResponse> deletedResponse) {
List<Triple<String, String, String>> deletedId = new ArrayList<>();

String updateDeletedId = "UPDATE dbjudicialdata.judicial_user_profile SET date_of_deletion = Date(?) , "
+ "deleted_flag = ? WHERE personal_code = ?";
+ "deleted_flag = ?,active_flag=false WHERE personal_code = ?";

deletedResponse.stream().filter(request -> nonNull(request.getPersonalCode())).forEach(s ->
deletedId.add(Triple.of(s.getPersonalCode(), s.getDeleted(), s.getDeletedOn())));
Expand Down

0 comments on commit 604cf43

Please sign in to comment.