@@ -41,6 +41,7 @@ public enum MessageCode {
|
||||
INTERNAL_ERROR(4, "Internal server error"),
|
||||
COMPANY_NOT_FOUND(4, "Company not found"),
|
||||
COMPANY_ALREADY_EXISTS(2, "Company already exists"),
|
||||
USER_LIMIT_IS_OVER(2, "Over user limits"),
|
||||
ERROR_TARIFF_INFO(2, "Erorr with tariff info");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
@@ -65,8 +65,7 @@ public class RegRequestHandler implements RequestHandler {
|
||||
referralLink, new BaseResponse(request.getMsgId(),
|
||||
MessageCode.REFERRAL_LINK_IS_NOT_EXIST.getCode(),
|
||||
MessageCode.REFERRAL_LINK_IS_NOT_EXIST.getDescription(), Map.of(
|
||||
"referralLink", referralLink
|
||||
)));
|
||||
"referralLink", referralLink)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user