linked up the tv to issues

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

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

@ -52,8 +52,8 @@
<th mat-header-cell *matHeaderCellDef> </th> <th mat-header-cell *matHeaderCellDef> </th>
<td mat-cell *matCellDef="let element"> <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 === 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 === 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/' + 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> --> <!-- <button mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin"> {{ 'Requests.Options' | translate}}</button> -->
</td> </td>
</ng-container> </ng-container>

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

@ -23,6 +23,7 @@ export class TvDetailsComponent implements OnInit {
public isAdmin: boolean; public isAdmin: boolean;
private tvdbId: number; private tvdbId: number;
private requestIdFromQuery: number;
constructor(private searchService: SearchV2Service, private route: ActivatedRoute, constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
private sanitizer: DomSanitizer, private imageService: ImageService, private sanitizer: DomSanitizer, private imageService: ImageService,
@ -31,6 +32,7 @@ export class TvDetailsComponent implements OnInit {
this.route.params.subscribe((params: any) => { this.route.params.subscribe((params: any) => {
this.tvdbId = params.tvdbId; this.tvdbId = params.tvdbId;
this.fromSearch = params.search; 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) { if (this.fromSearch) {
this.tv = await this.searchService.getTvInfoWithMovieDbId(this.tvdbId); this.tv = await this.searchService.getTvInfoWithMovieDbId(this.tvdbId);
this.tvdbId = this.tv.id; this.tvdbId = this.tv.id;
} else if (this.requestIdFromQuery) {
console.log("REQUESTID" + this.requestIdFromQuery)
this.tv = await this.searchService.getTvInfoWithRequestId(this.requestIdFromQuery);
} else { } else {
this.tv = await this.searchService.getTvInfo(this.tvdbId); this.tv = await this.searchService.getTvInfo(this.tvdbId);
} }

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

@ -93,6 +93,10 @@ export class SearchV2Service extends ServiceHelpers {
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/${tvdbid}`, { headers: this.headers }).toPromise(); 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> { public getTvInfoWithMovieDbId(theMovieDbId: number): Promise<ISearchTvResultV2> {
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/moviedb/${theMovieDbId}`, { headers: this.headers }).toPromise(); return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/moviedb/${theMovieDbId}`, { headers: this.headers }).toPromise();
} }

Loading…
Cancel
Save