mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 16:52:56 -07:00
Added the ability to re-process requests
This commit is contained in:
parent
6c64f3d4a3
commit
264568f396
15 changed files with 115 additions and 6 deletions
|
@ -21,6 +21,7 @@ using Ombi.Settings.Settings.Models;
|
|||
using Ombi.Store.Entities.Requests;
|
||||
using Ombi.Store.Repository;
|
||||
using Ombi.Core.Models;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ombi.Core.Engine
|
||||
{
|
||||
|
@ -555,6 +556,11 @@ namespace Ombi.Core.Engine
|
|||
await NotificationHelper.Notify(request, NotificationType.RequestApproved);
|
||||
}
|
||||
|
||||
return await ProcessSendingMovie(request);
|
||||
}
|
||||
|
||||
private async Task<RequestEngineResult> ProcessSendingMovie(MovieRequests request)
|
||||
{
|
||||
if (request.Approved)
|
||||
{
|
||||
var result = await Sender.Send(request);
|
||||
|
@ -634,6 +640,21 @@ namespace Ombi.Core.Engine
|
|||
return await MovieRepository.GetAll().AnyAsync(x => x.RequestedUserId == userId);
|
||||
}
|
||||
|
||||
public async Task<RequestEngineResult> ReProcessRequest(int requestId, CancellationToken cancellationToken)
|
||||
{
|
||||
var request = await MovieRepository.Find(requestId);
|
||||
if (request == null)
|
||||
{
|
||||
return new RequestEngineResult
|
||||
{
|
||||
Result = false,
|
||||
ErrorMessage = "Request does not exist"
|
||||
};
|
||||
}
|
||||
|
||||
return await ProcessSendingMovie(request);
|
||||
}
|
||||
|
||||
public async Task<RequestEngineResult> MarkUnavailable(int modelId)
|
||||
{
|
||||
var request = await MovieRepository.Find(modelId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue