1
0
mirror of https://github.com/bitwarden/server synced 2025-12-18 17:23:28 +00:00

Run formatting (#2230)

This commit is contained in:
Justin Baur
2022-08-29 16:06:55 -04:00
committed by GitHub
parent 9b7aef0763
commit 7f5f010e1e
1205 changed files with 73813 additions and 75022 deletions

View File

@@ -1,37 +1,36 @@
using Bit.Core.Enums.Provider;
using Bit.Infrastructure.EntityFramework.Models;
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries;
public class ProviderUserReadCountByOnlyOwnerQuery : IQuery<ProviderUser>
{
public class ProviderUserReadCountByOnlyOwnerQuery : IQuery<ProviderUser>
private readonly Guid _userId;
public ProviderUserReadCountByOnlyOwnerQuery(Guid userId)
{
private readonly Guid _userId;
_userId = userId;
}
public ProviderUserReadCountByOnlyOwnerQuery(Guid userId)
{
_userId = userId;
}
public IQueryable<ProviderUser> Run(DatabaseContext dbContext)
{
var owners = from pu in dbContext.ProviderUsers
where pu.Type == ProviderUserType.ProviderAdmin &&
pu.Status == ProviderUserStatusType.Confirmed
group pu by pu.ProviderId into g
select new
{
ProviderUser = g.Select(x => new { x.UserId, x.Id }).FirstOrDefault(),
ConfirmedOwnerCount = g.Count(),
};
public IQueryable<ProviderUser> Run(DatabaseContext dbContext)
{
var owners = from pu in dbContext.ProviderUsers
where pu.Type == ProviderUserType.ProviderAdmin &&
pu.Status == ProviderUserStatusType.Confirmed
group pu by pu.ProviderId into g
select new
{
ProviderUser = g.Select(x => new { x.UserId, x.Id }).FirstOrDefault(),
ConfirmedOwnerCount = g.Count(),
};
var query = from owner in owners
join pu in dbContext.ProviderUsers
on owner.ProviderUser.Id equals pu.Id
where owner.ProviderUser.UserId == _userId &&
owner.ConfirmedOwnerCount == 1
select pu;
var query = from owner in owners
join pu in dbContext.ProviderUsers
on owner.ProviderUser.Id equals pu.Id
where owner.ProviderUser.UserId == _userId &&
owner.ConfirmedOwnerCount == 1
select pu;
return query;
}
return query;
}
}