Merge branch 'DotNetCore' of https://github.com/tidusjar/PlexRequests.Net into DotNetCore

pull/1510/head
Jamie.Rees 7 years ago
commit affc5b36ad

@ -160,7 +160,6 @@ namespace Ombi.Core.Engine
results.Issues = request.Issues;
results.Overview = request.Overview;
results.PosterPath = request.PosterPath;
results.RequestedUser = request.RequestedUser;
await MovieRepository.Update(results);
return results;

@ -62,6 +62,19 @@ namespace Ombi.Core.Engine
};
}
// Check if we have auto approved the request, if we have then mark the episodes as approved
if (tvBuilder.ChildRequest.Approved)
{
foreach (var seasons in tvBuilder.ChildRequest.SeasonRequests)
{
foreach (var ep in seasons.Episodes)
{
ep.Approved = true;
ep.Requested = true;
}
}
}
await Audit.Record(AuditType.Added, AuditArea.TvRequest, $"Added Request {tv.Title}", Username);
var existingRequest = await TvRepository.Get().FirstOrDefaultAsync(x => x.TvDbId == tv.Id);
@ -97,8 +110,8 @@ namespace Ombi.Core.Engine
tvBuilder.ChildRequest.Id = 0;
return await AddExistingRequest(tvBuilder.ChildRequest, existingRequest);
}
// This is a new request
// This is a new request
var newRequest = tvBuilder.CreateNewRequest(tv);
return await AddRequest(newRequest.NewRequest);
}

@ -68,14 +68,16 @@
<td>
<span *ngIf="ep.available" class="label label-success">Available</span>
<span *ngIf="ep.approved && !ep.available" class="label label-info">Processing Request</span>
<div *ngIf="!ep.approved">
<div *ngIf="ep.requested && !ep.available; then requested else notRequested"></div>
<ng-template #requested>
<span *ngIf="!ep.available" class="label label-warning">Pending Approval</span>
<span class="label label-warning">Pending Approval</span>
</ng-template>
<ng-template #notRequested>
<span *ngIf="!ep.available" class="label label-danger">Not Yet Requested</span>
<span class="label label-danger">Not Yet Requested</span>
</ng-template>
</div>
</td>
</tr>
</tbody>

@ -26,6 +26,12 @@ export class TvRequestChildrenComponent {
debugger;
request.approved = false;
request.denied = true;
request.seasonRequests.forEach((season) => {
season.episodes.forEach((ep) => {
ep.approved = false;
});
});
this.requestService.updateChild(request)
.subscribe();
}

@ -52,16 +52,16 @@
<span *ngIf="result.available" class="label label-success">Available</span>
<span *ngIf="result.quality" class="label label-success">{{result.quality}}p</span>
<span *ngIf="result.approved && !result.available" class="label label-info">Processing Request</span>
<div *ngIf="result.requested && !result.available; then requested else notRequested"></div>
<ng-template #requested>
<span *ngIf="!result.available" class="label label-warning">Pending Approval</span>
</ng-template>
<ng-template #notRequested>
<span *ngIf="!result.available" class="label label-danger">Not Yet Requested</span>
</ng-template>
<span *ngIf="!result.approved">
<span *ngIf="result.requested && !result.available; then requested else notRequested"></span>
<ng-template #requested>
<span *ngIf="!result.available" class="label label-warning">Pending Approval</span>
</ng-template>
<ng-template #notRequested>
<span *ngIf="!result.available" class="label label-danger">Not Yet Requested</span>
</ng-template>
</span>

@ -6,6 +6,7 @@ import 'rxjs/add/operator/map';
import "rxjs/add/operator/takeUntil";
import { SearchService } from '../services/search.service';
import { AuthService } from '../auth/auth.service';
import { RequestService } from '../services/request.service';
import { NotificationService } from '../services/notification.service';
@ -25,7 +26,9 @@ export class MovieSearchComponent implements OnInit, OnDestroy {
result: IRequestEngineResult;
searchApplied = false;
constructor(private searchService: SearchService, private requestService: RequestService, private notificationService: NotificationService) {
constructor(private searchService: SearchService, private requestService: RequestService,
private notificationService: NotificationService, private authService : AuthService) {
this.searchChanged
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
.distinctUntilChanged() // only emit if value is different from previous value
@ -63,6 +66,10 @@ export class MovieSearchComponent implements OnInit, OnDestroy {
request(searchResult: ISearchMovieResult) {
searchResult.requested = true;
if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) {
searchResult.approved = true;
}
this.requestService.requestMovie(searchResult)
.takeUntil(this.subscriptions)
.subscribe(x => {

@ -1,5 +1,5 @@
import { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
import {Router} from '@angular/router';
import { Router } from '@angular/router';
import { Subject } from 'rxjs/Subject';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';
@ -7,6 +7,7 @@ import 'rxjs/add/operator/map';
import "rxjs/add/operator/takeUntil";
import { SearchService } from '../services/search.service';
import { AuthService } from '../auth/auth.service';
import { RequestService } from '../services/request.service';
import { NotificationService } from '../services/notification.service';
@ -33,7 +34,8 @@ export class TvSearchComponent implements OnInit, OnDestroy {
searchApplied = false;
constructor(private searchService: SearchService, private requestService: RequestService,
private notificationService: NotificationService, private route : Router) {
private notificationService: NotificationService, private route: Router, private authService: AuthService) {
this.searchChanged
.debounceTime(600) // Wait Xms afterthe last event before emitting last event
.distinctUntilChanged() // only emit if value is different from previous value
@ -151,7 +153,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
this.searchService.getShowInformation(val.id)
.takeUntil(this.subscriptions)
.subscribe(x => {
this.updateItem(val,x);
this.updateItem(val, x);
});
});
@ -159,6 +161,9 @@ export class TvSearchComponent implements OnInit, OnDestroy {
request(searchResult: ISearchTvResult) {
searchResult.requested = true;
if (this.authService.hasRole("admin") || this.authService.hasRole("AutoApproveMovie")) {
searchResult.approved = true;
}
this.requestService.requestTv(searchResult)
.takeUntil(this.subscriptions)
.subscribe(x => {

@ -36,7 +36,7 @@ export class RequestService extends ServiceAuthHelpers {
}
updateMovieRequest(request: IMovieRequests): Observable<IMovieRequests> {
return this.http.post(`${this.url}movie/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData);
return this.http.put(`${this.url}movie/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData);
}
getTvRequests(count: number, position: number): Observable<ITvRequests[]> {

Loading…
Cancel
Save