Fix comment service method signature

and run prettier over file
This commit is contained in:
Michael Shamoon 2022-08-07 15:06:52 -07:00
parent 78bd424ecb
commit f20f200c8d

View File

@ -1,31 +1,39 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core'
import { HttpClient, HttpParams } from '@angular/common/http'; import { HttpClient, HttpParams } from '@angular/common/http'
import { PaperlessDocumentComment } from 'src/app/data/paperless-document-comment'; import { PaperlessDocumentComment } from 'src/app/data/paperless-document-comment'
import { AbstractPaperlessService } from './abstract-paperless-service'; import { AbstractPaperlessService } from './abstract-paperless-service'
import { Observable } from 'rxjs'; import { Observable } from 'rxjs'
import { PaperlessDocumentCommentFrame } from 'src/app/data/paperless-document-comment-frame';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root',
}) })
export class DocumentCommentService extends AbstractPaperlessService<PaperlessDocumentComment> { export class DocumentCommentService extends AbstractPaperlessService<PaperlessDocumentComment> {
constructor(http: HttpClient) { constructor(http: HttpClient) {
super(http, 'documents') super(http, 'documents')
} }
getComments(id: number): Observable<PaperlessDocumentComment[]> {
getComments(id: number): Observable<PaperlessDocumentComment> { return this.http.get<PaperlessDocumentComment[]>(
return this.http.get<PaperlessDocumentComment[]>(this.getResourceUrl(id, "comments")) this.getResourceUrl(id, 'comments')
)
} }
addComment(id: number, comment): Observable<PaperlessDocumentComment[]>{ addComment(id: number, comment): Observable<PaperlessDocumentComment[]> {
return this.http.post<PaperlessDocumentComment[]>(this.getResourceUrl(id, 'comments'), {"payload": comment}) return this.http.post<PaperlessDocumentComment[]>(
this.getResourceUrl(id, 'comments'),
{ payload: comment }
)
} }
deleteComment(documentId: number, commentId: number): Observable<PaperlessDocumentComment[]>{ deleteComment(
let httpParams = new HttpParams(); documentId: number,
httpParams = httpParams.set("commentId", commentId.toString()); commentId: number
return this.http.delete<PaperlessDocumentComment[]>(this.getResourceUrl(documentId, 'comments'), {params: httpParams}); ): Observable<PaperlessDocumentComment[]> {
let httpParams = new HttpParams()
httpParams = httpParams.set('commentId', commentId.toString())
return this.http.delete<PaperlessDocumentComment[]>(
this.getResourceUrl(documentId, 'comments'),
{ params: httpParams }
)
} }
} }