diff --git a/src/Api/Controllers/DevicesController.cs b/src/Api/Controllers/DevicesController.cs index 7559bff9bc..88d0e5c7a3 100644 --- a/src/Api/Controllers/DevicesController.cs +++ b/src/Api/Controllers/DevicesController.cs @@ -1,6 +1,7 @@ using Bit.Api.Models.Request; using Bit.Api.Models.Response; using Bit.Core.Entities; +using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Repositories; using Bit.Core.Services; @@ -65,6 +66,15 @@ public class DevicesController : Controller return new ListResponseModel(responses); } + [HttpPost("exist-by-types")] + public async Task> GetExistenceByTypes([FromBody] DeviceType[] deviceTypes) + { + var userId = _userService.GetProperUserId(User).Value; + var devices = await _deviceRepository.GetManyByUserIdAsync(userId); + var userHasDeviceOfTypes = devices.Any(d => deviceTypes.Contains(d.Type)); + return Ok(userHasDeviceOfTypes); + } + [HttpPost("")] public async Task Post([FromBody] DeviceRequestModel model) {