dev comment logic for check max users
Test Workflow / test (push) Successful in 4s

This commit is contained in:
vladp
2026-02-20 13:06:53 +07:00
parent f34e9df0c8
commit 86e0e0619f
@@ -217,16 +217,16 @@ public class AuthService {
throw new IllegalStateException("Company not have tariff"); throw new IllegalStateException("Company not have tariff");
} }
Tariff tariff = tariffInfo.getTariff(); // Tariff tariff = tariffInfo.getTariff();
Long maxUsers = tariff.getMaxUsers(); // Long maxUsers = tariff.getMaxUsers();
long currentCountUsers = userRepository.countByCompanyId(company.getId()); // long currentCountUsers = userRepository.countByCompanyId(company.getId());
//
if (currentCountUsers >= maxUsers) { // if (currentCountUsers >= maxUsers) {
throw new NotValidFieldException("Max user is over.", new BaseResponse(20002, // throw new NotValidFieldException("Max user is over.", new BaseResponse(20002,
MessageCode.USER_LIMIT_IS_OVER.getCode(), // MessageCode.USER_LIMIT_IS_OVER.getCode(),
MessageCode.USER_LIMIT_IS_OVER.getDescription(), Map.of( // MessageCode.USER_LIMIT_IS_OVER.getDescription(), Map.of(
"limit", maxUsers, "countUser", currentCountUsers))); // "limit", maxUsers, "countUser", currentCountUsers)));
} // }
user.setCompany(company); user.setCompany(company);
user.grantPermission(Permission.DEFAULT_USER_PERMISSIONS); user.grantPermission(Permission.DEFAULT_USER_PERMISSIONS);