diff --git a/src/Api/Controllers/SyncController.cs b/src/Api/Controllers/SyncController.cs index 2f4e5d7ce..259aad21d 100644 --- a/src/Api/Controllers/SyncController.cs +++ b/src/Api/Controllers/SyncController.cs @@ -26,6 +26,7 @@ namespace Bit.Api.Controllers private readonly ICollectionCipherRepository _collectionCipherRepository; private readonly IOrganizationUserRepository _organizationUserRepository; private readonly IPolicyRepository _policyRepository; + private readonly ISendRepository _sendRepository; private readonly GlobalSettings _globalSettings; public SyncController( @@ -36,6 +37,7 @@ namespace Bit.Api.Controllers ICollectionCipherRepository collectionCipherRepository, IOrganizationUserRepository organizationUserRepository, IPolicyRepository policyRepository, + ISendRepository sendRepository, GlobalSettings globalSettings) { _userService = userService; @@ -45,11 +47,12 @@ namespace Bit.Api.Controllers _collectionCipherRepository = collectionCipherRepository; _organizationUserRepository = organizationUserRepository; _policyRepository = policyRepository; + _sendRepository = sendRepository; _globalSettings = globalSettings; } [HttpGet("")] - public async Task Get([FromQuery]bool excludeDomains = false) + public async Task Get([FromQuery] bool excludeDomains = false) { var user = await _userService.GetUserByPrincipalAsync(User); if (user == null) @@ -62,6 +65,7 @@ namespace Bit.Api.Controllers var hasEnabledOrgs = organizationUserDetails.Any(o => o.Enabled); var folders = await _folderRepository.GetManyByUserIdAsync(user.Id); var ciphers = await _cipherRepository.GetManyByUserIdAsync(user.Id, hasEnabledOrgs); + var sends = await _sendRepository.GetManyByUserIdAsync(user.Id); IEnumerable collections = null; IDictionary> collectionCiphersGroupDict = null; @@ -76,7 +80,7 @@ namespace Bit.Api.Controllers var userTwoFactorEnabled = await _userService.TwoFactorIsEnabledAsync(user); var response = new SyncResponseModel(_globalSettings, user, userTwoFactorEnabled, organizationUserDetails, - folders, collections, ciphers, collectionCiphersGroupDict, excludeDomains, policies); + folders, collections, ciphers, collectionCiphersGroupDict, excludeDomains, policies, sends); return response; } } diff --git a/src/Core/Models/Api/Response/SyncResponseModel.cs b/src/Core/Models/Api/Response/SyncResponseModel.cs index b124c394a..32c7674ad 100644 --- a/src/Core/Models/Api/Response/SyncResponseModel.cs +++ b/src/Core/Models/Api/Response/SyncResponseModel.cs @@ -19,7 +19,8 @@ namespace Bit.Core.Models.Api IEnumerable ciphers, IDictionary> collectionCiphersDict, bool excludeDomains, - IEnumerable policies) + IEnumerable policies, + IEnumerable sends) : base("sync") { Profile = new ProfileResponseModel(user, organizationUserDetails, userTwoFactorEnabled); @@ -29,6 +30,7 @@ namespace Bit.Core.Models.Api c => new CollectionDetailsResponseModel(c)) ?? new List(); Domains = excludeDomains ? null : new DomainsResponseModel(user, false); Policies = policies?.Select(p => new PolicyResponseModel(p)) ?? new List(); + Sends = sends.Select(s => new SendResponseModel(s, globalSettings)); } public ProfileResponseModel Profile { get; set; } @@ -37,5 +39,6 @@ namespace Bit.Core.Models.Api public IEnumerable Ciphers { get; set; } public DomainsResponseModel Domains { get; set; } public IEnumerable Policies { get; set; } + public IEnumerable Sends { get; set; } } }