Rename comments --> notes

This commit is contained in:
shamoon
2023-03-17 16:36:08 -07:00
parent 89c639f850
commit bf8ae22f3f
45 changed files with 540 additions and 528 deletions

View File

@@ -1,37 +0,0 @@
import { Injectable } from '@angular/core'
import { HttpClient, HttpParams } from '@angular/common/http'
import { PaperlessDocumentComment } from 'src/app/data/paperless-document-comment'
import { AbstractPaperlessService } from './abstract-paperless-service'
import { Observable } from 'rxjs'
@Injectable({
providedIn: 'root',
})
export class DocumentCommentsService extends AbstractPaperlessService<PaperlessDocumentComment> {
constructor(http: HttpClient) {
super(http, 'documents')
}
getComments(documentId: number): Observable<PaperlessDocumentComment[]> {
return this.http.get<PaperlessDocumentComment[]>(
this.getResourceUrl(documentId, 'comments')
)
}
addComment(id: number, comment): Observable<PaperlessDocumentComment[]> {
return this.http.post<PaperlessDocumentComment[]>(
this.getResourceUrl(id, 'comments'),
{ comment: comment }
)
}
deleteComment(
documentId: number,
commentId: number
): Observable<PaperlessDocumentComment[]> {
return this.http.delete<PaperlessDocumentComment[]>(
this.getResourceUrl(documentId, 'comments'),
{ params: new HttpParams({ fromString: `id=${commentId}` }) }
)
}
}

View File

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

View File

@@ -22,6 +22,7 @@ export const DOCUMENT_SORT_FIELDS = [
{ field: 'created', name: $localize`Created` },
{ field: 'added', name: $localize`Added` },
{ field: 'modified', name: $localize`Modified` },
{ field: 'num_notes', name: $localize`Notes` },
]
export const DOCUMENT_SORT_FIELDS_FULLTEXT = [