public async Task <StorageInfoDto> GetStorageInfo(CancellationToken token)
        {
            var subscription = await _subscriptionManager.GetOrganizationSubscriptionPlan(token);

            var currentStorage = await _subscriptionManager.GetOrganizationCurrentStorage(token);

            return(new StorageInfoDto
            {
                MaximumStorage = subscription.MaxStorage,
                CurrentStorage = currentStorage
            });
        }
Exemple #2
0
        public async Task CheckOrganizationMaximumStorage(IResourceFile file, CancellationToken token)
        {
            var subscription = await _subscriptionManager.GetOrganizationSubscriptionPlan(token);

            var currentStorage = await _subscriptionManager.GetOrganizationCurrentStorage(token);

            if (DoesFileSizeExceedMaximumStorageAllowed(file, currentStorage, subscription))
            {
                throw new FileExceedsTotalMaximumStorageException();
            }

            if (DoesFileSizeExceedMaximumFileSizeAllowed(file, subscription))
            {
                throw new FileExceedsMaximumFileSizeException();
            }
        }
 public async Task <long> GetCurrentStorage(CancellationToken token)
 {
     return(await _subscriptionManager.GetOrganizationCurrentStorage(token));
 }