import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { EntrySeen } from '../../shared/models/entrySeen.model'; @Injectable({ providedIn: 'root', }) export class EntrySeenService { private backend_apiUrl = 'http://localhost:4000/api/v1'; private apiAction = 'entry-seen'; constructor(private http: HttpClient) {} createEntrySeen(entryId: string, dateSeen: Date, seenWith: string) { return this.http.post( `${this.backend_apiUrl}/${this.apiAction}`, { entry_id: entryId, date_seen: dateSeen, seen_with: seenWith, } ); } // get entry seen by entry id getEntrySeenById(id: string) { return this.http.get( `${this.backend_apiUrl}/${this.apiAction}/${id}` ); } removeEntrySeen(id: number) { return this.http.delete( `${this.backend_apiUrl}/${this.apiAction}/${id}` ); } getYearlyStats(year: number) { return this.http.get( `${this.backend_apiUrl}/${this.apiAction}/stats-year/${year}` ); } }