mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
bleh
This commit is contained in:
parent
40fb27ebab
commit
a278917dcd
8 changed files with 157 additions and 139 deletions
|
@ -4,6 +4,7 @@ using System.Globalization;
|
|||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using Hangfire;
|
||||
using Ombi.Api.TvMaze;
|
||||
using Ombi.Core.Models.Requests;
|
||||
|
@ -17,13 +18,15 @@ namespace Ombi.Core.Engine
|
|||
{
|
||||
public class TvRequestEngine : BaseMediaEngine, ITvRequestEngine
|
||||
{
|
||||
public TvRequestEngine(ITvMazeApi tvApi, IRequestServiceMain requestService, IPrincipal user, INotificationService notificationService) : base(user, requestService)
|
||||
public TvRequestEngine(ITvMazeApi tvApi, IRequestServiceMain requestService, IPrincipal user, INotificationService notificationService, IMapper map) : base(user, requestService)
|
||||
{
|
||||
TvApi = tvApi;
|
||||
NotificationService = notificationService;
|
||||
Mapper = map;
|
||||
}
|
||||
private INotificationService NotificationService { get; }
|
||||
private ITvMazeApi TvApi { get; }
|
||||
private IMapper Mapper { get; }
|
||||
|
||||
public async Task<RequestEngineResult> RequestTvShow(SearchTvShowViewModel tv)
|
||||
{
|
||||
|
@ -166,6 +169,16 @@ namespace Ombi.Core.Engine
|
|||
newRequest.SeasonRequests = episodeDifference;
|
||||
}
|
||||
|
||||
if (!existingRequest.HasChildRequests)
|
||||
{
|
||||
// So this is the first child request, we will want to convert the original request to a child
|
||||
var originalRequest = Mapper.Map<TvRequestModel>(existingRequest);
|
||||
existingRequest.ChildRequests.Add(originalRequest);
|
||||
existingRequest.RequestedUsers.Clear();
|
||||
existingRequest.Approved = false;
|
||||
existingRequest.Available = false;
|
||||
}
|
||||
|
||||
existingRequest.ChildRequests.Add(newRequest);
|
||||
|
||||
TvRequestService.UpdateRequest(existingRequest);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue