dev add method link
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-08 15:19:17 +07:00
parent f433b4dc01
commit 6565c18958
@@ -115,7 +115,17 @@ public class UserInfoHandler implements RequestHandler {
Sort.Direction.fromString(req.getSortDirection() != null ? req.getSortDirection() : "desc"); Sort.Direction.fromString(req.getSortDirection() != null ? req.getSortDirection() : "desc");
String sortBy = req.getSortBy() != null ? req.getSortBy() : "createdAt"; String sortBy = req.getSortBy() != null ? req.getSortBy() : "createdAt";
Pageable pageable = PageRequest.of(req.getPage(), req.getSize(), Sort.by(direction, sortBy)); String sortField = switch (sortBy) {
case "fullName" -> "fullName";
case "email" -> "email";
case "createdAt" -> "createdAt";
case "verificationStatus" -> "verificationStatus";
case "tariff" -> "personalTariffInfo.status";
case "tokens" -> "personalTariffInfo.tokens";
default -> "createdAt";
};
Pageable pageable = PageRequest.of(req.getPage(), req.getSize(), Sort.by(direction, sortField));
Specification<User> spec = (root, query, cb) -> cb.conjunction(); Specification<User> spec = (root, query, cb) -> cb.conjunction();
@@ -145,23 +155,16 @@ public class UserInfoHandler implements RequestHandler {
map.put("id", user.getId()); map.put("id", user.getId());
map.put("fullName", user.getFullName()); map.put("fullName", user.getFullName());
map.put("email", user.getEmail()); map.put("email", user.getEmail());
map.put("phone", user.getPhone());
map.put("emailVerified", user.isEmailVerified());
map.put("subscriptionType", user.getSubscriptionType().name());
map.put("genderType", user.getGenderType().name());
map.put("isActive", user.isActive());
map.put("birthday", user.getBirthday() != null ? user.getBirthday().toString() : null);
map.put("createdAt", user.getCreatedAt() != null ? user.getCreatedAt().toString() : null);
map.put("lastLoginAt", user.getLastLoginAt() != null ? user.getLastLoginAt().toString() : null);
map.put("companyName", user.getCompanyName());
map.put("verificationStatus", user.getVerificationStatus().name()); map.put("verificationStatus", user.getVerificationStatus().name());
map.put("createdAt", user.getCreatedAt() != null ? user.getCreatedAt().toString() : null);
TariffInfo tariff = user.getActiveTariffInfo(); TariffInfo tariff = user.getActiveTariffInfo();
if (tariff != null) { if (tariff != null) {
map.put("tariff", tariff.getStatus().name());
map.put("tokens", tariff.getTokens()); map.put("tokens", tariff.getTokens());
map.put("boughtTokens", tariff.getBoughtTokens()); } else {
map.put("tariffStatus", tariff.getStatus().name()); map.put("tariff", null);
map.put("tariffEndDate", tariff.getEndTariff() != null ? tariff.getEndTariff().toString() : null); map.put("tokens", 0);
} }
return map; return map;