Refactor frontend data models

This commit is contained in:
shamoon
2023-12-19 22:36:35 -08:00
parent 5723bd8dd8
commit 66b2d90c50
120 changed files with 640 additions and 706 deletions

View File

@@ -12,7 +12,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
import { of, Subject } from 'rxjs'
import { routes } from 'src/app/app-routing.module'
import { FILTER_HAS_TAGS_ALL } from 'src/app/data/filter-rule-type'
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
import { SavedView } from 'src/app/data/saved-view'
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
import { PermissionsGuard } from 'src/app/guards/permissions.guard'
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
@@ -31,7 +31,7 @@ import { SafeUrlPipe } from 'src/app/pipes/safeurl.pipe'
import { DragDropModule } from '@angular/cdk/drag-drop'
import { PreviewPopupComponent } from 'src/app/components/common/preview-popup/preview-popup.component'
const savedView: PaperlessSavedView = {
const savedView: SavedView = {
id: 1,
name: 'Saved View 1',
sort_field: 'added',

View File

@@ -8,11 +8,11 @@ import {
} from '@angular/core'
import { Params, Router } from '@angular/router'
import { Subject, takeUntil } from 'rxjs'
import { PaperlessDocument } from 'src/app/data/paperless-document'
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
import { Document } from 'src/app/data/document'
import { SavedView } from 'src/app/data/saved-view'
import { ConsumerStatusService } from 'src/app/services/consumer-status.service'
import { DocumentService } from 'src/app/services/rest/document.service'
import { PaperlessTag } from 'src/app/data/paperless-tag'
import { Tag } from 'src/app/data/tag'
import {
FILTER_CORRESPONDENT,
FILTER_HAS_TAGS_ALL,
@@ -46,9 +46,9 @@ export class SavedViewWidgetComponent
}
@Input()
savedView: PaperlessSavedView
savedView: SavedView
documents: PaperlessDocument[] = []
documents: Document[] = []
unsubscribeNotifier: Subject<any> = new Subject()
@@ -101,7 +101,7 @@ export class SavedViewWidgetComponent
}
}
clickTag(tag: PaperlessTag, event: MouseEvent) {
clickTag(tag: Tag, event: MouseEvent) {
event.preventDefault()
event.stopImmediatePropagation()
@@ -110,15 +110,15 @@ export class SavedViewWidgetComponent
])
}
getPreviewUrl(document: PaperlessDocument): string {
getPreviewUrl(document: Document): string {
return this.documentService.getPreviewUrl(document.id)
}
getDownloadUrl(document: PaperlessDocument): string {
getDownloadUrl(document: Document): string {
return this.documentService.getDownloadUrl(document.id)
}
mouseEnterPreviewButton(doc: PaperlessDocument) {
mouseEnterPreviewButton(doc: Document) {
const newPopover = this.popovers.get(this.documents.indexOf(doc))
if (this.popover !== newPopover && this.popover?.isOpen())
this.popover.close()