mirror of
https://github.com/bitwarden/server.git
synced 2026-02-10 02:43:17 +08:00
[PM-17562] Add Dapper and EF Repositories For Ogranization Integrations and Configurations (#5589)
* [PM-17562] Add Dapper and EF Repositories For Ogranization Integrations and Configurations * Updated with changes from PR comments
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data.Organizations;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries;
|
||||
|
||||
public class OrganizationIntegrationConfigurationDetailsReadManyByEventTypeOrganizationIdIntegrationTypeQuery : IQuery<OrganizationIntegrationConfigurationDetails>
|
||||
{
|
||||
private readonly Guid _organizationId;
|
||||
private readonly EventType _eventType;
|
||||
private readonly IntegrationType _integrationType;
|
||||
|
||||
public OrganizationIntegrationConfigurationDetailsReadManyByEventTypeOrganizationIdIntegrationTypeQuery(Guid organizationId, EventType eventType, IntegrationType integrationType)
|
||||
{
|
||||
_organizationId = organizationId;
|
||||
_eventType = eventType;
|
||||
_integrationType = integrationType;
|
||||
}
|
||||
|
||||
public IQueryable<OrganizationIntegrationConfigurationDetails> Run(DatabaseContext dbContext)
|
||||
{
|
||||
var query = from oic in dbContext.OrganizationIntegrationConfigurations
|
||||
join oi in dbContext.OrganizationIntegrations on oic.OrganizationIntegrationId equals oi.Id into oioic
|
||||
from oi in dbContext.OrganizationIntegrations
|
||||
where oi.OrganizationId == _organizationId &&
|
||||
oi.Type == _integrationType &&
|
||||
oic.EventType == _eventType
|
||||
select new OrganizationIntegrationConfigurationDetails()
|
||||
{
|
||||
Id = oic.Id,
|
||||
OrganizationIntegrationId = oic.OrganizationIntegrationId,
|
||||
IntegrationType = oi.Type,
|
||||
EventType = oic.EventType,
|
||||
Configuration = oic.Configuration,
|
||||
IntegrationConfiguration = oi.Configuration,
|
||||
Template = oic.Template
|
||||
};
|
||||
return query;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user