mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
Remove GetManyDetailsByUserAsync
& ReplaceAsync
DB Calls (#6012)
This commit is contained in:
@ -206,7 +206,11 @@ public class DevicesController : Controller
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
await _deviceService.SaveAsync(model.ToData(), device);
|
||||
await _deviceService.SaveAsync(
|
||||
model.ToData(),
|
||||
device,
|
||||
_currentContext.Organizations.Select(org => org.Id.ToString())
|
||||
);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
|
@ -6,7 +6,7 @@ namespace Bit.Core.Services;
|
||||
|
||||
public interface IDeviceService
|
||||
{
|
||||
Task SaveAsync(WebPushRegistrationData webPush, Device device);
|
||||
Task SaveAsync(WebPushRegistrationData webPush, Device device, IEnumerable<string> organizationIds);
|
||||
Task SaveAsync(Device device);
|
||||
Task ClearTokenAsync(Device device);
|
||||
Task DeactivateAsync(Device device);
|
||||
|
@ -29,9 +29,17 @@ public class DeviceService : IDeviceService
|
||||
_globalSettings = globalSettings;
|
||||
}
|
||||
|
||||
public async Task SaveAsync(WebPushRegistrationData webPush, Device device)
|
||||
public async Task SaveAsync(WebPushRegistrationData webPush, Device device, IEnumerable<string> organizationIds)
|
||||
{
|
||||
await SaveAsync(new PushRegistrationData(webPush.Endpoint, webPush.P256dh, webPush.Auth), device);
|
||||
await _pushRegistrationService.CreateOrUpdateRegistrationAsync(
|
||||
new PushRegistrationData(webPush.Endpoint, webPush.P256dh, webPush.Auth),
|
||||
device.Id.ToString(),
|
||||
device.UserId.ToString(),
|
||||
device.Identifier,
|
||||
device.Type,
|
||||
organizationIds,
|
||||
_globalSettings.Installation.Id
|
||||
);
|
||||
}
|
||||
|
||||
public async Task SaveAsync(Device device)
|
||||
|
Reference in New Issue
Block a user