[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:
Brant DeBow
2025-04-03 11:23:00 -04:00
committed by GitHub
parent 60e9827196
commit 33f5a19b99
11 changed files with 315 additions and 0 deletions

View File

@@ -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;
}
}