add set user limits
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-02-09 11:06:50 +07:00
parent 5b73fd2c39
commit a5003958a8
3 changed files with 6 additions and 4 deletions
@@ -197,8 +197,10 @@ public class AuthService {
long currentCountUsers = userRepository.countByCompanyId(company.getId());
if (currentCountUsers >= maxUsers) {
throw new MaxUserCountIsOver(
String.format("Max user is over. " + "Has: %d, current count: %d", maxUsers, currentCountUsers));
throw new NotValidFieldException("Max user is over.", new BaseResponse(20002,
MessageCode.USER_LIMIT_IS_OVER.getCode(),
MessageCode.USER_LIMIT_IS_OVER.getDescription(), Map.of(
"limit", maxUsers, "countUser", currentCountUsers)));
}
user.setCompany(company);