1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

[PM-6339] Shard notification hub clients across multiple accounts (#3812)

* WIP registration updates

* fix deviceHubs

* addHub inline in ctor

* adjust setttings for hub reg

* send to all clients

* fix multiservice push

* use notification hub type

* feedback

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
This commit is contained in:
Kyle Spearrin
2024-04-08 15:39:44 -04:00
committed by GitHub
parent de8b7b14b8
commit 40221f578f
14 changed files with 208 additions and 70 deletions

View File

@ -42,11 +42,11 @@ public class PushController : Controller
Prefix(model.UserId), Prefix(model.Identifier), model.Type);
}
[HttpDelete("{id}")]
public async Task Delete(string id)
[HttpPost("delete")]
public async Task PostDelete([FromBody] PushDeviceRequestModel model)
{
CheckUsage();
await _pushRegistrationService.DeleteRegistrationAsync(Prefix(id));
await _pushRegistrationService.DeleteRegistrationAsync(Prefix(model.Id), model.Type);
}
[HttpPut("add-organization")]
@ -54,7 +54,8 @@ public class PushController : Controller
{
CheckUsage();
await _pushRegistrationService.AddUserRegistrationOrganizationAsync(
model.DeviceIds.Select(d => Prefix(d)), Prefix(model.OrganizationId));
model.Devices.Select(d => new KeyValuePair<string, Core.Enums.DeviceType>(Prefix(d.Id), d.Type)),
Prefix(model.OrganizationId));
}
[HttpPut("delete-organization")]
@ -62,7 +63,8 @@ public class PushController : Controller
{
CheckUsage();
await _pushRegistrationService.DeleteUserRegistrationOrganizationAsync(
model.DeviceIds.Select(d => Prefix(d)), Prefix(model.OrganizationId));
model.Devices.Select(d => new KeyValuePair<string, Core.Enums.DeviceType>(Prefix(d.Id), d.Type)),
Prefix(model.OrganizationId));
}
[HttpPost("send")]