mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-10-14 02:36:10 -05:00
35 lines
1.0 KiB
TypeScript
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}` }) }
|
|
)
|
|
}
|
|
}
|