mirror of
https://github.com/bitwarden/server
synced 2026-01-13 14:03:58 +00:00
[PM-2943] Enable Nullable Repositories in Unowned Files (#4549)
* Enable Nullable In Unowned Repos * Update More Tests * Move to One If * Fix Collections * Format * Add Migrations * Move Pragma Annotation * Add Better Assert Message
This commit is contained in:
@@ -4,6 +4,8 @@ using Bit.Infrastructure.EntityFramework.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Repositories;
|
||||
|
||||
public class DeviceRepository : Repository<Core.Entities.Device, Device, Guid>, IDeviceRepository
|
||||
@@ -24,7 +26,7 @@ public class DeviceRepository : Repository<Core.Entities.Device, Device, Guid>,
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Core.Entities.Device> GetByIdAsync(Guid id, Guid userId)
|
||||
public async Task<Core.Entities.Device?> GetByIdAsync(Guid id, Guid userId)
|
||||
{
|
||||
var device = await base.GetByIdAsync(id);
|
||||
if (device == null || device.UserId != userId)
|
||||
@@ -35,7 +37,7 @@ public class DeviceRepository : Repository<Core.Entities.Device, Device, Guid>,
|
||||
return Mapper.Map<Core.Entities.Device>(device);
|
||||
}
|
||||
|
||||
public async Task<Core.Entities.Device> GetByIdentifierAsync(string identifier)
|
||||
public async Task<Core.Entities.Device?> GetByIdentifierAsync(string identifier)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
@@ -46,7 +48,7 @@ public class DeviceRepository : Repository<Core.Entities.Device, Device, Guid>,
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Core.Entities.Device> GetByIdentifierAsync(string identifier, Guid userId)
|
||||
public async Task<Core.Entities.Device?> GetByIdentifierAsync(string identifier, Guid userId)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user