mirror of
https://github.com/bitwarden/server
synced 2025-12-24 12:13:17 +00:00
Resolve some comments
This commit is contained in:
@@ -13,11 +13,10 @@ public class PlayData : ITableObject<Guid>
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
[MaxLength(256)]
|
||||
public string PlayId { get; init; } = null!;
|
||||
public required string PlayId { get; init; }
|
||||
public Guid? UserId { get; init; }
|
||||
public Guid? OrganizationId { get; init; }
|
||||
public DateTime CreationDate { get; init; }
|
||||
protected PlayData() { }
|
||||
|
||||
/// <summary>
|
||||
/// Generates and sets a new COMB GUID for the Id property.
|
||||
|
||||
@@ -13,23 +13,19 @@ using Bit.Core.Utilities;
|
||||
using Dapper;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Bit.Infrastructure.Dapper.Repositories;
|
||||
|
||||
public class UserRepository : Repository<User, Guid>, IUserRepository
|
||||
{
|
||||
private readonly IDataProtector _dataProtector;
|
||||
protected readonly ILogger<UserRepository> _logger;
|
||||
|
||||
public UserRepository(
|
||||
IDataProtectionProvider dataProtectionProvider,
|
||||
GlobalSettings globalSettings,
|
||||
ILogger<UserRepository> logger)
|
||||
GlobalSettings globalSettings)
|
||||
: base(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
|
||||
{
|
||||
_dataProtector = dataProtectionProvider.CreateProtector(Constants.DatabaseFieldProtectorPurpose);
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public override async Task<User?> GetByIdAsync(Guid id)
|
||||
@@ -159,7 +155,6 @@ public class UserRepository : Repository<User, Guid>, IUserRepository
|
||||
public override async Task<User> CreateAsync(User user)
|
||||
{
|
||||
await ProtectDataAndSaveAsync(user, async () => await base.CreateAsync(user));
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
@@ -486,9 +481,8 @@ public class TestUserTrackingUserRepository : UserRepository
|
||||
public TestUserTrackingUserRepository(
|
||||
IPlayDataService playDataService,
|
||||
GlobalSettings globalSettings,
|
||||
IDataProtectionProvider dataProtectionProvider,
|
||||
ILogger<UserRepository> logger)
|
||||
: base(dataProtectionProvider, globalSettings, logger)
|
||||
IDataProtectionProvider dataProtectionProvider)
|
||||
: base(dataProtectionProvider, globalSettings)
|
||||
{
|
||||
_playDataService = playDataService;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,6 @@ public class OrganizationRepository : Repository<Core.AdminConsole.Entities.Orga
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<Core.AdminConsole.Entities.Organization> GetByIdentifierAsync(string identifier)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
|
||||
@@ -16,16 +16,9 @@ namespace Bit.Infrastructure.EntityFramework.Repositories;
|
||||
|
||||
public class UserRepository : Repository<Core.Entities.User, User, Guid>, IUserRepository
|
||||
{
|
||||
protected readonly ILogger<UserRepository> _logger;
|
||||
|
||||
public UserRepository(
|
||||
IServiceScopeFactory serviceScopeFactory,
|
||||
IMapper mapper,
|
||||
ILogger<UserRepository> logger)
|
||||
public UserRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper)
|
||||
: base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Users)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
{}
|
||||
|
||||
public async Task<Core.Entities.User?> GetByEmailAsync(string email)
|
||||
{
|
||||
@@ -515,9 +508,8 @@ public class TestUserTrackingUserRepository : UserRepository
|
||||
public TestUserTrackingUserRepository(
|
||||
IPlayDataService playDataService,
|
||||
IServiceScopeFactory serviceScopeFactory,
|
||||
IMapper mapper,
|
||||
ILogger<UserRepository> logger)
|
||||
: base(serviceScopeFactory, mapper, logger)
|
||||
IMapper mapper)
|
||||
: base(serviceScopeFactory, mapper)
|
||||
{
|
||||
_playDataService = playDataService;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,10 @@ public class SceneService(
|
||||
|
||||
public List<string> GetAllPlayIds()
|
||||
{
|
||||
return [.. databaseContext.PlayData
|
||||
return databaseContext.PlayData
|
||||
.Select(pd => pd.PlayId)
|
||||
.Distinct()];
|
||||
.Distinct()
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public async Task<SceneResponseModel> ExecuteScene(string templateName, JsonElement? arguments)
|
||||
|
||||
Reference in New Issue
Block a user