mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 09:02:48 -05:00
AC Team code ownership moves: Organization pt. 1 (#3472)
* move Organization.cs files to AC Team code ownership
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
using System.Text.Json;
|
||||
using AutoMapper;
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
|
||||
using Bit.Infrastructure.EntityFramework.Repositories.Queries;
|
||||
using LinqToDB.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
@ -5,17 +5,17 @@ using Bit.Core.Models.Data.Organizations;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Organization = Bit.Infrastructure.EntityFramework.Models.Organization;
|
||||
using Organization = Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Repositories;
|
||||
|
||||
public class OrganizationRepository : Repository<Core.Entities.Organization, Organization, Guid>, IOrganizationRepository
|
||||
public class OrganizationRepository : Repository<Core.AdminConsole.Entities.Organization, Organization, Guid>, IOrganizationRepository
|
||||
{
|
||||
public OrganizationRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
|
||||
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Organizations)
|
||||
{ }
|
||||
|
||||
public async Task<Core.Entities.Organization> GetByIdentifierAsync(string identifier)
|
||||
public async Task<Core.AdminConsole.Entities.Organization> GetByIdentifierAsync(string identifier)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
@ -26,17 +26,17 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<Core.Entities.Organization>> GetManyByEnabledAsync()
|
||||
public async Task<ICollection<Core.AdminConsole.Entities.Organization>> GetManyByEnabledAsync()
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
var organizations = await GetDbSet(dbContext).Where(e => e.Enabled).ToListAsync();
|
||||
return Mapper.Map<List<Core.Entities.Organization>>(organizations);
|
||||
return Mapper.Map<List<Core.AdminConsole.Entities.Organization>>(organizations);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<Core.Entities.Organization>> GetManyByUserIdAsync(Guid userId)
|
||||
public async Task<ICollection<Core.AdminConsole.Entities.Organization>> GetManyByUserIdAsync(Guid userId)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
@ -46,11 +46,11 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
|
||||
.Where(ou => ou.UserId == userId)
|
||||
.Select(ou => ou.Organization))
|
||||
.ToListAsync();
|
||||
return Mapper.Map<List<Core.Entities.Organization>>(organizations);
|
||||
return Mapper.Map<List<Core.AdminConsole.Entities.Organization>>(organizations);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<Core.Entities.Organization>> SearchAsync(string name, string userEmail,
|
||||
public async Task<ICollection<Core.AdminConsole.Entities.Organization>> SearchAsync(string name, string userEmail,
|
||||
bool? paid, int skip, int take)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
@ -65,7 +65,7 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
|
||||
.OrderBy(e => e.CreationDate)
|
||||
.Skip(skip).Take(take)
|
||||
.ToListAsync();
|
||||
return Mapper.Map<List<Core.Entities.Organization>>(organizations);
|
||||
return Mapper.Map<List<Core.AdminConsole.Entities.Organization>>(organizations);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ICollection<Core.Entities.Organization>> SearchUnassignedToProviderAsync(string name, string ownerEmail, int skip, int take)
|
||||
public async Task<ICollection<Core.AdminConsole.Entities.Organization>> SearchUnassignedToProviderAsync(string name, string ownerEmail, int skip, int take)
|
||||
{
|
||||
using var scope = ServiceScopeFactory.CreateScope();
|
||||
|
||||
@ -145,7 +145,7 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
|
||||
await OrganizationUpdateStorage(id);
|
||||
}
|
||||
|
||||
public override async Task DeleteAsync(Core.Entities.Organization organization)
|
||||
public override async Task DeleteAsync(Core.AdminConsole.Entities.Organization organization)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
@ -205,7 +205,7 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Core.Entities.Organization> GetByLicenseKeyAsync(string licenseKey)
|
||||
public async Task<Core.AdminConsole.Entities.Organization> GetByLicenseKeyAsync(string licenseKey)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
|
Reference in New Issue
Block a user