fixed query
This commit is contained in:
parent
2b1295455c
commit
1d3534ab46
@ -871,21 +871,21 @@ static file class Queries
|
|||||||
EF.CompileAsyncQuery(
|
EF.CompileAsyncQuery(
|
||||||
(UserDbContext ctx, int tenantId, string userName, Guid id) =>
|
(UserDbContext ctx, int tenantId, string userName, Guid id) =>
|
||||||
ctx.Users
|
ctx.Users
|
||||||
.Where(r => r.TenantId != Tenant.DefaultTenant && r.TenantId == tenantId)
|
.Where(r => tenantId == Tenant.DefaultTenant || r.TenantId == tenantId)
|
||||||
.Any(r => r.UserName == userName && r.Id != id && !r.Removed));
|
.Any(r => r.UserName == userName && r.Id != id && !r.Removed));
|
||||||
|
|
||||||
public static readonly Func<UserDbContext, int, string, Guid, Task<bool>> AnyUsersByEmailAsync =
|
public static readonly Func<UserDbContext, int, string, Guid, Task<bool>> AnyUsersByEmailAsync =
|
||||||
EF.CompileAsyncQuery(
|
EF.CompileAsyncQuery(
|
||||||
(UserDbContext ctx, int tenantId, string email, Guid id) =>
|
(UserDbContext ctx, int tenantId, string email, Guid id) =>
|
||||||
ctx.Users
|
ctx.Users
|
||||||
.Where(r => r.TenantId != Tenant.DefaultTenant && r.TenantId == tenantId)
|
.Where(r => tenantId == Tenant.DefaultTenant || r.TenantId == tenantId)
|
||||||
.Any(r => r.Email == email && r.Id != id && !r.Removed));
|
.Any(r => r.Email == email && r.Id != id && !r.Removed));
|
||||||
|
|
||||||
public static readonly Func<UserDbContext, int, Guid, Task<User>> FirstOrDefaultUserAsync =
|
public static readonly Func<UserDbContext, int, Guid, Task<User>> FirstOrDefaultUserAsync =
|
||||||
EF.CompileAsyncQuery(
|
EF.CompileAsyncQuery(
|
||||||
(UserDbContext ctx, int tenantId, Guid id) =>
|
(UserDbContext ctx, int tenantId, Guid id) =>
|
||||||
ctx.Users
|
ctx.Users
|
||||||
.Where(r => r.TenantId != Tenant.DefaultTenant && r.TenantId == tenantId)
|
.Where(r => tenantId == Tenant.DefaultTenant || r.TenantId == tenantId)
|
||||||
.FirstOrDefault(a => a.Id == id));
|
.FirstOrDefault(a => a.Id == id));
|
||||||
|
|
||||||
public static readonly Func<UserDbContext, int, Guid, Task<UserPhoto>> UserPhotoAsync =
|
public static readonly Func<UserDbContext, int, Guid, Task<UserPhoto>> UserPhotoAsync =
|
||||||
@ -899,11 +899,12 @@ static file class Queries
|
|||||||
EF.CompileAsyncQuery(
|
EF.CompileAsyncQuery(
|
||||||
(UserDbContext ctx, int tenantId) =>
|
(UserDbContext ctx, int tenantId) =>
|
||||||
(from usersDav in ctx.UsersDav
|
(from usersDav in ctx.UsersDav
|
||||||
join users in ctx.Users on new { tenant = usersDav.TenantId, userId = usersDav.UserId } equals new
|
join users in ctx.Users on new { tenant = usersDav.TenantId, userId = usersDav.UserId } equals new
|
||||||
{
|
{
|
||||||
tenant = users.TenantId, userId = users.Id
|
tenant = users.TenantId,
|
||||||
}
|
userId = users.Id
|
||||||
where usersDav.TenantId == tenantId
|
}
|
||||||
select users.Email)
|
where usersDav.TenantId == tenantId
|
||||||
|
select users.Email)
|
||||||
.Distinct());
|
.Distinct());
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user