Files
paperless-ngx/src-ui/src/app/services/rest/document-notes.service.ts
2025-06-27 14:06:40 -07:00

35 lines
1.0 KiB
TypeScript

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<DocumentNote> {
constructor() {
super()
this.resourceName = 'documents'
}
getNotes(documentId: number): Observable<DocumentNote[]> {
return this.http.get<DocumentNote[]>(
this.getResourceUrl(documentId, 'notes')
)
}
addNote(id: number, note: string): Observable<DocumentNote[]> {
return this.http.post<DocumentNote[]>(this.getResourceUrl(id, 'notes'), {
note: note,
})
}
deleteNote(documentId: number, noteId: number): Observable<DocumentNote[]> {
return this.http.delete<DocumentNote[]>(
this.getResourceUrl(documentId, 'notes'),
{ params: new HttpParams({ fromString: `id=${noteId}` }) }
)
}
}