Added the check to check the ma user count
This commit is contained in:
parent
2c841b3bd0
commit
5d8a5909bc
@ -1146,6 +1146,14 @@ namespace Marco.Pms.Services.Controllers
|
||||
var currentSubscription = currentSubscriptionTask.Result;
|
||||
var utcNow = DateTime.UtcNow;
|
||||
|
||||
var activeUsers = await context.Employees.CountAsync(e => e.Email != null && e.ApplicationUserId != null);
|
||||
|
||||
if (activeUsers < model.MaxUsers)
|
||||
{
|
||||
_logger.LogWarning("Employee {EmployeeId} add less max user than the active user in the tenant {TenantId}", loggedInEmployee.Id, tenant.Id);
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("Invalid Max user count", "Max User count must be higher than active user count", 400));
|
||||
}
|
||||
|
||||
// 6. If the tenant already has this plan, extend/renew it.
|
||||
if (currentSubscription != null && currentSubscription.PlanId == subscriptionPlan.Id)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user