Merge branch 'dev' into feature/dark-mode

This commit is contained in:
Michael Shamoon
2020-12-28 10:26:33 -08:00
53 changed files with 1171 additions and 703 deletions

View File

@@ -74,27 +74,31 @@ export abstract class AbstractPaperlessService<T extends ObjectWithId> {
)
}
clearCache() {
this._listAll = null
}
get(id: number): Observable<T> {
return this.http.get<T>(this.getResourceUrl(id))
}
create(o: T): Observable<T> {
this._listAll = null
this.clearCache()
return this.http.post<T>(this.getResourceUrl(), o)
}
delete(o: T): Observable<any> {
this._listAll = null
this.clearCache()
return this.http.delete(this.getResourceUrl(o.id))
}
update(o: T): Observable<T> {
this._listAll = null
this.clearCache()
return this.http.put<T>(this.getResourceUrl(o.id), o)
}
patch(o: T): Observable<T> {
this._listAll = null
this.clearCache()
return this.http.patch<T>(this.getResourceUrl(o.id), o)
}

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { PaperlessDocument } from 'src/app/data/paperless-document';
import { PaperlessDocumentMetadata } from 'src/app/data/paperless-document-metadata';
import { AbstractPaperlessService } from './abstract-paperless-service';
import { HttpClient } from '@angular/common/http';
import { HttpClient, HttpParams } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Results } from 'src/app/data/results';
import { FilterRule } from 'src/app/data/filter-rule';
@@ -22,6 +22,17 @@ export const DOCUMENT_SORT_FIELDS = [
{ field: 'modified', name: $localize`Modified` }
]
export interface SelectionDataItem {
id: number
document_count: number
}
export interface SelectionData {
selected_correspondents: SelectionDataItem[]
selected_tags: SelectionDataItem[]
selected_document_types: SelectionDataItem[]
}
@Injectable({
providedIn: 'root'
})
@@ -114,4 +125,8 @@ export class DocumentService extends AbstractPaperlessService<PaperlessDocument>
})
}
getSelectionData(ids: number[]): Observable<SelectionData> {
return this.http.post<SelectionData>(this.getResourceUrl(null, 'selection_data'), {"documents": ids})
}
}