import { HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { Observable } from 'rxjs' import { DocumentNote } from 'src/app/data/document-note' import { AbstractPaperlessService } from './abstract-paperless-service' @Injectable({ providedIn: 'root', }) export class DocumentNotesService extends AbstractPaperlessService { constructor() { super() this.resourceName = 'documents' } getNotes(documentId: number): Observable { return this.http.get( this.getResourceUrl(documentId, 'notes') ) } addNote(id: number, note: string): Observable { return this.http.post(this.getResourceUrl(id, 'notes'), { note: note, }) } deleteNote(documentId: number, noteId: number): Observable { return this.http.delete( this.getResourceUrl(documentId, 'notes'), { params: new HttpParams({ fromString: `id=${noteId}` }) } ) } }