|
|
|
@ -13,15 +13,12 @@ import { IRemainingRequests } from "../interfaces/IRemainingRequests";
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class RequestService extends ServiceHelpers {
|
|
|
|
|
private requestEvents = new ReplaySubject<IRequestEngineResult>();
|
|
|
|
|
public readonly requestEvents = new ReplaySubject();
|
|
|
|
|
|
|
|
|
|
constructor(http: HttpClient, public platformLocation: PlatformLocation) {
|
|
|
|
|
super(http, "/api/v1/Request/", platformLocation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public onRequested(): Observable<IRequestEngineResult> {
|
|
|
|
|
return this.requestEvents.asObservable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getRemainingMovieRequests(): Observable<IRemainingRequests> {
|
|
|
|
|
return this.http.get<IRemainingRequests>(`${this.url}movie/remaining`, {headers: this.headers});
|
|
|
|
|
}
|
|
|
|
@ -31,14 +28,7 @@ export class RequestService extends ServiceHelpers {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public requestMovie(movie: IMovieRequestModel): Observable<IRequestEngineResult> {
|
|
|
|
|
const observer = Observable.create(observer => {
|
|
|
|
|
this.http.post<IRequestEngineResult>(`${this.url}Movie/`, JSON.stringify(movie), {headers: this.headers}).subscribe(m => {
|
|
|
|
|
observer.next(m);
|
|
|
|
|
this.requestEvents.next(m);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return observer;
|
|
|
|
|
return this.http.post<IRequestEngineResult>(`${this.url}Movie/`, JSON.stringify(movie), {headers: this.headers});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getTotalMovies(): Observable<number> {
|
|
|
|
@ -50,14 +40,7 @@ export class RequestService extends ServiceHelpers {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public requestTv(tv: ITvRequestViewModel): Observable<IRequestEngineResult> {
|
|
|
|
|
const observer = Observable.create(observer => {
|
|
|
|
|
return this.http.post<IRequestEngineResult>(`${this.url}TV/`, JSON.stringify(tv), { headers: this.headers }).subscribe(m => {
|
|
|
|
|
observer.next(m);
|
|
|
|
|
this.requestEvents.next(m);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return observer;
|
|
|
|
|
return this.http.post<IRequestEngineResult>(`${this.url}TV/`, JSON.stringify(tv), { headers: this.headers });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public approveMovie(movie: IMovieUpdateModel): Observable<IRequestEngineResult> {
|
|
|
|
|