2025-04-03 11:23:00 -04:00
|
|
|
|
using AutoMapper;
|
|
|
|
|
|
using Bit.Core.Enums;
|
|
|
|
|
|
using Bit.Core.Models.Data.Organizations;
|
|
|
|
|
|
using Bit.Core.Repositories;
|
|
|
|
|
|
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
|
2025-07-23 14:24:59 -04:00
|
|
|
|
using Bit.Infrastructure.EntityFramework.AdminConsole.Repositories.Queries;
|
2025-04-03 11:23:00 -04:00
|
|
|
|
using Bit.Infrastructure.EntityFramework.Repositories;
|
|
|
|
|
|
using Bit.Infrastructure.EntityFramework.Repositories.Queries;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bit.Infrastructure.EntityFramework.AdminConsole.Repositories;
|
|
|
|
|
|
|
|
|
|
|
|
public class OrganizationIntegrationConfigurationRepository : Repository<Core.AdminConsole.Entities.OrganizationIntegrationConfiguration, OrganizationIntegrationConfiguration, Guid>, IOrganizationIntegrationConfigurationRepository
|
|
|
|
|
|
{
|
|
|
|
|
|
public OrganizationIntegrationConfigurationRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
|
|
|
|
|
|
: base(serviceScopeFactory, mapper, context => context.OrganizationIntegrationConfigurations)
|
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<List<OrganizationIntegrationConfigurationDetails>> GetConfigurationDetailsAsync(
|
|
|
|
|
|
Guid organizationId,
|
|
|
|
|
|
IntegrationType integrationType,
|
|
|
|
|
|
EventType eventType)
|
|
|
|
|
|
{
|
|
|
|
|
|
using (var scope = ServiceScopeFactory.CreateScope())
|
|
|
|
|
|
{
|
|
|
|
|
|
var dbContext = GetDatabaseContext(scope);
|
|
|
|
|
|
var query = new OrganizationIntegrationConfigurationDetailsReadManyByEventTypeOrganizationIdIntegrationTypeQuery(
|
|
|
|
|
|
organizationId, eventType, integrationType
|
|
|
|
|
|
);
|
|
|
|
|
|
return await query.Run(dbContext).ToListAsync();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-16 11:41:08 -04:00
|
|
|
|
|
|
|
|
|
|
public async Task<List<OrganizationIntegrationConfigurationDetails>> GetAllConfigurationDetailsAsync()
|
|
|
|
|
|
{
|
|
|
|
|
|
using (var scope = ServiceScopeFactory.CreateScope())
|
|
|
|
|
|
{
|
|
|
|
|
|
var dbContext = GetDatabaseContext(scope);
|
|
|
|
|
|
var query = new OrganizationIntegrationConfigurationDetailsReadManyQuery();
|
|
|
|
|
|
return await query.Run(dbContext).ToListAsync();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-23 14:24:59 -04:00
|
|
|
|
|
|
|
|
|
|
public async Task<List<Core.AdminConsole.Entities.OrganizationIntegrationConfiguration>> GetManyByIntegrationAsync(
|
|
|
|
|
|
Guid organizationIntegrationId)
|
|
|
|
|
|
{
|
|
|
|
|
|
using (var scope = ServiceScopeFactory.CreateScope())
|
|
|
|
|
|
{
|
|
|
|
|
|
var dbContext = GetDatabaseContext(scope);
|
|
|
|
|
|
var query = new OrganizationIntegrationConfigurationReadManyByOrganizationIntegrationIdQuery(
|
|
|
|
|
|
organizationIntegrationId
|
|
|
|
|
|
);
|
|
|
|
|
|
return await query.Run(dbContext).ToListAsync();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-04-03 11:23:00 -04:00
|
|
|
|
}
|