mirror of
https://github.com/bitwarden/server.git
synced 2026-01-31 22:23:18 +08:00
34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
using Bit.Core.Models.Data;
|
|
|
|
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries
|
|
{
|
|
public class ProviderOrganizationOrganizationDetailsReadByProviderIdQuery : IQuery<ProviderOrganizationOrganizationDetails>
|
|
{
|
|
private readonly Guid _providerId;
|
|
public ProviderOrganizationOrganizationDetailsReadByProviderIdQuery(Guid providerId)
|
|
{
|
|
_providerId = providerId;
|
|
}
|
|
|
|
public IQueryable<ProviderOrganizationOrganizationDetails> Run(DatabaseContext dbContext)
|
|
{
|
|
var query = from po in dbContext.ProviderOrganizations
|
|
join o in dbContext.Organizations
|
|
on po.OrganizationId equals o.Id
|
|
where po.ProviderId == _providerId
|
|
select new { po, o };
|
|
return query.Select(x => new ProviderOrganizationOrganizationDetails()
|
|
{
|
|
Id = x.po.Id,
|
|
ProviderId = x.po.ProviderId,
|
|
OrganizationId = x.po.OrganizationId,
|
|
OrganizationName = x.o.Name,
|
|
Key = x.po.Key,
|
|
Settings = x.po.Settings,
|
|
CreationDate = x.po.CreationDate,
|
|
RevisionDate = x.po.RevisionDate,
|
|
});
|
|
}
|
|
}
|
|
}
|