mirror of
https://github.com/bitwarden/server
synced 2025-12-10 13:23:27 +00:00
* Renamed ProductType to ProductTierType * Renamed Product properties to ProductTier * Moved ProductTierType to Bit.Core.Billing.Enums namespace from Bit.Core.Enums * Moved PlanType enum to Bit.Core.Billing.Enums * Moved StaticStore to Bit.Core.Billing.Models.StaticStore namespace * Added ProductType enum * dotnet format
30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
using Bit.Core.Billing.Enums;
|
|
using Bit.Core.Enums;
|
|
using Bit.Infrastructure.EntityFramework.Models;
|
|
|
|
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries;
|
|
|
|
public class OrganizationUserReadCountByFreeOrganizationAdminUserQuery : IQuery<OrganizationUser>
|
|
{
|
|
private readonly Guid _userId;
|
|
|
|
public OrganizationUserReadCountByFreeOrganizationAdminUserQuery(Guid userId)
|
|
{
|
|
_userId = userId;
|
|
}
|
|
|
|
public IQueryable<OrganizationUser> Run(DatabaseContext dbContext)
|
|
{
|
|
var query = from ou in dbContext.OrganizationUsers
|
|
join o in dbContext.Organizations
|
|
on ou.OrganizationId equals o.Id
|
|
where ou.UserId == _userId &&
|
|
(ou.Type == OrganizationUserType.Owner || ou.Type == OrganizationUserType.Admin) &&
|
|
o.PlanType == PlanType.Free &&
|
|
ou.Status == OrganizationUserStatusType.Confirmed
|
|
select ou;
|
|
|
|
return query;
|
|
}
|
|
}
|