コード例 #1
0
ファイル: AutoDeleteRequests.cs プロジェクト: Ombi-app/Ombi
        private async Task ProcessTvRequests(DateTime date)
        {
            var requestsToDelete = await _tvRequestRepository.GetChild().Where(x => x.Available && x.MarkedAsAvailable.HasValue && x.MarkedAsAvailable.Value < date).ToListAsync();

            _logger.LogInformation($"Deleting {requestsToDelete.Count} episode requests that have now been scheduled for deletion, All available requests before {date::MM/dd/yyyy} will be deleted");

            await _tvRequestRepository.DeleteChildRange(requestsToDelete);

            // Check if we have parent requests without any child requests now
            var parentRequests = await _tvRequestRepository.Get().Where(x => !x.ChildRequests.Any()).ToListAsync();

            await _tvRequestRepository.DeleteRange(parentRequests);
        }