linked up the tv to issues

pull/3554/head
Jamie Rees 4 years ago
parent 7ca57f3666
commit 6cef4f4cc4

@ -51,8 +51,8 @@ namespace Ombi.Core.Engine.V2
public async Task<SearchFullInfoTvShowViewModel> GetShowByRequest(int requestId)
{
var request = await RequestService.TvRequestService.GetChild().Include(x => x.ParentRequest).FirstOrDefaultAsync(x => x.Id == requestId);
return await GetShowInformation(request.ParentRequest.TvDbId);
var request = await RequestService.TvRequestService.Get().FirstOrDefaultAsync(x => x.Id == requestId);
return await GetShowInformation(request.TvDbId);
}
public async Task<SearchFullInfoTvShowViewModel> GetShowInformation(int tvdbid)

@ -52,8 +52,8 @@
<th mat-header-cell *matHeaderCellDef> </th>
<td mat-cell *matCellDef="let element">
<button *ngIf="element.requestType === 1" mat-raised-button color="accent" [routerLink]="'/details/movie/request/' + element.requestId">{{ 'Issues.Details' | translate}}</button>
<button *ngIf="element.requestType === 0" mat-raised-button color="accent" [routerLink]="'/details/tv/' + element.requestId">{{ 'Issues.Details' | translate}}</button>
<button *ngIf="element.requestType === 2" mat-raised-button color="accent" [routerLink]="'/details/artist/' + element.requestId">{{ 'Issues.Details' | translate}}</button>
<button *ngIf="element.requestType === 0" mat-raised-button color="accent" [routerLink]="'/details/show/request/' + element.requestId">{{ 'Issues.Details' | translate}}</button>
<button *ngIf="element.requestType === 2" mat-raised-button color="accent" [routerLink]="'/details/artist/request/' + element.requestId">{{ 'Issues.Details' | translate}}</button>
<!-- <button mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin"> {{ 'Requests.Options' | translate}}</button> -->
</td>
</ng-container>

@ -38,7 +38,7 @@
{{'Issues.ResolvedDate' | translate}}: {{issue.resolvedDate}}
</div>
<div class="col" *ngIf="issue.createdDate">
{{'Issues.CreatedDate' | translate}}: {{issue.createdDate}}
{{'Issues.CreatedDate' | translate}}: {{issue.createdDate | date}}
</div>

@ -23,6 +23,7 @@ export class TvDetailsComponent implements OnInit {
public isAdmin: boolean;
private tvdbId: number;
private requestIdFromQuery: number;
constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
private sanitizer: DomSanitizer, private imageService: ImageService,
@ -31,6 +32,7 @@ export class TvDetailsComponent implements OnInit {
this.route.params.subscribe((params: any) => {
this.tvdbId = params.tvdbId;
this.fromSearch = params.search;
this.requestIdFromQuery = +params.requestId; // Coming from the issues page
});
}
@ -44,6 +46,9 @@ export class TvDetailsComponent implements OnInit {
if (this.fromSearch) {
this.tv = await this.searchService.getTvInfoWithMovieDbId(this.tvdbId);
this.tvdbId = this.tv.id;
} else if (this.requestIdFromQuery) {
console.log("REQUESTID" + this.requestIdFromQuery)
this.tv = await this.searchService.getTvInfoWithRequestId(this.requestIdFromQuery);
} else {
this.tv = await this.searchService.getTvInfo(this.tvdbId);
}

@ -21,6 +21,7 @@ const routes: Routes = [
{ path: "movie/request/:requestId", component: MovieDetailsComponent, canActivate: [AuthGuard] },
{ path: "tv/:tvdbId/:search", component: TvDetailsComponent, canActivate: [AuthGuard] },
{ path: "tv/:tvdbId", component: TvDetailsComponent, canActivate: [AuthGuard] },
{ path: "show/request/:requestId", component: TvDetailsComponent, canActivate: [AuthGuard] },
{ path: "artist/:artistId", component: ArtistDetailsComponent, canActivate: [AuthGuard] },
];
@NgModule({

@ -92,6 +92,10 @@ export class SearchV2Service extends ServiceHelpers {
public getTvInfo(tvdbid: number): Promise<ISearchTvResultV2> {
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/${tvdbid}`, { headers: this.headers }).toPromise();
}
public getTvInfoWithRequestId(requestId: number): Promise<ISearchTvResultV2> {
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/request/${requestId}`, { headers: this.headers }).toPromise();
}
public getTvInfoWithMovieDbId(theMovieDbId: number): Promise<ISearchTvResultV2> {
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/moviedb/${theMovieDbId}`, { headers: this.headers }).toPromise();

Loading…
Cancel
Save