diff --git a/frontend/src/app/core/services/entry-ratings.service.ts b/frontend/src/app/core/services/entry-ratings.service.ts new file mode 100644 index 0000000..c413250 --- /dev/null +++ b/frontend/src/app/core/services/entry-ratings.service.ts @@ -0,0 +1,29 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { EntrySeen } from '../../shared/models/entrySeen.model'; +import { EntryRating } from '../../shared/models/entryRating.model'; + +@Injectable({ + providedIn: 'root', +}) +export class EntryRatingsService { + private backend_apiUrl = 'http://localhost:4000/api/v1'; + private apiAction = 'entry-ratings'; + + constructor(private http: HttpClient) {} + + updateEntryRatings(entryRatings: EntryRating) { + return this.http.put( + `${this.backend_apiUrl}/${this.apiAction}/${entryRatings.id}`, + { + entryR: entryRatings + } + ); + } + + getEntrySeenById(id: string) { + return this.http.get( + `${this.backend_apiUrl}/${this.apiAction}/${id}` + ); + } +}