F: implemented config service in other services
This commit is contained in:
1 parent
13f68fcac6
commit
cfda451f71
16 files changed
+84
-103
No files matched your search
@@ -4,16 +4,18 @@ import { Observable } from 'rxjs';
|
|||||||
import { Collection } from '../../shared/models/collection.model';
|
import { Collection } from '../../shared/models/collection.model';
|
||||||
import { CollectionEntry } from '../../shared/models/collection-entry.model';
|
import { CollectionEntry } from '../../shared/models/collection-entry.model';
|
||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class CollectionService {
|
export class CollectionService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'collections';
|
private apiAction = 'collections';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
// get all collections
|
// get all collections
|
||||||
getCollections(): Observable<Collection[]> {
|
getCollections(): Observable<Collection[]> {
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Media } from '../../shared/models/media.model';
|
import { Media } from '../../shared/models/media.model';
|
||||||
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class CustomMediaService {
|
export class CustomMediaService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'media';
|
private apiAction = 'media';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
fetchCustomMedia(): Observable<Media[]> {
|
fetchCustomMedia(): Observable<Media[]> {
|
||||||
return this.http.get<Media[]>(`${this.backend_apiUrl}/${this.apiAction}`);
|
return this.http.get<Media[]>(`${this.backend_apiUrl}/${this.apiAction}`);
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { EntryRating } from '../../shared/models/entry-rating.model';
|
import { EntryRating } from '../../shared/models/entry-rating.model';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class EntryRatingsService {
|
export class EntryRatingsService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'entry-ratings';
|
private apiAction = 'entry-ratings';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
updateEntryRatings(entryRatings: EntryRating) {
|
updateEntryRatings(entryRatings: EntryRating) {
|
||||||
return this.http.put<EntryRating>(
|
return this.http.put<EntryRating>(
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { EntrySeen } from '../../shared/models/entry-seen.model';
|
import { EntrySeen } from '../../shared/models/entry-seen.model';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class EntrySeenService {
|
export class EntrySeenService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'entry-seen';
|
private apiAction = 'entry-seen';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
createEntrySeen(entryId: string, dateSeen: Date, seenWith: string) {
|
createEntrySeen(entryId: string, dateSeen: Date, seenWith: string) {
|
||||||
return this.http.post<EntrySeen>(
|
return this.http.post<EntrySeen>(
|
||||||
@@ -45,5 +47,4 @@ export class EntrySeenService {
|
|||||||
`${this.backend_apiUrl}/${this.apiAction}/${id}`
|
`${this.backend_apiUrl}/${this.apiAction}/${id}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,21 +4,19 @@ import { Observable, map } from 'rxjs';
|
|||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
import { EntryId } from '../../shared/models/entryId.model';
|
import { EntryId } from '../../shared/models/entryId.model';
|
||||||
import { EntryRating } from '../../shared/models/entry-rating.model';
|
import { EntryRating } from '../../shared/models/entry-rating.model';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
|
||||||
import { Media } from '../../shared/models/media.model';
|
import { Media } from '../../shared/models/media.model';
|
||||||
import { LibraryService } from './library.service';
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class EntryService {
|
export class EntryService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'entries';
|
private apiAction = 'entries';
|
||||||
|
|
||||||
constructor(
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
private http: HttpClient,
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
private libraryService: LibraryService
|
}
|
||||||
) {}
|
|
||||||
|
|
||||||
// get entries
|
// get entries
|
||||||
getEntries(): Observable<Entry[]> {
|
getEntries(): Observable<Entry[]> {
|
||||||
|
|||||||
@@ -2,16 +2,18 @@ import { Injectable } from '@angular/core';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { EpisodeSeen } from '../../shared/models/episode-seen.model';
|
import { EpisodeSeen } from '../../shared/models/episode-seen.model';
|
||||||
import { EpisodeSeenDto } from '../../shared/models/dtos/episode-seen.dto';
|
import { EpisodeSeenDto } from '../../shared/models/dtos/episode-seen.dto';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class EpisodeSeenService {
|
export class EpisodeSeenService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'episode-seen';
|
private apiAction = 'episode-seen';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
createEpisodeSeen(
|
createEpisodeSeen(
|
||||||
entryId: number,
|
entryId: number,
|
||||||
@@ -59,5 +61,4 @@ export class EpisodeSeenService {
|
|||||||
`${this.backend_apiUrl}/${this.apiAction}/${id}`
|
`${this.backend_apiUrl}/${this.apiAction}/${id}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
|
||||||
import { EpisodeDTO } from '../../shared/models/dtos/episode.dto';
|
import { EpisodeDTO } from '../../shared/models/dtos/episode.dto';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class EpisodeService {
|
export class EpisodeService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'episodes';
|
private apiAction = 'episodes';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
getMonthEpisodes(
|
getMonthEpisodes(
|
||||||
startDate: string,
|
startDate: string,
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
|
||||||
import { SearchItem } from '../../shared/models/search-item.model';
|
import { SearchItem } from '../../shared/models/search-item.model';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class HistoryService {
|
export class HistoryService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'history';
|
private apiAction = 'history';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
getSearchHistory(): Observable<SearchItem[]> {
|
getSearchHistory(): Observable<SearchItem[]> {
|
||||||
return of([] as SearchItem[]);
|
return of([] as SearchItem[]);
|
||||||
|
|||||||
@@ -2,16 +2,18 @@ import { Injectable } from '@angular/core';
|
|||||||
import { MovieDateSeen } from '../../shared/models/dtos/movie-dateSeen.model';
|
import { MovieDateSeen } from '../../shared/models/dtos/movie-dateSeen.model';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class ImporterService {
|
export class ImporterService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'entries';
|
private apiAction = 'entries';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
bulkAddEntries(values: any) {
|
bulkAddEntries(values: any) {
|
||||||
return this.http.post<any[]>(
|
return this.http.post<any[]>(
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';
|
|||||||
import { Observable, throwError, map, of, BehaviorSubject } from 'rxjs';
|
import { Observable, throwError, map, of, BehaviorSubject } from 'rxjs';
|
||||||
import { catchError, tap } from 'rxjs/operators';
|
import { catchError, tap } from 'rxjs/operators';
|
||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@@ -14,13 +14,11 @@ export class LibraryService implements OnInit {
|
|||||||
>([]);
|
>([]);
|
||||||
public entries$: Observable<Entry[]> = this.entriesSubject.asObservable();
|
public entries$: Observable<Entry[]> = this.entriesSubject.asObservable();
|
||||||
|
|
||||||
// private oldEntries: Entry[] = [];
|
private backend_apiUrl;
|
||||||
// private entriesLoaded = false;
|
|
||||||
|
|
||||||
private backend_apiUrl = environment.API_URL;
|
|
||||||
private apiAction = 'entries';
|
private apiAction = 'entries';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
this.fetchAllEntries().subscribe(() => {
|
this.fetchAllEntries().subscribe(() => {
|
||||||
console.log(
|
console.log(
|
||||||
`Library Service: Loaded ${
|
`Library Service: Loaded ${
|
||||||
@@ -119,9 +117,7 @@ export class LibraryService implements OnInit {
|
|||||||
|
|
||||||
public setEntry(entry: Entry) {
|
public setEntry(entry: Entry) {
|
||||||
const currentEntries = this.entriesSubject.getValue();
|
const currentEntries = this.entriesSubject.getValue();
|
||||||
let updatedEntries = currentEntries.filter(
|
let updatedEntries = currentEntries.filter((e) => e.id != entry.id);
|
||||||
(e) => e.id != entry.id
|
|
||||||
);
|
|
||||||
|
|
||||||
updatedEntries.push(entry);
|
updatedEntries.push(entry);
|
||||||
|
|
||||||
@@ -139,36 +135,4 @@ export class LibraryService implements OnInit {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private mapMovieToEntry(movie: any): Entry {
|
|
||||||
// const entryId = {
|
|
||||||
// tmdb_id: movie.entryId.tmdb_id,
|
|
||||||
// } as EntryId;
|
|
||||||
// const entryRating = {
|
|
||||||
// tmdb_rating: movie.entryRating.tmdb_rating,
|
|
||||||
// } as EntryRating;
|
|
||||||
|
|
||||||
// var is_tvseries = movie.release_date == null ? true : false;
|
|
||||||
// var release_date = movie.release_date || movie.first_air_date;
|
|
||||||
|
|
||||||
// return {
|
|
||||||
// entryId: entryId,
|
|
||||||
// entryRating: entryRating,
|
|
||||||
|
|
||||||
// title: movie.title,
|
|
||||||
// original_title: movie.original_title,
|
|
||||||
// release_date: release_date,
|
|
||||||
|
|
||||||
// storyline: movie.storyline,
|
|
||||||
|
|
||||||
// watchlist: movie.storyline,
|
|
||||||
// favorit: false,
|
|
||||||
// hidden: false,
|
|
||||||
|
|
||||||
// is_tvseries: is_tvseries,
|
|
||||||
// status: movie.status,
|
|
||||||
|
|
||||||
// poster_path: movie.poster_path,
|
|
||||||
// } as Entry;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,18 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
|
||||||
import { MaintenanceResult } from '../../shared/models/maintenance-result.model';
|
import { MaintenanceResult } from '../../shared/models/maintenance-result.model';
|
||||||
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class MaintenanceService {
|
export class MaintenanceService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'maintenance';
|
private apiAction = 'maintenance';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
getOrphanFiles() {
|
getOrphanFiles() {
|
||||||
return this.http.get<MaintenanceResult>(
|
return this.http.get<MaintenanceResult>(
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class PingService {
|
export class PingService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'ping';
|
private apiAction = 'ping';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
ping() {
|
ping() {
|
||||||
return this.http.get<string>(
|
return this.http.get<string>(`${this.backend_apiUrl}/${this.apiAction}`);
|
||||||
`${this.backend_apiUrl}/${this.apiAction}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,16 +2,18 @@ import { Injectable } from '@angular/core';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Season } from '../../shared/models/season.model';
|
import { Season } from '../../shared/models/season.model';
|
||||||
import { Episode } from '../../shared/models/episode.models';
|
import { Episode } from '../../shared/models/episode.models';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class SeasonService {
|
export class SeasonService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl ;
|
||||||
private apiAction = 'seasons';
|
private apiAction = 'seasons';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
// get season by id
|
// get season by id
|
||||||
getSeasonById(id: number) {
|
getSeasonById(id: number) {
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
|
||||||
import { Settings } from '../../shared/models/settings.model';
|
import { Settings } from '../../shared/models/settings.model';
|
||||||
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class SettingsService {
|
export class SettingsService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'settings';
|
private apiAction = 'settings';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
getSettings() {
|
getSettings() {
|
||||||
return this.http.get<Settings>(`${this.backend_apiUrl}/${this.apiAction}`);
|
return this.http.get<Settings>(`${this.backend_apiUrl}/${this.apiAction}`);
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class StatisticsService {
|
export class StatisticsService {
|
||||||
private backend_apiUrl = environment.API_URL;
|
private backend_apiUrl;
|
||||||
private apiAction = 'statistics';
|
private apiAction = 'statistics';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
|
this.backend_apiUrl = this.configService.getBackendApiUrl();
|
||||||
|
}
|
||||||
|
|
||||||
fetchYearlyWatchCount(year: number) {
|
fetchYearlyWatchCount(year: number) {
|
||||||
return this.http.get<any>(
|
return this.http.get<any>(
|
||||||
@@ -28,5 +30,4 @@ export class StatisticsService {
|
|||||||
`${this.backend_apiUrl}/${this.apiAction}/watch-time/year/${year}`
|
`${this.backend_apiUrl}/${this.apiAction}/watch-time/year/${year}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,23 +4,21 @@ import { Observable, filter, from, map, of, switchMap, toArray } from 'rxjs';
|
|||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
import { EntryId } from '../../shared/models/entryId.model';
|
import { EntryId } from '../../shared/models/entryId.model';
|
||||||
import { EntryRating } from '../../shared/models/entry-rating.model';
|
import { EntryRating } from '../../shared/models/entry-rating.model';
|
||||||
import { environment } from '../../../environments/environment.prod';
|
import { ConfigService } from './config.service';
|
||||||
import { LibraryService } from './library.service';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class TmdbService {
|
export class TmdbService {
|
||||||
|
private tmdb_apiUrl;
|
||||||
|
private tmdb_apiKey;
|
||||||
|
|
||||||
cach: Record<string, Entry[]> = {};
|
cach: Record<string, Entry[]> = {};
|
||||||
|
|
||||||
constructor(
|
constructor(private http: HttpClient, private configService: ConfigService) {
|
||||||
private http: HttpClient,
|
this.tmdb_apiUrl = this.configService.getTmdbApiUrl();
|
||||||
private libraryService: LibraryService
|
this.tmdb_apiKey = this.configService.getTmdbApiKey();
|
||||||
) {}
|
}
|
||||||
|
|
||||||
// private apiUrl = environment.apiBaseUrl;
|
|
||||||
private tmdb_apiUrl = environment.TMDB_API_URL;
|
|
||||||
private tmdb_apiKey = environment.TMDB_API_KEY;
|
|
||||||
|
|
||||||
fetchdata(endPoint: string): Observable<any> {
|
fetchdata(endPoint: string): Observable<any> {
|
||||||
if (this.cach[endPoint]) {
|
if (this.cach[endPoint]) {
|
||||||
|
|||||||
Reference in new issue
Block a user