1
0
mirror of https://github.com/bitwarden/server synced 2026-01-31 00:33:17 +00:00

Move all event integration code to Dirt (#6757)

* Move all event integration code to Dirt

* Format to fix lint
This commit is contained in:
Brant DeBow
2025-12-30 10:59:19 -05:00
committed by GitHub
parent 9a340c0fdd
commit 86a68ab637
158 changed files with 487 additions and 472 deletions

View File

@@ -0,0 +1,41 @@
using AutoMapper;
using Bit.Core.Dirt.Repositories;
using Bit.Infrastructure.EntityFramework.Dirt.Repositories.Queries;
using Bit.Infrastructure.EntityFramework.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using OrganizationIntegration = Bit.Core.Dirt.Entities.OrganizationIntegration;
namespace Bit.Infrastructure.EntityFramework.Dirt.Repositories;
public class OrganizationIntegrationRepository :
Repository<OrganizationIntegration, Dirt.Models.OrganizationIntegration, Guid>,
IOrganizationIntegrationRepository
{
public OrganizationIntegrationRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.OrganizationIntegrations)
{
}
public async Task<List<OrganizationIntegration>> GetManyByOrganizationAsync(Guid organizationId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var query = new OrganizationIntegrationReadManyByOrganizationIdQuery(organizationId);
return await query.Run(dbContext).ToListAsync();
}
}
public async Task<OrganizationIntegration?> GetByTeamsConfigurationTenantIdTeamId(
string tenantId,
string teamId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var query = new OrganizationIntegrationReadByTeamsConfigurationTenantIdTeamIdQuery(tenantId: tenantId, teamId: teamId);
return await query.Run(dbContext).SingleOrDefaultAsync();
}
}
}