editable saved views

This commit is contained in:
jonaswinkler
2020-12-15 02:35:04 +01:00
parent 67d03c11b9
commit ff71b04848
5 changed files with 84 additions and 27 deletions

View File

@@ -92,4 +92,10 @@ export abstract class AbstractPaperlessService<T extends ObjectWithId> {
this._listAll = null
return this.http.put<T>(this.getResourceUrl(o.id), o)
}
}
patch(o: T): Observable<T> {
this._listAll = null
return this.http.patch<T>(this.getResourceUrl(o.id), o)
}
}

View File

@@ -1,5 +1,6 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { combineLatest, Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view';
import { AbstractPaperlessService } from './abstract-paperless-service';
@@ -44,6 +45,12 @@ export class SavedViewService extends AbstractPaperlessService<PaperlessSavedVie
)
}
patchMany(objects: PaperlessSavedView[]): Observable<PaperlessSavedView[]> {
return combineLatest(objects.map(o => super.patch(o))).pipe(
tap(() => this.reload())
)
}
delete(o: PaperlessSavedView) {
return super.delete(o).pipe(
tap(() => this.reload())