FINERACT-2169: Refactor staff api controller;

This commit is contained in:
viktorpavlenko
2025-04-24 14:02:27 +02:00
committed by Adam Saghy
parent e5a23406ca
commit c069a6bf3c
9 changed files with 101 additions and 123 deletions
@@ -238,11 +238,6 @@ public class StaffTest {
/** Long mobileNo test */
map.put("mobileNo", Utils.uniqueRandomStringGenerator("num_", 47));
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
map.remove("mobileNo");
/** Test unsupported parameter */
map.put("xyz", "xyz");
StaffHelper.updateStaff(requestSpec, responseSpecForValidationError, 1, map);
}
@Test
@@ -21,7 +21,7 @@ package org.apache.fineract.integrationtests.client;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Optional;
import org.apache.fineract.client.models.PostStaffRequest;
import org.apache.fineract.client.models.StaffRequest;
import org.apache.fineract.integrationtests.common.Utils;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -52,14 +52,14 @@ public class StaffTest extends IntegrationTest {
}
Long create() {
return ok(fineractClient().staff.create3(new PostStaffRequest().officeId(1L).firstname(Utils.randomStringGenerator("StaffTest", 6))
return ok(fineractClient().staff.create3(new StaffRequest().officeId(1L).firstname(Utils.randomStringGenerator("StaffTest", 6))
.lastname(Utils.randomStringGenerator("Staffer_", 6)).externalId(Utils.randomStringGenerator("", 12))
.joiningDate(LocalDate.now(ZoneId.of("UTC"))).dateFormat("yyyy-MM-dd").locale("en_US"))).getResourceId();
.joiningDate(LocalDate.now(ZoneId.of("UTC")).toString()).dateFormat("yyyy-MM-dd").locale("en_US"))).getResourceId();
}
Optional<Long> retrieveFirst() {
var staff = ok(fineractClient().staff.retrieveAll16(1L, true, false, "ACTIVE"));
if (staff.size() > 0) {
if (!staff.isEmpty()) {
return Optional.of((long) staff.get(0).getId());
}
return Optional.empty();