From 24c2537faef0edfe687b4822f11aa199d36b71ca Mon Sep 17 00:00:00 2001 From: Mohammed Abad Date: Tue, 16 Apr 2024 19:02:07 +0100 Subject: [PATCH] add entry rating service --- .../core/services/entry-ratings.service.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 frontend/src/app/core/services/entry-ratings.service.ts 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}` + ); + } +}