add entry rating service

This commit is contained in:
X4Lo committed 2024-04-16 19:02:07 +01:00
1 parent 882778a45f
commit 24c2537fae
1 file changed
+29
@@ -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<EntryRating>(
`${this.backend_apiUrl}/${this.apiAction}/${entryRatings.id}`,
{
entryR: entryRatings
}
);
}
getEntrySeenById(id: string) {
return this.http.get<EntryRating[]>(
`${this.backend_apiUrl}/${this.apiAction}/${id}`
);
}
}