diff --git a/src-ui/src/app/app.component.ts b/src-ui/src/app/app.component.ts index 58c439f9b..2ab37d55e 100644 --- a/src-ui/src/app/app.component.ts +++ b/src-ui/src/app/app.component.ts @@ -1,5 +1,5 @@ import { SettingsService } from './services/settings.service' -import { SETTINGS_KEYS } from './data/paperless-uisettings' +import { SETTINGS_KEYS } from './data/ui-settings' import { Component, OnDestroy, OnInit, Renderer2 } from '@angular/core' import { Router } from '@angular/router' import { Subscription, first } from 'rxjs' diff --git a/src-ui/src/app/components/admin/settings/settings.component.spec.ts b/src-ui/src/app/components/admin/settings/settings.component.spec.ts index 73ac3c98a..b434ea1a8 100644 --- a/src-ui/src/app/components/admin/settings/settings.component.spec.ts +++ b/src-ui/src/app/components/admin/settings/settings.component.spec.ts @@ -13,8 +13,8 @@ import { import { NgSelectModule } from '@ng-select/ng-select' import { of, throwError } from 'rxjs' import { routes } from 'src/app/app-routing.module' -import { PaperlessSavedView } from 'src/app/data/paperless-saved-view' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SavedView } from 'src/app/data/saved-view' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' 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' @@ -138,7 +138,7 @@ describe('SettingsComponent', () => { of({ all: savedViews.map((v) => v.id), count: savedViews.length, - results: (savedViews as PaperlessSavedView[]).concat([]), + results: (savedViews as SavedView[]).concat([]), }) ) } @@ -226,9 +226,7 @@ describe('SettingsComponent', () => { savedViewPatchSpy.mockClear() // succeed saved views - savedViewPatchSpy.mockReturnValueOnce( - of(savedViews as PaperlessSavedView[]) - ) + savedViewPatchSpy.mockReturnValueOnce(of(savedViews as SavedView[])) component.saveSettings() expect(toastErrorSpy).not.toHaveBeenCalled() expect(savedViewPatchSpy).toHaveBeenCalled() @@ -335,7 +333,7 @@ describe('SettingsComponent', () => { const toastSpy = jest.spyOn(toastService, 'showInfo') const deleteSpy = jest.spyOn(savedViewService, 'delete') deleteSpy.mockReturnValue(of(true)) - component.deleteSavedView(savedViews[0] as PaperlessSavedView) + component.deleteSavedView(savedViews[0] as SavedView) expect(deleteSpy).toHaveBeenCalled() expect(toastSpy).toHaveBeenCalledWith( `Saved view "${savedViews[0].name}" deleted.` diff --git a/src-ui/src/app/components/admin/settings/settings.component.ts b/src-ui/src/app/components/admin/settings/settings.component.ts index 90dd00dfd..da1f2ac60 100644 --- a/src-ui/src/app/components/admin/settings/settings.component.ts +++ b/src-ui/src/app/components/admin/settings/settings.component.ts @@ -21,10 +21,10 @@ import { takeUntil, tap, } from 'rxjs' -import { PaperlessGroup } from 'src/app/data/paperless-group' -import { PaperlessSavedView } from 'src/app/data/paperless-saved-view' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { Group } from 'src/app/data/group' +import { SavedView } from 'src/app/data/saved-view' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' +import { User } from 'src/app/data/user' import { DocumentListViewService } from 'src/app/services/document-list-view.service' import { PermissionsService, @@ -98,7 +98,7 @@ export class SettingsComponent savedViews: this.savedViewGroup, }) - savedViews: PaperlessSavedView[] + savedViews: SavedView[] store: BehaviorSubject storeSub: Subscription @@ -107,8 +107,8 @@ export class SettingsComponent unsubscribeNotifier: Subject = new Subject() savePending: boolean = false - users: PaperlessUser[] - groups: PaperlessGroup[] + users: User[] + groups: Group[] get computedDateLocale(): string { return ( @@ -368,7 +368,7 @@ export class SettingsComponent this.settings.organizingSidebarSavedViews = false } - deleteSavedView(savedView: PaperlessSavedView) { + deleteSavedView(savedView: SavedView) { this.savedViewService.delete(savedView).subscribe(() => { this.savedViewGroup.removeControl(savedView.id.toString()) this.savedViews.splice(this.savedViews.indexOf(savedView), 1) @@ -531,7 +531,7 @@ export class SettingsComponent saveSettings() { // only patch views that have actually changed - const changed: PaperlessSavedView[] = [] + const changed: SavedView[] = [] Object.values(this.savedViewGroup.controls) .filter((g: FormGroup) => !g.pristine) .forEach((group: FormGroup) => { diff --git a/src-ui/src/app/components/admin/users-groups/users-groups.component.spec.ts b/src-ui/src/app/components/admin/users-groups/users-groups.component.spec.ts index fd8961d51..bbc666c21 100644 --- a/src-ui/src/app/components/admin/users-groups/users-groups.component.spec.ts +++ b/src-ui/src/app/components/admin/users-groups/users-groups.component.spec.ts @@ -41,8 +41,8 @@ import { TextComponent } from '../../common/input/text/text.component' import { PageHeaderComponent } from '../../common/page-header/page-header.component' import { SettingsComponent } from '../settings/settings.component' import { UsersAndGroupsComponent } from './users-groups.component' -import { PaperlessUser } from 'src/app/data/paperless-user' -import { PaperlessGroup } from 'src/app/data/paperless-group' +import { User } from 'src/app/data/user' +import { Group } from 'src/app/data/group' const users = [ { id: 1, username: 'user1', is_superuser: false }, @@ -119,7 +119,7 @@ describe('UsersAndGroupsComponent', () => { of({ all: users.map((a) => a.id), count: users.length, - results: (users as PaperlessUser[]).concat([]), + results: (users as User[]).concat([]), }) ) } @@ -128,7 +128,7 @@ describe('UsersAndGroupsComponent', () => { of({ all: groups.map((r) => r.id), count: groups.length, - results: (groups as PaperlessGroup[]).concat([]), + results: (groups as Group[]).concat([]), }) ) } diff --git a/src-ui/src/app/components/admin/users-groups/users-groups.component.ts b/src-ui/src/app/components/admin/users-groups/users-groups.component.ts index 8f1751092..f049677ab 100644 --- a/src-ui/src/app/components/admin/users-groups/users-groups.component.ts +++ b/src-ui/src/app/components/admin/users-groups/users-groups.component.ts @@ -1,8 +1,8 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { Subject, first, takeUntil } from 'rxjs' -import { PaperlessGroup } from 'src/app/data/paperless-group' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { Group } from 'src/app/data/group' +import { User } from 'src/app/data/user' import { PermissionsService } from 'src/app/services/permissions.service' import { GroupService } from 'src/app/services/rest/group.service' import { UserService } from 'src/app/services/rest/user.service' @@ -23,8 +23,8 @@ export class UsersAndGroupsComponent extends ComponentWithPermissions implements OnInit, OnDestroy { - users: PaperlessUser[] - groups: PaperlessGroup[] + users: User[] + groups: Group[] unsubscribeNotifier: Subject = new Subject() @@ -69,7 +69,7 @@ export class UsersAndGroupsComponent this.unsubscribeNotifier.next(true) } - editUser(user: PaperlessUser = null) { + editUser(user: User = null) { var modal = this.modalService.open(UserEditDialogComponent, { backdrop: 'static', size: 'xl', @@ -80,7 +80,7 @@ export class UsersAndGroupsComponent modal.componentInstance.object = user modal.componentInstance.succeeded .pipe(takeUntil(this.unsubscribeNotifier)) - .subscribe((newUser: PaperlessUser) => { + .subscribe((newUser: User) => { if ( newUser.id === this.settings.currentUser.id && (modal.componentInstance as UserEditDialogComponent).passwordIsSet @@ -107,7 +107,7 @@ export class UsersAndGroupsComponent }) } - deleteUser(user: PaperlessUser) { + deleteUser(user: User) { let modal = this.modalService.open(ConfirmDialogComponent, { backdrop: 'static', }) @@ -133,7 +133,7 @@ export class UsersAndGroupsComponent }) } - editGroup(group: PaperlessGroup = null) { + editGroup(group: Group = null) { var modal = this.modalService.open(GroupEditDialogComponent, { backdrop: 'static', size: 'lg', @@ -157,7 +157,7 @@ export class UsersAndGroupsComponent }) } - deleteGroup(group: PaperlessGroup) { + deleteGroup(group: Group) { let modal = this.modalService.open(ConfirmDialogComponent, { backdrop: 'static', }) diff --git a/src-ui/src/app/components/app-frame/app-frame.component.spec.ts b/src-ui/src/app/components/app-frame/app-frame.component.spec.ts index c361d9540..0bee89a14 100644 --- a/src-ui/src/app/components/app-frame/app-frame.component.spec.ts +++ b/src-ui/src/app/components/app-frame/app-frame.component.spec.ts @@ -15,11 +15,11 @@ import { RouterTestingModule } from '@angular/router/testing' import { SettingsService } from 'src/app/services/settings.service' import { SavedViewService } from 'src/app/services/rest/saved-view.service' import { PermissionsService } from 'src/app/services/permissions.service' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { RemoteVersionService } from 'src/app/services/rest/remote-version.service' import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive' import { FormsModule, ReactiveFormsModule } from '@angular/forms' -import { Observable, of, tap, throwError } from 'rxjs' +import { of, throwError } from 'rxjs' import { ToastService } from 'src/app/services/toast.service' import { environment } from 'src/environments/environment' import { OpenDocumentsService } from 'src/app/services/open-documents.service' @@ -31,7 +31,7 @@ import { FILTER_FULLTEXT_QUERY } from 'src/app/data/filter-rule-type' import { routes } from 'src/app/app-routing.module' import { PermissionsGuard } from 'src/app/guards/permissions.guard' import { CdkDragDrop, DragDropModule } from '@angular/cdk/drag-drop' -import { PaperlessSavedView } from 'src/app/data/paperless-saved-view' +import { SavedView } from 'src/app/data/saved-view' import { ProfileEditDialogComponent } from '../common/profile-edit-dialog/profile-edit-dialog.component' const saved_views = [ @@ -356,7 +356,7 @@ describe('AppFrameComponent', () => { const toastSpy = jest.spyOn(toastService, 'showInfo') jest.spyOn(settingsService, 'storeSettings').mockReturnValue(of(true)) component.onDrop({ previousIndex: 0, currentIndex: 1 } as CdkDragDrop< - PaperlessSavedView[] + SavedView[] >) expect(settingsSpy).toHaveBeenCalledWith([ saved_views[2], @@ -379,7 +379,7 @@ describe('AppFrameComponent', () => { .spyOn(settingsService, 'storeSettings') .mockReturnValue(throwError(() => new Error('unable to save'))) component.onDrop({ previousIndex: 0, currentIndex: 2 } as CdkDragDrop< - PaperlessSavedView[] + SavedView[] >) expect(toastSpy).toHaveBeenCalled() }) diff --git a/src-ui/src/app/components/app-frame/app-frame.component.ts b/src-ui/src/app/components/app-frame/app-frame.component.ts index 963da4b05..0e877b7ce 100644 --- a/src-ui/src/app/components/app-frame/app-frame.component.ts +++ b/src-ui/src/app/components/app-frame/app-frame.component.ts @@ -10,7 +10,7 @@ import { first, catchError, } from 'rxjs/operators' -import { PaperlessDocument } from 'src/app/data/paperless-document' +import { Document } from 'src/app/data/document' import { OpenDocumentsService } from 'src/app/services/open-documents.service' import { SavedViewService } from 'src/app/services/rest/saved-view.service' import { SearchService } from 'src/app/services/rest/search.service' @@ -25,7 +25,7 @@ import { import { SettingsService } from 'src/app/services/settings.service' import { TasksService } from 'src/app/services/tasks.service' import { ComponentCanDeactivate } from 'src/app/guards/dirty-doc.guard' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { ToastService } from 'src/app/services/toast.service' import { ComponentWithPermissions } from '../with-permissions/with-permissions.component' import { @@ -33,7 +33,7 @@ import { PermissionsService, PermissionType, } from 'src/app/services/permissions.service' -import { PaperlessSavedView } from 'src/app/data/paperless-saved-view' +import { SavedView } from 'src/app/data/saved-view' import { CdkDragStart, CdkDragEnd, @@ -132,7 +132,7 @@ export class AppFrameComponent this.closeMenu() } - get openDocuments(): PaperlessDocument[] { + get openDocuments(): Document[] { return this.openDocumentsService.getOpenDocuments() } @@ -200,7 +200,7 @@ export class AppFrameComponent ]) } - closeDocument(d: PaperlessDocument) { + closeDocument(d: Document) { this.openDocumentsService .closeDocument(d) .pipe(first()) @@ -250,7 +250,7 @@ export class AppFrameComponent this.settingsService.globalDropzoneEnabled = true } - onDrop(event: CdkDragDrop) { + onDrop(event: CdkDragDrop) { const sidebarViews = this.savedViewService.sidebarViews.concat([]) moveItemInArray(sidebarViews, event.previousIndex, event.currentIndex) diff --git a/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.spec.ts b/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.spec.ts index e1892acc6..31435956d 100644 --- a/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.spec.ts +++ b/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.spec.ts @@ -8,10 +8,7 @@ import { import { ToastService } from 'src/app/services/toast.service' import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service' import { of } from 'rxjs' -import { - PaperlessCustomField, - PaperlessCustomFieldDataType, -} from 'src/app/data/paperless-custom-field' +import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field' import { SelectComponent } from '../input/select/select.component' import { NgSelectModule } from '@ng-select/ng-select' import { FormsModule, ReactiveFormsModule } from '@angular/forms' @@ -24,16 +21,16 @@ import { import { CustomFieldEditDialogComponent } from '../edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component' import { By } from '@angular/platform-browser' -const fields: PaperlessCustomField[] = [ +const fields: CustomField[] = [ { id: 0, name: 'Field 1', - data_type: PaperlessCustomFieldDataType.Integer, + data_type: CustomFieldDataType.Integer, }, { id: 1, name: 'Field 2', - data_type: PaperlessCustomFieldDataType.String, + data_type: CustomFieldDataType.String, }, ] diff --git a/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.ts b/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.ts index 8a237286a..79c0d1b58 100644 --- a/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.ts +++ b/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.ts @@ -7,8 +7,8 @@ import { } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { Subject, first, takeUntil } from 'rxjs' -import { PaperlessCustomField } from 'src/app/data/paperless-custom-field' -import { PaperlessCustomFieldInstance } from 'src/app/data/paperless-custom-field-instance' +import { CustomField } from 'src/app/data/custom-field' +import { CustomFieldInstance } from 'src/app/data/custom-field-instance' import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service' import { ToastService } from 'src/app/services/toast.service' import { CustomFieldEditDialogComponent } from '../edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component' @@ -31,16 +31,16 @@ export class CustomFieldsDropdownComponent implements OnDestroy { disabled: boolean = false @Input() - existingFields: PaperlessCustomFieldInstance[] = [] + existingFields: CustomFieldInstance[] = [] @Output() - added: EventEmitter = new EventEmitter() + added: EventEmitter = new EventEmitter() @Output() - created: EventEmitter = new EventEmitter() + created: EventEmitter = new EventEmitter() - private customFields: PaperlessCustomField[] = [] - public unusedFields: PaperlessCustomField[] + private customFields: CustomField[] = [] + public unusedFields: CustomField[] public name: string @@ -88,8 +88,8 @@ export class CustomFieldsDropdownComponent implements OnDestroy { } public getCustomFieldFromInstance( - instance: PaperlessCustomFieldInstance - ): PaperlessCustomField { + instance: CustomFieldInstance + ): CustomField { return this.customFields.find((f) => f.id === instance.field) } diff --git a/src-ui/src/app/components/common/edit-dialog/consumption-template-edit-dialog/consumption-template-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/consumption-template-edit-dialog/consumption-template-edit-dialog.component.ts index dedbd3523..079af9cc5 100644 --- a/src-ui/src/app/components/common/edit-dialog/consumption-template-edit-dialog/consumption-template-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/consumption-template-edit-dialog/consumption-template-edit-dialog.component.ts @@ -4,11 +4,11 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { first } from 'rxjs' import { DocumentSource, - PaperlessConsumptionTemplate, -} from 'src/app/data/paperless-consumption-template' -import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' -import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' -import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path' + ConsumptionTemplate, +} from 'src/app/data/consumption-template' +import { Correspondent } from 'src/app/data/correspondent' +import { DocumentType } from 'src/app/data/document-type' +import { StoragePath } from 'src/app/data/storage-path' import { ConsumptionTemplateService } from 'src/app/services/rest/consumption-template.service' import { CorrespondentService } from 'src/app/services/rest/correspondent.service' import { DocumentTypeService } from 'src/app/services/rest/document-type.service' @@ -17,9 +17,9 @@ import { UserService } from 'src/app/services/rest/user.service' import { SettingsService } from 'src/app/services/settings.service' import { EditDialogComponent } from '../edit-dialog.component' import { MailRuleService } from 'src/app/services/rest/mail-rule.service' -import { PaperlessMailRule } from 'src/app/data/paperless-mail-rule' +import { MailRule } from 'src/app/data/mail-rule' import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service' -import { PaperlessCustomField } from 'src/app/data/paperless-custom-field' +import { CustomField } from 'src/app/data/custom-field' export const DOCUMENT_SOURCE_OPTIONS = [ { @@ -41,13 +41,13 @@ export const DOCUMENT_SOURCE_OPTIONS = [ templateUrl: './consumption-template-edit-dialog.component.html', styleUrls: ['./consumption-template-edit-dialog.component.scss'], }) -export class ConsumptionTemplateEditDialogComponent extends EditDialogComponent { - templates: PaperlessConsumptionTemplate[] - correspondents: PaperlessCorrespondent[] - documentTypes: PaperlessDocumentType[] - storagePaths: PaperlessStoragePath[] - mailRules: PaperlessMailRule[] - customFields: PaperlessCustomField[] +export class ConsumptionTemplateEditDialogComponent extends EditDialogComponent { + templates: ConsumptionTemplate[] + correspondents: Correspondent[] + documentTypes: DocumentType[] + storagePaths: StoragePath[] + mailRules: MailRule[] + customFields: CustomField[] constructor( service: ConsumptionTemplateService, diff --git a/src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.ts index 6c290af1b..fcac0424a 100644 --- a/src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.ts @@ -3,7 +3,7 @@ import { FormControl, FormGroup } from '@angular/forms' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component' import { DEFAULT_MATCHING_ALGORITHM } from 'src/app/data/matching-model' -import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' +import { Correspondent } from 'src/app/data/correspondent' import { CorrespondentService } from 'src/app/services/rest/correspondent.service' import { UserService } from 'src/app/services/rest/user.service' import { SettingsService } from 'src/app/services/settings.service' @@ -13,7 +13,7 @@ import { SettingsService } from 'src/app/services/settings.service' templateUrl: './correspondent-edit-dialog.component.html', styleUrls: ['./correspondent-edit-dialog.component.scss'], }) -export class CorrespondentEditDialogComponent extends EditDialogComponent { +export class CorrespondentEditDialogComponent extends EditDialogComponent { constructor( service: CorrespondentService, activeModal: NgbActiveModal, diff --git a/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts index 51a353080..570b93ae5 100644 --- a/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts @@ -1,10 +1,7 @@ import { Component, OnInit } from '@angular/core' import { FormGroup, FormControl } from '@angular/forms' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' -import { - DATA_TYPE_LABELS, - PaperlessCustomField, -} from 'src/app/data/paperless-custom-field' +import { DATA_TYPE_LABELS, CustomField } from 'src/app/data/custom-field' import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service' import { UserService } from 'src/app/services/rest/user.service' import { SettingsService } from 'src/app/services/settings.service' @@ -16,7 +13,7 @@ import { EditDialogComponent, EditDialogMode } from '../edit-dialog.component' styleUrls: ['./custom-field-edit-dialog.component.scss'], }) export class CustomFieldEditDialogComponent - extends EditDialogComponent + extends EditDialogComponent implements OnInit { constructor( diff --git a/src-ui/src/app/components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component.ts index 7450a5bc6..bce1eb759 100644 --- a/src-ui/src/app/components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component.ts @@ -3,7 +3,7 @@ import { FormControl, FormGroup } from '@angular/forms' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component' import { DEFAULT_MATCHING_ALGORITHM } from 'src/app/data/matching-model' -import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' +import { DocumentType } from 'src/app/data/document-type' import { DocumentTypeService } from 'src/app/services/rest/document-type.service' import { UserService } from 'src/app/services/rest/user.service' import { SettingsService } from 'src/app/services/settings.service' @@ -13,7 +13,7 @@ import { SettingsService } from 'src/app/services/settings.service' templateUrl: './document-type-edit-dialog.component.html', styleUrls: ['./document-type-edit-dialog.component.scss'], }) -export class DocumentTypeEditDialogComponent extends EditDialogComponent { +export class DocumentTypeEditDialogComponent extends EditDialogComponent { constructor( service: DocumentTypeService, activeModal: NgbActiveModal, diff --git a/src-ui/src/app/components/common/edit-dialog/edit-dialog.component.spec.ts b/src-ui/src/app/components/common/edit-dialog/edit-dialog.component.spec.ts index d0974236d..76b8706f4 100644 --- a/src-ui/src/app/components/common/edit-dialog/edit-dialog.component.spec.ts +++ b/src-ui/src/app/components/common/edit-dialog/edit-dialog.component.spec.ts @@ -23,8 +23,8 @@ import { MATCH_NONE, MATCH_ALL, } from 'src/app/data/matching-model' -import { PaperlessTag } from 'src/app/data/paperless-tag' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { Tag } from 'src/app/data/tag' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { TagService } from 'src/app/services/rest/tag.service' import { UserService } from 'src/app/services/rest/user.service' import { SettingsService } from 'src/app/services/settings.service' @@ -38,7 +38,7 @@ import { EditDialogComponent, EditDialogMode } from './edit-dialog.component' `, }) -class TestComponent extends EditDialogComponent { +class TestComponent extends EditDialogComponent { constructor( service: TagService, activeModal: NgbActiveModal, diff --git a/src-ui/src/app/components/common/edit-dialog/edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/edit-dialog.component.ts index 43253ba8a..64b3bedad 100644 --- a/src-ui/src/app/components/common/edit-dialog/edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/edit-dialog.component.ts @@ -9,12 +9,12 @@ import { } from 'src/app/data/matching-model' import { ObjectWithId } from 'src/app/data/object-with-id' import { ObjectWithPermissions } from 'src/app/data/object-with-permissions' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { User } from 'src/app/data/user' import { AbstractPaperlessService } from 'src/app/services/rest/abstract-paperless-service' import { UserService } from 'src/app/services/rest/user.service' import { PermissionsFormObject } from '../input/permissions/permissions-form/permissions-form.component' import { SettingsService } from 'src/app/services/settings.service' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' export enum EditDialogMode { CREATE = 0, @@ -33,7 +33,7 @@ export abstract class EditDialogComponent< private settingsService: SettingsService ) {} - users: PaperlessUser[] + users: User[] @Input() dialogMode: EditDialogMode = EditDialogMode.CREATE diff --git a/src-ui/src/app/components/common/edit-dialog/group-edit-dialog/group-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/group-edit-dialog/group-edit-dialog.component.ts index aec1ec05e..b1b55ca8e 100644 --- a/src-ui/src/app/components/common/edit-dialog/group-edit-dialog/group-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/group-edit-dialog/group-edit-dialog.component.ts @@ -2,7 +2,7 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component' -import { PaperlessGroup } from 'src/app/data/paperless-group' +import { Group } from 'src/app/data/group' import { GroupService } from 'src/app/services/rest/group.service' import { UserService } from 'src/app/services/rest/user.service' import { SettingsService } from 'src/app/services/settings.service' @@ -12,7 +12,7 @@ import { SettingsService } from 'src/app/services/settings.service' templateUrl: './group-edit-dialog.component.html', styleUrls: ['./group-edit-dialog.component.scss'], }) -export class GroupEditDialogComponent extends EditDialogComponent { +export class GroupEditDialogComponent extends EditDialogComponent { constructor( service: GroupService, activeModal: NgbActiveModal, diff --git a/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.spec.ts b/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.spec.ts index 69767bd75..46c4903f5 100644 --- a/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.spec.ts +++ b/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.spec.ts @@ -11,7 +11,7 @@ import { import { FormsModule, ReactiveFormsModule } from '@angular/forms' import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap' import { NgSelectModule } from '@ng-select/ng-select' -import { IMAPSecurity } from 'src/app/data/paperless-mail-account' +import { IMAPSecurity } from 'src/app/data/mail-account' import { IfOwnerDirective } from 'src/app/directives/if-owner.directive' import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive' import { SettingsService } from 'src/app/services/settings.service' diff --git a/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.ts index 59e01d30e..9a068ac88 100644 --- a/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.ts @@ -2,10 +2,7 @@ import { Component, ViewChild } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' import { NgbActiveModal, NgbAlert } from '@ng-bootstrap/ng-bootstrap' import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component' -import { - IMAPSecurity, - PaperlessMailAccount, -} from 'src/app/data/paperless-mail-account' +import { IMAPSecurity, MailAccount } from 'src/app/data/mail-account' import { MailAccountService } from 'src/app/services/rest/mail-account.service' import { UserService } from 'src/app/services/rest/user.service' import { SettingsService } from 'src/app/services/settings.service' @@ -21,7 +18,7 @@ const IMAP_SECURITY_OPTIONS = [ templateUrl: './mail-account-edit-dialog.component.html', styleUrls: ['./mail-account-edit-dialog.component.scss'], }) -export class MailAccountEditDialogComponent extends EditDialogComponent { +export class MailAccountEditDialogComponent extends EditDialogComponent { testActive: boolean = false testResult: string alertTimeout diff --git a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.spec.ts b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.spec.ts index 6e48d95f0..8b2c398c9 100644 --- a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.spec.ts +++ b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.spec.ts @@ -7,7 +7,7 @@ import { of } from 'rxjs' import { MailMetadataCorrespondentOption, MailAction, -} from 'src/app/data/paperless-mail-rule' +} from 'src/app/data/mail-rule' import { IfOwnerDirective } from 'src/app/directives/if-owner.directive' import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive' import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe' diff --git a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts index 2d9469f9e..51793e78a 100644 --- a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts @@ -3,17 +3,17 @@ import { FormControl, FormGroup } from '@angular/forms' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { first } from 'rxjs' import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component' -import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' -import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' -import { PaperlessMailAccount } from 'src/app/data/paperless-mail-account' +import { Correspondent } from 'src/app/data/correspondent' +import { DocumentType } from 'src/app/data/document-type' +import { MailAccount } from 'src/app/data/mail-account' import { MailAction, MailFilterAttachmentType, MailMetadataCorrespondentOption, MailMetadataTitleOption, - PaperlessMailRule, + MailRule, MailRuleConsumptionScope, -} from 'src/app/data/paperless-mail-rule' +} from 'src/app/data/mail-rule' import { CorrespondentService } from 'src/app/services/rest/correspondent.service' import { DocumentTypeService } from 'src/app/services/rest/document-type.service' import { MailAccountService } from 'src/app/services/rest/mail-account.service' @@ -109,10 +109,10 @@ const METADATA_CORRESPONDENT_OPTIONS = [ templateUrl: './mail-rule-edit-dialog.component.html', styleUrls: ['./mail-rule-edit-dialog.component.scss'], }) -export class MailRuleEditDialogComponent extends EditDialogComponent { - accounts: PaperlessMailAccount[] - correspondents: PaperlessCorrespondent[] - documentTypes: PaperlessDocumentType[] +export class MailRuleEditDialogComponent extends EditDialogComponent { + accounts: MailAccount[] + correspondents: Correspondent[] + documentTypes: DocumentType[] constructor( service: MailRuleService, diff --git a/src-ui/src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.ts index 0e600b8ab..4a18605e7 100644 --- a/src-ui/src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component.ts @@ -3,7 +3,7 @@ import { FormControl, FormGroup } from '@angular/forms' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component' import { DEFAULT_MATCHING_ALGORITHM } from 'src/app/data/matching-model' -import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path' +import { StoragePath } from 'src/app/data/storage-path' import { StoragePathService } from 'src/app/services/rest/storage-path.service' import { UserService } from 'src/app/services/rest/user.service' import { SettingsService } from 'src/app/services/settings.service' @@ -13,7 +13,7 @@ import { SettingsService } from 'src/app/services/settings.service' templateUrl: './storage-path-edit-dialog.component.html', styleUrls: ['./storage-path-edit-dialog.component.scss'], }) -export class StoragePathEditDialogComponent extends EditDialogComponent { +export class StoragePathEditDialogComponent extends EditDialogComponent { constructor( service: StoragePathService, activeModal: NgbActiveModal, diff --git a/src-ui/src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.ts index e27169354..3eb726738 100644 --- a/src-ui/src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.ts @@ -2,7 +2,7 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Tag } from 'src/app/data/tag' import { TagService } from 'src/app/services/rest/tag.service' import { randomColor } from 'src/app/utils/color' import { DEFAULT_MATCHING_ALGORITHM } from 'src/app/data/matching-model' @@ -14,7 +14,7 @@ import { SettingsService } from 'src/app/services/settings.service' templateUrl: './tag-edit-dialog.component.html', styleUrls: ['./tag-edit-dialog.component.scss'], }) -export class TagEditDialogComponent extends EditDialogComponent { +export class TagEditDialogComponent extends EditDialogComponent { constructor( service: TagService, activeModal: NgbActiveModal, diff --git a/src-ui/src/app/components/common/edit-dialog/user-edit-dialog/user-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/user-edit-dialog/user-edit-dialog.component.ts index 94072f404..ebbf0766e 100644 --- a/src-ui/src/app/components/common/edit-dialog/user-edit-dialog/user-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/user-edit-dialog/user-edit-dialog.component.ts @@ -3,8 +3,8 @@ import { FormControl, FormGroup } from '@angular/forms' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { first } from 'rxjs' import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component' -import { PaperlessGroup } from 'src/app/data/paperless-group' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { Group } from 'src/app/data/group' +import { User } from 'src/app/data/user' import { GroupService } from 'src/app/services/rest/group.service' import { UserService } from 'src/app/services/rest/user.service' import { SettingsService } from 'src/app/services/settings.service' @@ -15,10 +15,10 @@ import { SettingsService } from 'src/app/services/settings.service' styleUrls: ['./user-edit-dialog.component.scss'], }) export class UserEditDialogComponent - extends EditDialogComponent + extends EditDialogComponent implements OnInit { - groups: PaperlessGroup[] + groups: Group[] passwordIsSet: boolean = false constructor( diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts index 13b8d7c59..f97953597 100644 --- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts +++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts @@ -13,7 +13,7 @@ import { } from './filterable-dropdown.component' import { FilterPipe } from 'src/app/pipes/filter.pipe' import { NgbModule } from '@ng-bootstrap/ng-bootstrap' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Tag } from 'src/app/data/tag' import { DEFAULT_MATCHING_ALGORITHM, MATCH_ALL, @@ -26,7 +26,7 @@ import { TagComponent } from '../tag/tag.component' import { FormsModule, ReactiveFormsModule } from '@angular/forms' import { ClearableBadgeComponent } from '../clearable-badge/clearable-badge.component' -const items: PaperlessTag[] = [ +const items: Tag[] = [ { id: 1, name: 'Tag1', diff --git a/src-ui/src/app/components/common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component.spec.ts b/src-ui/src/app/components/common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component.spec.ts index 712c1c9bd..379fc591d 100644 --- a/src-ui/src/app/components/common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component.spec.ts +++ b/src-ui/src/app/components/common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component.spec.ts @@ -4,7 +4,7 @@ import { ToggleableItemState, } from './toggleable-dropdown-button.component' import { TagComponent } from '../../tag/tag.component' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Tag } from 'src/app/data/tag' describe('ToggleableDropdownButtonComponent', () => { let component: ToggleableDropdownButtonComponent @@ -26,7 +26,7 @@ describe('ToggleableDropdownButtonComponent', () => { id: 1, name: 'Test Tag', is_inbox_tag: false, - } as PaperlessTag + } as Tag fixture.detectChanges() expect(component.isTag).toBeTruthy() diff --git a/src-ui/src/app/components/common/input/document-link/document-link.component.ts b/src-ui/src/app/components/common/input/document-link/document-link.component.ts index 77a0fb99a..3ec26cb60 100644 --- a/src-ui/src/app/components/common/input/document-link/document-link.component.ts +++ b/src-ui/src/app/components/common/input/document-link/document-link.component.ts @@ -13,7 +13,7 @@ import { catchError, } from 'rxjs' import { FILTER_TITLE } from 'src/app/data/filter-rule-type' -import { PaperlessDocument } from 'src/app/data/paperless-document' +import { Document } from 'src/app/data/document' import { DocumentService } from 'src/app/services/rest/document.service' import { AbstractInputComponent } from '../abstract-input' @@ -34,9 +34,9 @@ export class DocumentLinkComponent implements OnInit, OnDestroy { documentsInput$ = new Subject() - foundDocuments$: Observable + foundDocuments$: Observable loading = false - selectedDocuments: PaperlessDocument[] = [] + selectedDocuments: Document[] = [] private unsubscribeNotifier: Subject = new Subject() @@ -104,21 +104,18 @@ export class DocumentLinkComponent ) } - unselect(document: PaperlessDocument): void { + unselect(document: Document): void { this.selectedDocuments = this.selectedDocuments.filter( (d) => d.id !== document.id ) this.onChange(this.selectedDocuments.map((d) => d.id)) } - compareDocuments( - document: PaperlessDocument, - selectedDocument: PaperlessDocument - ) { + compareDocuments(document: Document, selectedDocument: Document) { return document.id === selectedDocument.id } - trackByFn(item: PaperlessDocument) { + trackByFn(item: Document) { return item.id } diff --git a/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.ts b/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.ts index 81716d40a..313465953 100644 --- a/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.ts +++ b/src-ui/src/app/components/common/input/permissions/permissions-form/permissions-form.component.ts @@ -1,6 +1,6 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core' import { FormControl, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { User } from 'src/app/data/user' import { AbstractInputComponent } from '../../abstract-input' export interface PermissionsFormObject { @@ -34,7 +34,7 @@ export class PermissionsFormComponent implements OnInit { @Input() - users: PaperlessUser[] + users: User[] @Input() accordion: boolean = false diff --git a/src-ui/src/app/components/common/input/permissions/permissions-group/permissions-group.component.ts b/src-ui/src/app/components/common/input/permissions/permissions-group/permissions-group.component.ts index b17c6ccc1..391cca9f1 100644 --- a/src-ui/src/app/components/common/input/permissions/permissions-group/permissions-group.component.ts +++ b/src-ui/src/app/components/common/input/permissions/permissions-group/permissions-group.component.ts @@ -1,7 +1,7 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core' import { NG_VALUE_ACCESSOR } from '@angular/forms' import { first } from 'rxjs/operators' -import { PaperlessGroup } from 'src/app/data/paperless-group' +import { Group } from 'src/app/data/group' import { GroupService } from 'src/app/services/rest/group.service' import { AbstractInputComponent } from '../../abstract-input' @@ -17,8 +17,8 @@ import { AbstractInputComponent } from '../../abstract-input' templateUrl: './permissions-group.component.html', styleUrls: ['./permissions-group.component.scss'], }) -export class PermissionsGroupComponent extends AbstractInputComponent { - groups: PaperlessGroup[] +export class PermissionsGroupComponent extends AbstractInputComponent { + groups: Group[] constructor(groupService: GroupService) { super() diff --git a/src-ui/src/app/components/common/input/permissions/permissions-user/permissions-user.component.ts b/src-ui/src/app/components/common/input/permissions/permissions-user/permissions-user.component.ts index 5773ca2d6..1b9ea7414 100644 --- a/src-ui/src/app/components/common/input/permissions/permissions-user/permissions-user.component.ts +++ b/src-ui/src/app/components/common/input/permissions/permissions-user/permissions-user.component.ts @@ -1,7 +1,7 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core' import { NG_VALUE_ACCESSOR } from '@angular/forms' import { first } from 'rxjs/operators' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { User } from 'src/app/data/user' import { UserService } from 'src/app/services/rest/user.service' import { SettingsService } from 'src/app/services/settings.service' import { AbstractInputComponent } from '../../abstract-input' @@ -18,10 +18,8 @@ import { AbstractInputComponent } from '../../abstract-input' templateUrl: './permissions-user.component.html', styleUrls: ['./permissions-user.component.scss'], }) -export class PermissionsUserComponent extends AbstractInputComponent< - PaperlessUser[] -> { - users: PaperlessUser[] +export class PermissionsUserComponent extends AbstractInputComponent { + users: User[] constructor(userService: UserService, settings: SettingsService) { super() diff --git a/src-ui/src/app/components/common/input/select/select.component.spec.ts b/src-ui/src/app/components/common/input/select/select.component.spec.ts index 554175cac..e9eee1648 100644 --- a/src-ui/src/app/components/common/input/select/select.component.spec.ts +++ b/src-ui/src/app/components/common/input/select/select.component.spec.ts @@ -10,7 +10,7 @@ import { NG_VALUE_ACCESSOR, } from '@angular/forms' import { SelectComponent } from './select.component' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Tag } from 'src/app/data/tag' import { DEFAULT_MATCHING_ALGORITHM, MATCH_ALL, @@ -18,7 +18,7 @@ import { import { NgSelectModule } from '@ng-select/ng-select' import { RouterTestingModule } from '@angular/router/testing' -const items: PaperlessTag[] = [ +const items: Tag[] = [ { id: 1, name: 'Tag1', diff --git a/src-ui/src/app/components/common/input/tags/tags.component.spec.ts b/src-ui/src/app/components/common/input/tags/tags.component.spec.ts index a3cf518b2..86905527c 100644 --- a/src-ui/src/app/components/common/input/tags/tags.component.spec.ts +++ b/src-ui/src/app/components/common/input/tags/tags.component.spec.ts @@ -5,7 +5,7 @@ import { NG_VALUE_ACCESSOR, } from '@angular/forms' import { TagsComponent } from './tags.component' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Tag } from 'src/app/data/tag' import { DEFAULT_MATCHING_ALGORITHM, MATCH_ALL, @@ -31,7 +31,7 @@ import { PermissionsFormComponent } from '../permissions/permissions-form/permis import { SelectComponent } from '../select/select.component' import { SettingsService } from 'src/app/services/settings.service' -const tags: PaperlessTag[] = [ +const tags: Tag[] = [ { id: 1, name: 'Tag1', diff --git a/src-ui/src/app/components/common/input/tags/tags.component.ts b/src-ui/src/app/components/common/input/tags/tags.component.ts index c1bde5e8f..d5cd70c9a 100644 --- a/src-ui/src/app/components/common/input/tags/tags.component.ts +++ b/src-ui/src/app/components/common/input/tags/tags.component.ts @@ -9,7 +9,7 @@ import { } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Tag } from 'src/app/data/tag' import { TagEditDialogComponent } from '../../edit-dialog/tag-edit-dialog/tag-edit-dialog.component' import { TagService } from 'src/app/services/rest/tag.service' import { EditDialogMode } from '../../edit-dialog/edit-dialog.component' @@ -81,13 +81,13 @@ export class TagsComponent implements OnInit, ControlValueAccessor { horizontal: boolean = false @Output() - filterDocuments = new EventEmitter() + filterDocuments = new EventEmitter() @ViewChild('tagSelect') select: NgSelectComponent value: number[] = [] - tags: PaperlessTag[] = [] + tags: Tag[] = [] public createTagRef: (name) => void diff --git a/src-ui/src/app/components/common/permissions-dialog/permissions-dialog.component.ts b/src-ui/src/app/components/common/permissions-dialog/permissions-dialog.component.ts index e6d5fdb2b..9a514387c 100644 --- a/src-ui/src/app/components/common/permissions-dialog/permissions-dialog.component.ts +++ b/src-ui/src/app/components/common/permissions-dialog/permissions-dialog.component.ts @@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { ObjectWithPermissions } from 'src/app/data/object-with-permissions' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { User } from 'src/app/data/user' import { UserService } from 'src/app/services/rest/user.service' @Component({ @@ -11,7 +11,7 @@ import { UserService } from 'src/app/services/rest/user.service' styleUrls: ['./permissions-dialog.component.scss'], }) export class PermissionsDialogComponent { - users: PaperlessUser[] + users: User[] private o: ObjectWithPermissions = undefined constructor( diff --git a/src-ui/src/app/components/common/permissions-filter-dropdown/permissions-filter-dropdown.component.ts b/src-ui/src/app/components/common/permissions-filter-dropdown/permissions-filter-dropdown.component.ts index 73a35f2ad..3f5c3e68d 100644 --- a/src-ui/src/app/components/common/permissions-filter-dropdown/permissions-filter-dropdown.component.ts +++ b/src-ui/src/app/components/common/permissions-filter-dropdown/permissions-filter-dropdown.component.ts @@ -1,6 +1,6 @@ import { Component, EventEmitter, Input, Output } from '@angular/core' import { first } from 'rxjs' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { User } from 'src/app/data/user' import { PermissionAction, PermissionType, @@ -55,7 +55,7 @@ export class PermissionsFilterDropdownComponent extends ComponentWithPermissions @Output() ownerFilterSet = new EventEmitter() - users: PaperlessUser[] + users: User[] hideUnowned: boolean diff --git a/src-ui/src/app/components/common/preview-popup/preview-popup.component.spec.ts b/src-ui/src/app/components/common/preview-popup/preview-popup.component.spec.ts index edcf63f51..9238bf8e1 100644 --- a/src-ui/src/app/components/common/preview-popup/preview-popup.component.spec.ts +++ b/src-ui/src/app/components/common/preview-popup/preview-popup.component.spec.ts @@ -5,7 +5,7 @@ import { PdfViewerComponent } from '../pdf-viewer/pdf-viewer.component' import { By } from '@angular/platform-browser' import { SafeUrlPipe } from 'src/app/pipes/safeurl.pipe' import { SettingsService } from 'src/app/services/settings.service' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { HttpClientTestingModule } from '@angular/common/http/testing' import { DocumentService } from 'src/app/services/rest/document.service' diff --git a/src-ui/src/app/components/common/preview-popup/preview-popup.component.ts b/src-ui/src/app/components/common/preview-popup/preview-popup.component.ts index 014e31e8b..c3d2987d3 100644 --- a/src-ui/src/app/components/common/preview-popup/preview-popup.component.ts +++ b/src-ui/src/app/components/common/preview-popup/preview-popup.component.ts @@ -1,6 +1,6 @@ import { Component, Input } from '@angular/core' -import { PaperlessDocument } from 'src/app/data/paperless-document' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { Document } from 'src/app/data/document' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { DocumentService } from 'src/app/services/rest/document.service' import { SettingsService } from 'src/app/services/settings.service' @@ -11,7 +11,7 @@ import { SettingsService } from 'src/app/services/settings.service' }) export class PreviewPopupComponent { @Input() - document: PaperlessDocument + document: Document error = false diff --git a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.spec.ts b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.spec.ts index 0b7284383..e5d73dba1 100644 --- a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.spec.ts +++ b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.spec.ts @@ -10,10 +10,7 @@ import { } from '@angular/core/testing' import { FormsModule, ReactiveFormsModule } from '@angular/forms' import { of, throwError } from 'rxjs' -import { - PaperlessFileVersion, - PaperlessShareLink, -} from 'src/app/data/paperless-share-link' +import { FileVersion, ShareLink } from 'src/app/data/share-link' import { ShareLinkService } from 'src/app/services/rest/share-link.service' import { ToastService } from 'src/app/services/toast.service' import { environment } from 'src/environments/environment' @@ -60,7 +57,7 @@ describe('ShareLinksDropdownComponent', () => { slug: '1234slug', created: now.toISOString(), document: 99, - file_version: PaperlessFileVersion.Archive, + file_version: FileVersion.Archive, expiration: expiration7days.toISOString(), }, { @@ -68,7 +65,7 @@ describe('ShareLinksDropdownComponent', () => { slug: '1234slug', created: now.toISOString(), document: 99, - file_version: PaperlessFileVersion.Original, + file_version: FileVersion.Original, expiration: null, }, ]) @@ -152,7 +149,7 @@ describe('ShareLinksDropdownComponent', () => { deleteSpy.mockReturnValue(of(true)) const refreshSpy = jest.spyOn(component, 'refresh') - component.delete({ id: 12 } as PaperlessShareLink) + component.delete({ id: 12 } as ShareLink) fixture.detectChanges() expect(deleteSpy).toHaveBeenCalledWith({ id: 12 }) expect(refreshSpy).toHaveBeenCalled() @@ -178,18 +175,18 @@ describe('ShareLinksDropdownComponent', () => { expect( component.getDaysRemaining({ expiration: expiration7days.toISOString(), - } as PaperlessShareLink) + } as ShareLink) ).toEqual('7 days') expect( component.getDaysRemaining({ expiration: expiration1day.toISOString(), - } as PaperlessShareLink) + } as ShareLink) ).toEqual('1 day') }) // coverage it('should support share', () => { - const link = { slug: '12345slug' } as PaperlessShareLink + const link = { slug: '12345slug' } as ShareLink if (!('share' in navigator)) Object.defineProperty(navigator, 'share', { value: (obj: any) => {} }) // const navigatorSpy = jest.spyOn(navigator, 'share') diff --git a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts index cce951ba2..caf24914a 100644 --- a/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts +++ b/src-ui/src/app/components/common/share-links-dropdown/share-links-dropdown.component.ts @@ -1,9 +1,6 @@ import { Component, Input, OnInit } from '@angular/core' import { first } from 'rxjs' -import { - PaperlessShareLink, - PaperlessFileVersion, -} from 'src/app/data/paperless-share-link' +import { ShareLink, FileVersion } from 'src/app/data/share-link' import { ShareLinkService } from 'src/app/services/rest/share-link.service' import { ToastService } from 'src/app/services/toast.service' import { environment } from 'src/environments/environment' @@ -41,7 +38,7 @@ export class ShareLinksDropdownComponent implements OnInit { @Input() hasArchiveVersion: boolean = true - shareLinks: PaperlessShareLink[] + shareLinks: ShareLink[] loading: boolean = false @@ -83,21 +80,21 @@ export class ShareLinksDropdownComponent implements OnInit { }) } - getShareUrl(link: PaperlessShareLink): string { + getShareUrl(link: ShareLink): string { const apiURL = new URL(environment.apiBaseUrl) return `${apiURL.origin}${apiURL.pathname.replace(/\/api\/$/, '/share/')}${ link.slug }` } - getDaysRemaining(link: PaperlessShareLink): string { + getDaysRemaining(link: ShareLink): string { const days: number = Math.round( (Date.parse(link.expiration) - Date.now()) / (1000 * 60 * 60 * 24) ) return days === 1 ? $localize`1 day` : $localize`${days} days` } - copy(link: PaperlessShareLink) { + copy(link: ShareLink) { const success = this.clipboard.copy(this.getShareUrl(link)) if (success) { this.copied = link.id @@ -107,17 +104,17 @@ export class ShareLinksDropdownComponent implements OnInit { } } - canShare(link: PaperlessShareLink): boolean { + canShare(link: ShareLink): boolean { return ( navigator?.canShare && navigator.canShare({ url: this.getShareUrl(link) }) ) } - share(link: PaperlessShareLink) { + share(link: ShareLink) { navigator.share({ url: this.getShareUrl(link) }) } - delete(link: PaperlessShareLink) { + delete(link: ShareLink) { this.shareLinkService.delete(link).subscribe({ next: () => { this.refresh() @@ -138,9 +135,7 @@ export class ShareLinksDropdownComponent implements OnInit { this.shareLinkService .createLinkForDocument( this._documentId, - this.useArchiveVersion - ? PaperlessFileVersion.Archive - : PaperlessFileVersion.Original, + this.useArchiveVersion ? FileVersion.Archive : FileVersion.Original, expiration ) .subscribe({ diff --git a/src-ui/src/app/components/common/tag/tag.component.spec.ts b/src-ui/src/app/components/common/tag/tag.component.spec.ts index 300dbdece..07f72a906 100644 --- a/src-ui/src/app/components/common/tag/tag.component.spec.ts +++ b/src-ui/src/app/components/common/tag/tag.component.spec.ts @@ -1,9 +1,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing' import { TagComponent } from './tag.component' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Tag } from 'src/app/data/tag' import { By } from '@angular/platform-browser' -const tag: PaperlessTag = { +const tag: Tag = { id: 1, color: '#ff0000', name: 'Tag1', diff --git a/src-ui/src/app/components/common/tag/tag.component.ts b/src-ui/src/app/components/common/tag/tag.component.ts index 2c05a8ba0..0a052f9b5 100644 --- a/src-ui/src/app/components/common/tag/tag.component.ts +++ b/src-ui/src/app/components/common/tag/tag.component.ts @@ -1,5 +1,5 @@ import { Component, Input } from '@angular/core' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Tag } from 'src/app/data/tag' @Component({ selector: 'pngx-tag', @@ -10,7 +10,7 @@ export class TagComponent { constructor() {} @Input() - tag: PaperlessTag + tag: Tag @Input() linkTitle: string = '' diff --git a/src-ui/src/app/components/dashboard/dashboard.component.spec.ts b/src-ui/src/app/components/dashboard/dashboard.component.spec.ts index ed084d670..3f36b8f0c 100644 --- a/src-ui/src/app/components/dashboard/dashboard.component.spec.ts +++ b/src-ui/src/app/components/dashboard/dashboard.component.spec.ts @@ -18,9 +18,9 @@ import { TourNgBootstrapModule, TourService } from 'ngx-ui-tour-ng-bootstrap' import { LogoComponent } from '../common/logo/logo.component' import { of, throwError } from 'rxjs' import { ToastService } from 'src/app/services/toast.service' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { CdkDragDrop, DragDropModule } from '@angular/cdk/drag-drop' -import { PaperlessSavedView } from 'src/app/data/paperless-saved-view' +import { SavedView } from 'src/app/data/saved-view' const saved_views = [ { @@ -167,7 +167,7 @@ describe('DashboardComponent', () => { const toastSpy = jest.spyOn(toastService, 'showInfo') jest.spyOn(settingsService, 'storeSettings').mockReturnValue(of(true)) component.onDrop({ previousIndex: 0, currentIndex: 1 } as CdkDragDrop< - PaperlessSavedView[] + SavedView[] >) expect(settingsSpy).toHaveBeenCalledWith([ saved_views[2], @@ -190,7 +190,7 @@ describe('DashboardComponent', () => { .spyOn(settingsService, 'storeSettings') .mockReturnValue(throwError(() => new Error('unable to save'))) component.onDrop({ previousIndex: 0, currentIndex: 2 } as CdkDragDrop< - PaperlessSavedView[] + SavedView[] >) expect(toastSpy).toHaveBeenCalled() }) diff --git a/src-ui/src/app/components/dashboard/dashboard.component.ts b/src-ui/src/app/components/dashboard/dashboard.component.ts index 4b585cb32..a35e7459b 100644 --- a/src-ui/src/app/components/dashboard/dashboard.component.ts +++ b/src-ui/src/app/components/dashboard/dashboard.component.ts @@ -3,9 +3,9 @@ import { SavedViewService } from 'src/app/services/rest/saved-view.service' import { SettingsService } from 'src/app/services/settings.service' import { ComponentWithPermissions } from '../with-permissions/with-permissions.component' import { TourService } from 'ngx-ui-tour-ng-bootstrap' -import { PaperlessSavedView } from 'src/app/data/paperless-saved-view' +import { SavedView } from 'src/app/data/saved-view' import { ToastService } from 'src/app/services/toast.service' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { CdkDragDrop, CdkDragEnd, @@ -19,7 +19,7 @@ import { styleUrls: ['./dashboard.component.scss'], }) export class DashboardComponent extends ComponentWithPermissions { - public dashboardViews: PaperlessSavedView[] = [] + public dashboardViews: SavedView[] = [] constructor( public settingsService: SettingsService, public savedViewService: SavedViewService, @@ -57,7 +57,7 @@ export class DashboardComponent extends ComponentWithPermissions { this.settingsService.globalDropzoneEnabled = true } - onDrop(event: CdkDragDrop) { + onDrop(event: CdkDragDrop) { moveItemInArray( this.dashboardViews, event.previousIndex, diff --git a/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.spec.ts b/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.spec.ts index 84d1fb654..29029fa00 100644 --- a/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.spec.ts +++ b/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.spec.ts @@ -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', diff --git a/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.ts b/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.ts index 601d9384e..aa1b160cf 100644 --- a/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.ts +++ b/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.ts @@ -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 = 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() diff --git a/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts b/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts index 8332012ca..a06352797 100644 --- a/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts +++ b/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts @@ -1,7 +1,7 @@ import { Component, QueryList, ViewChildren } from '@angular/core' import { NgbAlert } from '@ng-bootstrap/ng-bootstrap' import { ComponentWithPermissions } from 'src/app/components/with-permissions/with-permissions.component' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { ConsumerStatusService, FileStatus, diff --git a/src-ui/src/app/components/document-detail/document-detail.component.spec.ts b/src-ui/src/app/components/document-detail/document-detail.component.spec.ts index 4a9d01cc2..388baf70a 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.spec.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.spec.ts @@ -30,11 +30,11 @@ import { FILTER_CREATED_AFTER, FILTER_CREATED_BEFORE, } from 'src/app/data/filter-rule-type' -import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' -import { PaperlessDocument } from 'src/app/data/paperless-document' -import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' -import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Correspondent } from 'src/app/data/correspondent' +import { Document } from 'src/app/data/document' +import { DocumentType } from 'src/app/data/document-type' +import { StoragePath } from 'src/app/data/storage-path' +import { Tag } from 'src/app/data/tag' import { IfOwnerDirective } from 'src/app/directives/if-owner.directive' import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive' import { PermissionsGuard } from 'src/app/guards/permissions.guard' @@ -67,11 +67,11 @@ import { DocumentNotesComponent } from '../document-notes/document-notes.compone import { DocumentDetailComponent } from './document-detail.component' import { ShareLinksDropdownComponent } from '../common/share-links-dropdown/share-links-dropdown.component' import { CustomFieldsDropdownComponent } from '../common/custom-fields-dropdown/custom-fields-dropdown.component' -import { PaperlessCustomFieldDataType } from 'src/app/data/paperless-custom-field' +import { CustomFieldDataType } from 'src/app/data/custom-field' import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service' import { PdfViewerComponent } from '../common/pdf-viewer/pdf-viewer.component' -const doc: PaperlessDocument = { +const doc: Document = { id: 3, title: 'Doc 3', correspondent: 11, @@ -111,13 +111,13 @@ const customFields = [ { id: 0, name: 'Field 1', - data_type: PaperlessCustomFieldDataType.String, + data_type: CustomFieldDataType.String, created: new Date(), }, { id: 1, name: 'Custom Field 2', - data_type: PaperlessCustomFieldDataType.Integer, + data_type: CustomFieldDataType.Integer, created: new Date(), }, ] @@ -732,7 +732,7 @@ describe('DocumentDetailComponent', () => { id: 22, name: 'Correspondent22', last_correspondence: new Date().toISOString(), - } as PaperlessCorrespondent + } as Correspondent const qfSpy = jest.spyOn(documentListViewService, 'quickFilter') component.filterDocuments([object]) expect(qfSpy).toHaveBeenCalledWith([ @@ -745,7 +745,7 @@ describe('DocumentDetailComponent', () => { it('should support quick filtering by doc type', () => { initNormally() - const object = { id: 22, name: 'DocumentType22' } as PaperlessDocumentType + const object = { id: 22, name: 'DocumentType22' } as DocumentType const qfSpy = jest.spyOn(documentListViewService, 'quickFilter') component.filterDocuments([object]) expect(qfSpy).toHaveBeenCalledWith([ @@ -762,7 +762,7 @@ describe('DocumentDetailComponent', () => { id: 22, name: 'StoragePath22', path: '/foo/bar/', - } as PaperlessStoragePath + } as StoragePath const qfSpy = jest.spyOn(documentListViewService, 'quickFilter') component.filterDocuments([object]) expect(qfSpy).toHaveBeenCalledWith([ @@ -781,14 +781,14 @@ describe('DocumentDetailComponent', () => { is_inbox_tag: true, color: '#ff0000', text_color: '#000000', - } as PaperlessTag + } as Tag const object2 = { id: 23, name: 'Tag22', is_inbox_tag: true, color: '#ff0000', text_color: '#000000', - } as PaperlessTag + } as Tag const qfSpy = jest.spyOn(documentListViewService, 'quickFilter') component.filterDocuments([object1, object2]) expect(qfSpy).toHaveBeenCalledWith([ diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index ef2728c31..1e7865f84 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -7,11 +7,11 @@ import { NgbNav, NgbNavChangeEvent, } from '@ng-bootstrap/ng-bootstrap' -import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' -import { PaperlessDocument } from 'src/app/data/paperless-document' -import { PaperlessDocumentMetadata } from 'src/app/data/paperless-document-metadata' -import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Correspondent } from 'src/app/data/correspondent' +import { Document } from 'src/app/data/document' +import { DocumentMetadata } from 'src/app/data/document-metadata' +import { DocumentType } from 'src/app/data/document-type' +import { Tag } from 'src/app/data/tag' import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe' import { DocumentListViewService } from 'src/app/services/document-list-view.service' import { OpenDocumentsService } from 'src/app/services/open-documents.service' @@ -34,7 +34,7 @@ import { debounceTime, distinctUntilChanged, } from 'rxjs/operators' -import { PaperlessDocumentSuggestions } from 'src/app/data/paperless-document-suggestions' +import { DocumentSuggestions } from 'src/app/data/document-suggestions' import { FILTER_CORRESPONDENT, FILTER_CREATED_AFTER, @@ -45,28 +45,25 @@ import { FILTER_STORAGE_PATH, } from 'src/app/data/filter-rule-type' import { StoragePathService } from 'src/app/services/rest/storage-path.service' -import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path' +import { StoragePath } from 'src/app/data/storage-path' import { StoragePathEditDialogComponent } from '../common/edit-dialog/storage-path-edit-dialog/storage-path-edit-dialog.component' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { PermissionAction, PermissionsService, PermissionType, } from 'src/app/services/permissions.service' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { User } from 'src/app/data/user' import { UserService } from 'src/app/services/rest/user.service' -import { PaperlessDocumentNote } from 'src/app/data/paperless-document-note' +import { DocumentNote } from 'src/app/data/document-note' import { HttpClient } from '@angular/common/http' import { ComponentWithPermissions } from '../with-permissions/with-permissions.component' import { EditDialogMode } from '../common/edit-dialog/edit-dialog.component' import { ObjectWithId } from 'src/app/data/object-with-id' import { FilterRule } from 'src/app/data/filter-rule' import { ISODateAdapter } from 'src/app/utils/ngb-iso-date-adapter' -import { - PaperlessCustomField, - PaperlessCustomFieldDataType, -} from 'src/app/data/paperless-custom-field' -import { PaperlessCustomFieldInstance } from 'src/app/data/paperless-custom-field-instance' +import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field' +import { CustomFieldInstance } from 'src/app/data/custom-field-instance' import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service' import { PDFDocumentProxy } from '../common/pdf-viewer/typings' @@ -111,10 +108,10 @@ export class DocumentDetailComponent networkActive = false documentId: number - document: PaperlessDocument - metadata: PaperlessDocumentMetadata - suggestions: PaperlessDocumentSuggestions - users: PaperlessUser[] + document: Document + metadata: DocumentMetadata + suggestions: DocumentSuggestions + users: User[] title: string titleSubject: Subject = new Subject() @@ -123,9 +120,9 @@ export class DocumentDetailComponent downloadUrl: string downloadOriginalUrl: string - correspondents: PaperlessCorrespondent[] - documentTypes: PaperlessDocumentType[] - storagePaths: PaperlessStoragePath[] + correspondents: Correspondent[] + documentTypes: DocumentType[] + storagePaths: StoragePath[] documentForm: FormGroup = new FormGroup({ title: new FormControl(''), @@ -155,8 +152,8 @@ export class DocumentDetailComponent ogDate: Date - customFields: PaperlessCustomField[] - public readonly PaperlessCustomFieldDataType = PaperlessCustomFieldDataType + customFields: CustomField[] + public readonly PaperlessCustomFieldDataType = CustomFieldDataType @ViewChild('nav') nav: NgbNav @ViewChild('pdfPreview') set pdfPreview(element) { @@ -409,7 +406,7 @@ export class DocumentDetailComponent ]) } - updateComponent(doc: PaperlessDocument) { + updateComponent(doc: Document) { this.document = doc this.requiresPassword = false // this.customFields = doc.custom_fields.concat([]) @@ -825,13 +822,13 @@ export class DocumentDetailComponent ) } - notesUpdated(notes: PaperlessDocumentNote[]) { + notesUpdated(notes: DocumentNote[]) { this.document.notes = notes this.openDocumentService.refreshDocument(this.documentId) } get userIsOwner(): boolean { - let doc: PaperlessDocument = Object.assign({}, this.document) + let doc: Document = Object.assign({}, this.document) // dont disable while editing if (this.document && this.store?.value.permissions_form?.owner) { doc.owner = this.store?.value.permissions_form?.owner @@ -840,7 +837,7 @@ export class DocumentDetailComponent } get userCanEdit(): boolean { - let doc: PaperlessDocument = Object.assign({}, this.document) + let doc: Document = Object.assign({}, this.document) // dont disable while editing if (this.document && this.store?.value.permissions_form?.owner) { doc.owner = this.store?.value.permissions_form?.owner @@ -877,25 +874,25 @@ export class DocumentDetailComponent // Correspondent return { rule_type: FILTER_CORRESPONDENT, - value: (i as PaperlessCorrespondent).id.toString(), + value: (i as Correspondent).id.toString(), } } else if (i.hasOwnProperty('path')) { // Storage Path return { rule_type: FILTER_STORAGE_PATH, - value: (i as PaperlessStoragePath).id.toString(), + value: (i as StoragePath).id.toString(), } } else if (i.hasOwnProperty('is_inbox_tag')) { // Tag return { rule_type: FILTER_HAS_TAGS_ALL, - value: (i as PaperlessTag).id.toString(), + value: (i as Tag).id.toString(), } } else { // Document Type, has no specific props return { rule_type: FILTER_DOCUMENT_TYPE, - value: (i as PaperlessDocumentType).id.toString(), + value: (i as DocumentType).id.toString(), } } }) @@ -916,8 +913,8 @@ export class DocumentDetailComponent } public getCustomFieldFromInstance( - instance: PaperlessCustomFieldInstance - ): PaperlessCustomField { + instance: CustomFieldInstance + ): CustomField { return this.customFields?.find((f) => f.id === instance.field) } @@ -941,7 +938,7 @@ export class DocumentDetailComponent }) } - public addField(field: PaperlessCustomField) { + public addField(field: CustomField) { this.document.custom_fields.push({ field: field.id, value: null, @@ -951,7 +948,7 @@ export class DocumentDetailComponent this.updateFormForCustomFields(true) } - public removeField(fieldInstance: PaperlessCustomFieldInstance) { + public removeField(fieldInstance: CustomFieldInstance) { this.document.custom_fields.splice( this.document.custom_fields.indexOf(fieldInstance), 1 diff --git a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts index 890cd9565..91b714b24 100644 --- a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts +++ b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -1,7 +1,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core' -import { PaperlessTag } from 'src/app/data/paperless-tag' -import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' -import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' +import { Tag } from 'src/app/data/tag' +import { Correspondent } from 'src/app/data/correspondent' +import { DocumentType } from 'src/app/data/document-type' import { TagService } from 'src/app/services/rest/tag.service' import { CorrespondentService } from 'src/app/services/rest/correspondent.service' import { DocumentTypeService } from 'src/app/services/rest/document-type.service' @@ -23,8 +23,8 @@ import { SettingsService } from 'src/app/services/settings.service' import { ToastService } from 'src/app/services/toast.service' import { saveAs } from 'file-saver' import { StoragePathService } from 'src/app/services/rest/storage-path.service' -import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { StoragePath } from 'src/app/data/storage-path' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component' import { PermissionsDialogComponent } from '../../common/permissions-dialog/permissions-dialog.component' import { @@ -44,10 +44,10 @@ export class BulkEditorComponent extends ComponentWithPermissions implements OnInit, OnDestroy { - tags: PaperlessTag[] - correspondents: PaperlessCorrespondent[] - documentTypes: PaperlessDocumentType[] - storagePaths: PaperlessStoragePath[] + tags: Tag[] + correspondents: Correspondent[] + documentTypes: DocumentType[] + storagePaths: StoragePath[] tagSelectionModel = new FilterableDropdownSelectionModel() correspondentSelectionModel = new FilterableDropdownSelectionModel() diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts index deb855449..1aeccd182 100644 --- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts +++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts @@ -5,11 +5,11 @@ import { Output, ViewChild, } from '@angular/core' -import { PaperlessDocument } from 'src/app/data/paperless-document' +import { Document } from 'src/app/data/document' import { DocumentService } from 'src/app/services/rest/document.service' import { SettingsService } from 'src/app/services/settings.service' import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component' @Component({ @@ -36,7 +36,7 @@ export class DocumentCardLargeComponent extends ComponentWithPermissions { } @Input() - document: PaperlessDocument + document: Document @Output() dblClickDocument = new EventEmitter() diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.ts b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.ts index 28db4502e..fbda280a9 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.ts +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.ts @@ -20,7 +20,7 @@ import { DocumentCardSmallComponent } from './document-card-small.component' import { of } from 'rxjs' import { By } from '@angular/platform-browser' import { TagComponent } from '../../common/tag/tag.component' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Tag } from 'src/app/data/tag' import { IsNumberPipe } from 'src/app/pipes/is-number.pipe' import { PreviewPopupComponent } from '../../common/preview-popup/preview-popup.component' @@ -89,10 +89,7 @@ describe('DocumentCardSmallComponent', () => { fixture.debugElement.queryAll(By.directive(TagComponent)) ).toHaveLength(5) component.document.tags = [1, 2] - component.document.tags$ = of([ - { id: 1 } as PaperlessTag, - { id: 2 } as PaperlessTag, - ]) + component.document.tags$ = of([{ id: 1 } as Tag, { id: 2 } as Tag]) fixture.detectChanges() expect( fixture.debugElement.queryAll(By.directive(TagComponent)) diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts index 41ef958fb..bd565a9fb 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts @@ -6,11 +6,11 @@ import { ViewChild, } from '@angular/core' import { map } from 'rxjs/operators' -import { PaperlessDocument } from 'src/app/data/paperless-document' +import { Document } from 'src/app/data/document' import { DocumentService } from 'src/app/services/rest/document.service' import { SettingsService } from 'src/app/services/settings.service' import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component' @Component({ @@ -33,7 +33,7 @@ export class DocumentCardSmallComponent extends ComponentWithPermissions { toggleSelected = new EventEmitter() @Input() - document: PaperlessDocument + document: Document @Output() dblClickDocument = new EventEmitter() diff --git a/src-ui/src/app/components/document-list/document-list.component.spec.ts b/src-ui/src/app/components/document-list/document-list.component.spec.ts index 525ac50b2..db981b588 100644 --- a/src-ui/src/app/components/document-list/document-list.component.spec.ts +++ b/src-ui/src/app/components/document-list/document-list.component.spec.ts @@ -34,7 +34,7 @@ import { import { Subject, of, throwError } from 'rxjs' import { SavedViewService } from 'src/app/services/rest/saved-view.service' import { ActivatedRoute, Router, convertToParamMap } from '@angular/router' -import { PaperlessSavedView } from 'src/app/data/paperless-saved-view' +import { SavedView } from 'src/app/data/saved-view' import { FILTER_FULLTEXT_MORELIKE, FILTER_FULLTEXT_QUERY, @@ -47,7 +47,7 @@ import { DocumentCardSmallComponent } from './document-card-small/document-card- import { DocumentCardLargeComponent } from './document-card-large/document-card-large.component' import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe' import { UsernamePipe } from 'src/app/pipes/username.pipe' -import { PaperlessDocument } from 'src/app/data/paperless-document' +import { Document } from 'src/app/data/document' import { DOCUMENT_SORT_FIELDS, DOCUMENT_SORT_FIELDS_FULLTEXT, @@ -61,10 +61,10 @@ import { CheckComponent } from '../common/input/check/check.component' import { HttpErrorResponse } from '@angular/common/http' import { PermissionsGuard } from 'src/app/guards/permissions.guard' import { SettingsService } from 'src/app/services/settings.service' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { IsNumberPipe } from 'src/app/pipes/is-number.pipe' -const docs: PaperlessDocument[] = [ +const docs: Document[] = [ { id: 1, title: 'Doc1', @@ -222,7 +222,7 @@ describe('DocumentListComponent', () => { }) it('should load saved view from URL', () => { - const view: PaperlessSavedView = { + const view: SavedView = { id: 10, sort_field: 'added', sort_reverse: true, @@ -264,7 +264,7 @@ describe('DocumentListComponent', () => { }) it('should load saved view from query params', () => { - const view: PaperlessSavedView = { + const view: SavedView = { id: 10, sort_field: 'added', sort_reverse: true, @@ -412,7 +412,7 @@ describe('DocumentListComponent', () => { }) it('should support saving an edited view', () => { - const view: PaperlessSavedView = { + const view: SavedView = { id: 10, name: 'Saved View 10', sort_field: 'added', @@ -448,7 +448,7 @@ describe('DocumentListComponent', () => { }) it('should support edited view saving as', () => { - const view: PaperlessSavedView = { + const view: SavedView = { id: 10, name: 'Saved View 10', sort_field: 'added', @@ -494,7 +494,7 @@ describe('DocumentListComponent', () => { }) it('should handle error on edited view saving as', () => { - const view: PaperlessSavedView = { + const view: SavedView = { id: 10, name: 'Saved View 10', sort_field: 'added', diff --git a/src-ui/src/app/components/document-list/document-list.component.ts b/src-ui/src/app/components/document-list/document-list.component.ts index f095695ec..147c0272f 100644 --- a/src-ui/src/app/components/document-list/document-list.component.ts +++ b/src-ui/src/app/components/document-list/document-list.component.ts @@ -15,9 +15,9 @@ import { isFullTextFilterRule, } from 'src/app/utils/filter-rules' import { FILTER_FULLTEXT_MORELIKE } from 'src/app/data/filter-rule-type' -import { PaperlessDocument } from 'src/app/data/paperless-document' -import { PaperlessSavedView } from 'src/app/data/paperless-saved-view' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { Document } from 'src/app/data/document' +import { SavedView } from 'src/app/data/saved-view' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { SortableDirective, SortEvent, @@ -67,7 +67,7 @@ export class DocumentListComponent displayMode = 'smallCards' // largeCards, smallCards, details unmodifiedFilterRules: FilterRule[] = [] - private unmodifiedSavedView: PaperlessSavedView + private unmodifiedSavedView: SavedView private unsubscribeNotifier: Subject = new Subject() @@ -192,7 +192,7 @@ export class DocumentListComponent saveViewConfig() { if (this.list.activeSavedViewId != null) { - let savedView: PaperlessSavedView = { + let savedView: SavedView = { id: this.list.activeSavedViewId, filter_rules: this.list.filterRules, sort_field: this.list.sortField, @@ -229,7 +229,7 @@ export class DocumentListComponent modal.componentInstance.defaultName = this.filterEditor.generateFilterName() modal.componentInstance.saveClicked.pipe(first()).subscribe((formValue) => { modal.componentInstance.buttonsEnabled = false - let savedView: PaperlessSavedView = { + let savedView: SavedView = { name: formValue.name, show_on_dashboard: formValue.showOnDashboard, show_in_sidebar: formValue.showInSideBar, @@ -260,11 +260,11 @@ export class DocumentListComponent }) } - openDocumentDetail(document: PaperlessDocument) { + openDocumentDetail(document: Document) { this.router.navigate(['documents', document.id]) } - toggleSelected(document: PaperlessDocument, event: MouseEvent): void { + toggleSelected(document: Document, event: MouseEvent): void { if (!event.shiftKey) this.list.toggleSelected(document) else this.list.selectRangeTo(document) } @@ -295,7 +295,7 @@ export class DocumentListComponent ]) } - trackByDocumentId(index, item: PaperlessDocument) { + trackByDocumentId(index, item: Document) { return item.id } diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts index 4fe6e75fd..1332eaa5b 100644 --- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts +++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts @@ -49,11 +49,11 @@ import { FILTER_CUSTOM_FIELDS, FILTER_SHARED_BY_USER, } from 'src/app/data/filter-rule-type' -import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' -import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' -import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path' -import { PaperlessTag } from 'src/app/data/paperless-tag' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { Correspondent } from 'src/app/data/correspondent' +import { DocumentType } from 'src/app/data/document-type' +import { StoragePath } from 'src/app/data/storage-path' +import { Tag } from 'src/app/data/tag' +import { User } from 'src/app/data/user' import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive' import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe' import { FilterPipe } from 'src/app/pipes/filter.pipe' @@ -78,7 +78,7 @@ import { } from '../../common/permissions-filter-dropdown/permissions-filter-dropdown.component' import { FilterEditorComponent } from './filter-editor.component' -const tags: PaperlessTag[] = [ +const tags: Tag[] = [ { id: 2, name: 'Tag2', @@ -89,7 +89,7 @@ const tags: PaperlessTag[] = [ }, ] -const correspondents: PaperlessCorrespondent[] = [ +const correspondents: Correspondent[] = [ { id: 12, name: 'Corresp12', @@ -100,7 +100,7 @@ const correspondents: PaperlessCorrespondent[] = [ }, ] -const document_types: PaperlessDocumentType[] = [ +const document_types: DocumentType[] = [ { id: 22, name: 'DocType22', @@ -111,7 +111,7 @@ const document_types: PaperlessDocumentType[] = [ }, ] -const storage_paths: PaperlessStoragePath[] = [ +const storage_paths: StoragePath[] = [ { id: 32, name: 'StoragePath32', @@ -122,7 +122,7 @@ const storage_paths: PaperlessStoragePath[] = [ }, ] -const users: PaperlessUser[] = [ +const users: User[] = [ { id: 1, username: 'user1', diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts index 8e0f7c27a..03e1db539 100644 --- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts +++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts @@ -8,9 +8,9 @@ import { ViewChild, ElementRef, } from '@angular/core' -import { PaperlessTag } from 'src/app/data/paperless-tag' -import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' -import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' +import { Tag } from 'src/app/data/tag' +import { Correspondent } from 'src/app/data/correspondent' +import { DocumentType } from 'src/app/data/document-type' import { Subject, Subscription } from 'rxjs' import { debounceTime, distinctUntilChanged, filter } from 'rxjs/operators' import { DocumentTypeService } from 'src/app/services/rest/document-type.service' @@ -62,8 +62,8 @@ import { SelectionData, SelectionDataItem, } from 'src/app/services/rest/document.service' -import { PaperlessDocument } from 'src/app/data/paperless-document' -import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path' +import { Document } from 'src/app/data/document' +import { StoragePath } from 'src/app/data/storage-path' import { StoragePathService } from 'src/app/services/rest/storage-path.service' import { RelativeDate } from '../../common/date-dropdown/date-dropdown.component' import { @@ -230,10 +230,10 @@ export class FilterEditorComponent implements OnInit, OnDestroy { @ViewChild('textFilterInput') textFilterInput: ElementRef - tags: PaperlessTag[] = [] - correspondents: PaperlessCorrespondent[] = [] - documentTypes: PaperlessDocumentType[] = [] - storagePaths: PaperlessStoragePath[] = [] + tags: Tag[] = [] + correspondents: Correspondent[] = [] + documentTypes: DocumentType[] = [] + storagePaths: StoragePath[] = [] tagDocumentCounts: SelectionDataItem[] correspondentDocumentCounts: SelectionDataItem[] @@ -242,7 +242,7 @@ export class FilterEditorComponent implements OnInit, OnDestroy { _textFilter = '' _moreLikeId: number - _moreLikeDoc: PaperlessDocument + _moreLikeDoc: Document get textFilterTargets() { if (this.textFilterTarget == TEXT_FILTER_TARGET_FULLTEXT_MORELIKE) { diff --git a/src-ui/src/app/components/document-notes/document-notes.component.spec.ts b/src-ui/src/app/components/document-notes/document-notes.component.spec.ts index dbe3933be..f303f23e8 100644 --- a/src-ui/src/app/components/document-notes/document-notes.component.spec.ts +++ b/src-ui/src/app/components/document-notes/document-notes.component.spec.ts @@ -5,7 +5,7 @@ import { UserService } from 'src/app/services/rest/user.service' import { of, throwError } from 'rxjs' import { DocumentNotesService } from 'src/app/services/rest/document-notes.service' import { ToastService } from 'src/app/services/toast.service' -import { PaperlessDocumentNote } from 'src/app/data/paperless-document-note' +import { DocumentNote } from 'src/app/data/document-note' import { HttpClientTestingModule } from '@angular/common/http/testing' import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe' import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive' @@ -14,7 +14,7 @@ import { By } from '@angular/platform-browser' import { PermissionsService } from 'src/app/services/permissions.service' import { FormsModule, ReactiveFormsModule } from '@angular/forms' -const notes: PaperlessDocumentNote[] = [ +const notes: DocumentNote[] = [ { id: 23, note: 'Note 23', diff --git a/src-ui/src/app/components/document-notes/document-notes.component.ts b/src-ui/src/app/components/document-notes/document-notes.component.ts index 4e45ad271..45e1469d8 100644 --- a/src-ui/src/app/components/document-notes/document-notes.component.ts +++ b/src-ui/src/app/components/document-notes/document-notes.component.ts @@ -1,11 +1,11 @@ import { Component, Input, Output, EventEmitter } from '@angular/core' import { DocumentNotesService } from 'src/app/services/rest/document-notes.service' -import { PaperlessDocumentNote } from 'src/app/data/paperless-document-note' +import { DocumentNote } from 'src/app/data/document-note' import { FormControl, FormGroup } from '@angular/forms' import { ToastService } from 'src/app/services/toast.service' import { ComponentWithPermissions } from '../with-permissions/with-permissions.component' import { UserService } from 'src/app/services/rest/user.service' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { User } from 'src/app/data/user' @Component({ selector: 'pngx-document-notes', @@ -24,14 +24,14 @@ export class DocumentNotesComponent extends ComponentWithPermissions { documentId: number @Input() - notes: PaperlessDocumentNote[] = [] + notes: DocumentNote[] = [] @Input() addDisabled: boolean = false @Output() - updated: EventEmitter = new EventEmitter() - users: PaperlessUser[] + updated: EventEmitter = new EventEmitter() + users: User[] constructor( private notesService: DocumentNotesService, @@ -82,7 +82,7 @@ export class DocumentNotesComponent extends ComponentWithPermissions { }) } - displayName(note: PaperlessDocumentNote): string { + displayName(note: DocumentNote): string { if (!note.user) return '' const user = this.users?.find((u) => u.id === note.user) if (!user) return '' diff --git a/src-ui/src/app/components/manage/consumption-templates/consumption-templates.component.spec.ts b/src-ui/src/app/components/manage/consumption-templates/consumption-templates.component.spec.ts index 7cf49c28f..2cb365576 100644 --- a/src-ui/src/app/components/manage/consumption-templates/consumption-templates.component.spec.ts +++ b/src-ui/src/app/components/manage/consumption-templates/consumption-templates.component.spec.ts @@ -11,8 +11,8 @@ import { import { of, throwError } from 'rxjs' import { DocumentSource, - PaperlessConsumptionTemplate, -} from 'src/app/data/paperless-consumption-template' + ConsumptionTemplate, +} from 'src/app/data/consumption-template' import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive' import { ConsumptionTemplateService } from 'src/app/services/rest/consumption-template.service' import { ToastService } from 'src/app/services/toast.service' @@ -22,7 +22,7 @@ import { ConsumptionTemplatesComponent } from './consumption-templates.component import { ConsumptionTemplateEditDialogComponent } from '../../common/edit-dialog/consumption-template-edit-dialog/consumption-template-edit-dialog.component' import { PermissionsService } from 'src/app/services/permissions.service' -const templates: PaperlessConsumptionTemplate[] = [ +const templates: ConsumptionTemplate[] = [ { id: 0, name: 'Template 1', diff --git a/src-ui/src/app/components/manage/consumption-templates/consumption-templates.component.ts b/src-ui/src/app/components/manage/consumption-templates/consumption-templates.component.ts index 5274dc20c..301699abd 100644 --- a/src-ui/src/app/components/manage/consumption-templates/consumption-templates.component.ts +++ b/src-ui/src/app/components/manage/consumption-templates/consumption-templates.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core' import { ConsumptionTemplateService } from 'src/app/services/rest/consumption-template.service' import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component' import { Subject, takeUntil } from 'rxjs' -import { PaperlessConsumptionTemplate } from 'src/app/data/paperless-consumption-template' +import { ConsumptionTemplate } from 'src/app/data/consumption-template' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { ToastService } from 'src/app/services/toast.service' import { PermissionsService } from 'src/app/services/permissions.service' @@ -22,7 +22,7 @@ export class ConsumptionTemplatesComponent extends ComponentWithPermissions implements OnInit { - public templates: PaperlessConsumptionTemplate[] = [] + public templates: ConsumptionTemplate[] = [] private unsubscribeNotifier: Subject = new Subject() @@ -48,13 +48,13 @@ export class ConsumptionTemplatesComponent }) } - getSourceList(template: PaperlessConsumptionTemplate): string { + getSourceList(template: ConsumptionTemplate): string { return template.sources .map((id) => DOCUMENT_SOURCE_OPTIONS.find((s) => s.id === id).name) .join(', ') } - editTemplate(rule: PaperlessConsumptionTemplate) { + editTemplate(rule: ConsumptionTemplate) { const modal = this.modalService.open( ConsumptionTemplateEditDialogComponent, { @@ -82,7 +82,7 @@ export class ConsumptionTemplatesComponent }) } - deleteTemplate(rule: PaperlessConsumptionTemplate) { + deleteTemplate(rule: ConsumptionTemplate) { const modal = this.modalService.open(ConfirmDialogComponent, { backdrop: 'static', }) diff --git a/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.ts b/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.ts index c0ed578a1..2d02ba983 100644 --- a/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.ts +++ b/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { FILTER_HAS_CORRESPONDENT_ANY } from 'src/app/data/filter-rule-type' -import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' +import { Correspondent } from 'src/app/data/correspondent' import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe' import { DocumentListViewService } from 'src/app/services/document-list-view.service' import { @@ -19,7 +19,7 @@ import { ManagementListComponent } from '../management-list/management-list.comp styleUrls: ['./../management-list/management-list.component.scss'], providers: [{ provide: CustomDatePipe }], }) -export class CorrespondentListComponent extends ManagementListComponent { +export class CorrespondentListComponent extends ManagementListComponent { constructor( correspondentsService: CorrespondentService, modalService: NgbModal, @@ -43,7 +43,7 @@ export class CorrespondentListComponent extends ManagementListComponent { + valueFn: (c: Correspondent) => { if (c.last_correspondence) { let date = new Date(c.last_correspondence) if (date.toString() == 'Invalid Date') { @@ -63,7 +63,7 @@ export class CorrespondentListComponent extends ManagementListComponent = new Subject() constructor( @@ -47,7 +44,7 @@ export class CustomFieldsComponent }) } - editField(field: PaperlessCustomField) { + editField(field: CustomField) { const modal = this.modalService.open(CustomFieldEditDialogComponent) modal.componentInstance.dialogMode = field ? EditDialogMode.EDIT @@ -67,7 +64,7 @@ export class CustomFieldsComponent }) } - deleteField(field: PaperlessCustomField) { + deleteField(field: CustomField) { const modal = this.modalService.open(ConfirmDialogComponent, { backdrop: 'static', }) @@ -92,7 +89,7 @@ export class CustomFieldsComponent }) } - getDataType(field: PaperlessCustomField): string { + getDataType(field: CustomField): string { return DATA_TYPE_LABELS.find((l) => l.id === field.data_type).name } } diff --git a/src-ui/src/app/components/manage/document-type-list/document-type-list.component.ts b/src-ui/src/app/components/manage/document-type-list/document-type-list.component.ts index 925e17b2b..8a4804144 100644 --- a/src-ui/src/app/components/manage/document-type-list/document-type-list.component.ts +++ b/src-ui/src/app/components/manage/document-type-list/document-type-list.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { FILTER_HAS_DOCUMENT_TYPE_ANY } from 'src/app/data/filter-rule-type' -import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' +import { DocumentType } from 'src/app/data/document-type' import { DocumentListViewService } from 'src/app/services/document-list-view.service' import { PermissionsService, @@ -17,7 +17,7 @@ import { ManagementListComponent } from '../management-list/management-list.comp templateUrl: './../management-list/management-list.component.html', styleUrls: ['./../management-list/management-list.component.scss'], }) -export class DocumentTypeListComponent extends ManagementListComponent { +export class DocumentTypeListComponent extends ManagementListComponent { constructor( documentTypeService: DocumentTypeService, modalService: NgbModal, @@ -40,7 +40,7 @@ export class DocumentTypeListComponent extends ManagementListComponent { of({ all: mailAccounts.map((a) => a.id), count: mailAccounts.length, - results: (mailAccounts as PaperlessMailAccount[]).concat([]), + results: (mailAccounts as MailAccount[]).concat([]), }) ) } @@ -127,7 +127,7 @@ describe('MailComponent', () => { of({ all: mailRules.map((r) => r.id), count: mailRules.length, - results: (mailRules as PaperlessMailRule[]).concat([]), + results: (mailRules as MailRule[]).concat([]), }) ) } @@ -163,7 +163,7 @@ describe('MailComponent', () => { completeSetup() let modal: NgbModalRef modalService.activeInstances.subscribe((refs) => (modal = refs[0])) - component.editMailAccount(mailAccounts[0] as PaperlessMailAccount) + component.editMailAccount(mailAccounts[0] as MailAccount) let editDialog = modal.componentInstance as MailAccountEditDialogComponent const toastErrorSpy = jest.spyOn(toastService, 'showError') const toastInfoSpy = jest.spyOn(toastService, 'showInfo') @@ -181,7 +181,7 @@ describe('MailComponent', () => { completeSetup() let modal: NgbModalRef modalService.activeInstances.subscribe((refs) => (modal = refs[0])) - component.deleteMailAccount(mailAccounts[0] as PaperlessMailAccount) + component.deleteMailAccount(mailAccounts[0] as MailAccount) const deleteDialog = modal.componentInstance as ConfirmDialogComponent const deleteSpy = jest.spyOn(mailAccountService, 'delete') const toastErrorSpy = jest.spyOn(toastService, 'showError') @@ -202,7 +202,7 @@ describe('MailComponent', () => { completeSetup() let modal: NgbModalRef modalService.activeInstances.subscribe((refs) => (modal = refs[0])) - component.editMailRule(mailRules[0] as PaperlessMailRule) + component.editMailRule(mailRules[0] as MailRule) const editDialog = modal.componentInstance as MailRuleEditDialogComponent const toastErrorSpy = jest.spyOn(toastService, 'showError') const toastInfoSpy = jest.spyOn(toastService, 'showInfo') @@ -220,7 +220,7 @@ describe('MailComponent', () => { completeSetup() let modal: NgbModalRef modalService.activeInstances.subscribe((refs) => (modal = refs[0])) - component.deleteMailRule(mailRules[0] as PaperlessMailRule) + component.deleteMailRule(mailRules[0] as MailRule) const deleteDialog = modal.componentInstance as ConfirmDialogComponent const deleteSpy = jest.spyOn(mailRuleService, 'delete') const toastErrorSpy = jest.spyOn(toastService, 'showError') @@ -257,7 +257,7 @@ describe('MailComponent', () => { const toastErrorSpy = jest.spyOn(toastService, 'showError') const toastInfoSpy = jest.spyOn(toastService, 'showInfo') const rulePatchSpy = jest.spyOn(mailRuleService, 'patch') - component.editPermissions(mailRules[0] as PaperlessMailRule) + component.editPermissions(mailRules[0] as MailRule) expect(modal).not.toBeUndefined() let dialog = modal.componentInstance as PermissionsDialogComponent expect(dialog.object).toEqual(mailRules[0]) @@ -268,7 +268,7 @@ describe('MailComponent', () => { dialog.confirmClicked.emit(perms) expect(rulePatchSpy).toHaveBeenCalled() expect(toastErrorSpy).toHaveBeenCalled() - rulePatchSpy.mockReturnValueOnce(of(mailRules[0] as PaperlessMailRule)) + rulePatchSpy.mockReturnValueOnce(of(mailRules[0] as MailRule)) dialog.confirmClicked.emit(perms) expect(toastInfoSpy).toHaveBeenCalledWith('Permissions updated') @@ -293,7 +293,7 @@ describe('MailComponent', () => { let modal: NgbModalRef modalService.activeInstances.subscribe((refs) => (modal = refs[0])) const accountPatchSpy = jest.spyOn(mailAccountService, 'patch') - component.editPermissions(mailAccounts[0] as PaperlessMailAccount) + component.editPermissions(mailAccounts[0] as MailAccount) expect(modal).not.toBeUndefined() let dialog = modal.componentInstance as PermissionsDialogComponent expect(dialog.object).toEqual(mailAccounts[0]) diff --git a/src-ui/src/app/components/manage/mail/mail.component.ts b/src-ui/src/app/components/manage/mail/mail.component.ts index 6143ad3c8..9bb33c03b 100644 --- a/src-ui/src/app/components/manage/mail/mail.component.ts +++ b/src-ui/src/app/components/manage/mail/mail.component.ts @@ -2,8 +2,8 @@ import { Component, OnInit, OnDestroy } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { Subject, first, takeUntil } from 'rxjs' import { ObjectWithPermissions } from 'src/app/data/object-with-permissions' -import { PaperlessMailAccount } from 'src/app/data/paperless-mail-account' -import { PaperlessMailRule } from 'src/app/data/paperless-mail-rule' +import { MailAccount } from 'src/app/data/mail-account' +import { MailRule } from 'src/app/data/mail-rule' import { PermissionsService, PermissionAction, @@ -28,8 +28,8 @@ export class MailComponent extends ComponentWithPermissions implements OnInit, OnDestroy { - mailAccounts: PaperlessMailAccount[] = [] - mailRules: PaperlessMailRule[] = [] + mailAccounts: MailAccount[] = [] + mailRules: MailRule[] = [] unsubscribeNotifier: Subject = new Subject() @@ -76,7 +76,7 @@ export class MailComponent this.unsubscribeNotifier.next(true) } - editMailAccount(account: PaperlessMailAccount = null) { + editMailAccount(account: MailAccount = null) { const modal = this.modalService.open(MailAccountEditDialogComponent, { backdrop: 'static', size: 'xl', @@ -105,7 +105,7 @@ export class MailComponent }) } - deleteMailAccount(account: PaperlessMailAccount) { + deleteMailAccount(account: MailAccount) { const modal = this.modalService.open(ConfirmDialogComponent, { backdrop: 'static', }) @@ -137,7 +137,7 @@ export class MailComponent }) } - editMailRule(rule: PaperlessMailRule = null) { + editMailRule(rule: MailRule = null) { const modal = this.modalService.open(MailRuleEditDialogComponent, { backdrop: 'static', size: 'xl', @@ -164,7 +164,7 @@ export class MailComponent }) } - deleteMailRule(rule: PaperlessMailRule) { + deleteMailRule(rule: MailRule) { const modal = this.modalService.open(ConfirmDialogComponent, { backdrop: 'static', }) @@ -193,7 +193,7 @@ export class MailComponent }) } - editPermissions(object: PaperlessMailRule | PaperlessMailAccount) { + editPermissions(object: MailRule | MailAccount) { const modal = this.modalService.open(PermissionsDialogComponent, { backdrop: 'static', }) @@ -202,9 +202,8 @@ export class MailComponent dialog.object = object modal.componentInstance.confirmClicked.subscribe((permissions) => { modal.componentInstance.buttonsEnabled = false - const service: AbstractPaperlessService< - PaperlessMailRule | PaperlessMailAccount - > = 'account' in object ? this.mailRuleService : this.mailAccountService + const service: AbstractPaperlessService = + 'account' in object ? this.mailRuleService : this.mailAccountService object.owner = permissions['owner'] object['set_permissions'] = permissions['set_permissions'] service.patch(object).subscribe({ diff --git a/src-ui/src/app/components/manage/management-list/management-list.component.spec.ts b/src-ui/src/app/components/manage/management-list/management-list.component.spec.ts index 03b63348d..c34872343 100644 --- a/src-ui/src/app/components/manage/management-list/management-list.component.spec.ts +++ b/src-ui/src/app/components/manage/management-list/management-list.component.spec.ts @@ -15,7 +15,7 @@ import { NgbPaginationModule, } from '@ng-bootstrap/ng-bootstrap' import { of, throwError } from 'rxjs' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Tag } from 'src/app/data/tag' import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive' import { SortableDirective } from 'src/app/directives/sortable.directive' import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe' @@ -37,7 +37,7 @@ import { MATCH_NONE } from 'src/app/data/matching-model' import { MATCH_LITERAL } from 'src/app/data/matching-model' import { PermissionsDialogComponent } from '../../common/permissions-dialog/permissions-dialog.component' -const tags: PaperlessTag[] = [ +const tags: Tag[] = [ { id: 1, name: 'Tag1 Foo', @@ -57,8 +57,8 @@ const tags: PaperlessTag[] = [ ] describe('ManagementListComponent', () => { - let component: ManagementListComponent - let fixture: ComponentFixture> + let component: ManagementListComponent + let fixture: ComponentFixture> let tagService: TagService let modalService: NgbModal let toastService: ToastService @@ -151,8 +151,7 @@ describe('ManagementListComponent', () => { createButton.triggerEventHandler('click') expect(modal).not.toBeUndefined() - const editDialog = - modal.componentInstance as EditDialogComponent + const editDialog = modal.componentInstance as EditDialogComponent // fail first editDialog.failed.emit({ error: 'error creating item' }) @@ -176,8 +175,7 @@ describe('ManagementListComponent', () => { editButton.triggerEventHandler('click') expect(modal).not.toBeUndefined() - const editDialog = - modal.componentInstance as EditDialogComponent + const editDialog = modal.componentInstance as EditDialogComponent expect(editDialog.object).toEqual(tags[0]) // fail first diff --git a/src-ui/src/app/components/manage/storage-path-list/storage-path-list.component.ts b/src-ui/src/app/components/manage/storage-path-list/storage-path-list.component.ts index 1a51c53a6..d227f01a5 100644 --- a/src-ui/src/app/components/manage/storage-path-list/storage-path-list.component.ts +++ b/src-ui/src/app/components/manage/storage-path-list/storage-path-list.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { FILTER_HAS_STORAGE_PATH_ANY } from 'src/app/data/filter-rule-type' -import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path' +import { StoragePath } from 'src/app/data/storage-path' import { DocumentListViewService } from 'src/app/services/document-list-view.service' import { PermissionsService, @@ -17,7 +17,7 @@ import { ManagementListComponent } from '../management-list/management-list.comp templateUrl: './../management-list/management-list.component.html', styleUrls: ['./../management-list/management-list.component.scss'], }) -export class StoragePathListComponent extends ManagementListComponent { +export class StoragePathListComponent extends ManagementListComponent { constructor( directoryService: StoragePathService, modalService: NgbModal, @@ -40,7 +40,7 @@ export class StoragePathListComponent extends ManagementListComponent { + valueFn: (c: StoragePath) => { return c.path }, }, @@ -48,7 +48,7 @@ export class StoragePathListComponent extends ManagementListComponent { +export class TagListComponent extends ManagementListComponent { constructor( tagService: TagService, modalService: NgbModal, @@ -41,7 +41,7 @@ export class TagListComponent extends ManagementListComponent { key: 'color', name: $localize`Color`, rendersHtml: true, - valueFn: (t: PaperlessTag) => { + valueFn: (t: Tag) => { return `${t.color}` }, }, @@ -49,7 +49,7 @@ export class TagListComponent extends ManagementListComponent { ) } - getDeleteMessage(object: PaperlessTag) { + getDeleteMessage(object: Tag) { return $localize`Do you really want to delete the tag "${object.name}"?` } } diff --git a/src-ui/src/app/data/consumption-template.ts b/src-ui/src/app/data/consumption-template.ts new file mode 100644 index 000000000..cc85712c8 --- /dev/null +++ b/src-ui/src/app/data/consumption-template.ts @@ -0,0 +1,43 @@ +import { ObjectWithId } from './object-with-id' + +export enum DocumentSource { + ConsumeFolder = 1, + ApiUpload = 2, + MailFetch = 3, +} + +export interface ConsumptionTemplate extends ObjectWithId { + name: string + + order: number + + sources: DocumentSource[] + + filter_filename: string + + filter_path?: string + + filter_mailrule?: number // MailRule.id + + assign_title?: string + + assign_tags?: number[] // Tag.id + + assign_document_type?: number // DocumentType.id + + assign_correspondent?: number // Correspondent.id + + assign_storage_path?: number // StoragePath.id + + assign_owner?: number // User.id + + assign_view_users?: number[] // [User.id] + + assign_view_groups?: number[] // [Group.id] + + assign_change_users?: number[] // [User.id] + + assign_change_groups?: number[] // [Group.id] + + assign_custom_fields?: number[] // [CustomField.id] +} diff --git a/src-ui/src/app/data/paperless-correspondent.ts b/src-ui/src/app/data/correspondent.ts similarity index 58% rename from src-ui/src/app/data/paperless-correspondent.ts rename to src-ui/src/app/data/correspondent.ts index 89aa6a694..4202297fd 100644 --- a/src-ui/src/app/data/paperless-correspondent.ts +++ b/src-ui/src/app/data/correspondent.ts @@ -1,5 +1,5 @@ import { MatchingModel } from './matching-model' -export interface PaperlessCorrespondent extends MatchingModel { +export interface Correspondent extends MatchingModel { last_correspondence?: string // Date } diff --git a/src-ui/src/app/data/custom-field-instance.ts b/src-ui/src/app/data/custom-field-instance.ts new file mode 100644 index 000000000..475326d85 --- /dev/null +++ b/src-ui/src/app/data/custom-field-instance.ts @@ -0,0 +1,8 @@ +import { ObjectWithId } from './object-with-id' + +export interface CustomFieldInstance extends ObjectWithId { + document: number // Document + field: number // CustomField + created: Date + value?: any +} diff --git a/src-ui/src/app/data/paperless-custom-field.ts b/src-ui/src/app/data/custom-field.ts similarity index 54% rename from src-ui/src/app/data/paperless-custom-field.ts rename to src-ui/src/app/data/custom-field.ts index 93bd34e33..e858f06be 100644 --- a/src-ui/src/app/data/paperless-custom-field.ts +++ b/src-ui/src/app/data/custom-field.ts @@ -1,6 +1,6 @@ import { ObjectWithId } from './object-with-id' -export enum PaperlessCustomFieldDataType { +export enum CustomFieldDataType { String = 'string', Url = 'url', Date = 'date', @@ -13,41 +13,41 @@ export enum PaperlessCustomFieldDataType { export const DATA_TYPE_LABELS = [ { - id: PaperlessCustomFieldDataType.Boolean, + id: CustomFieldDataType.Boolean, name: $localize`Boolean`, }, { - id: PaperlessCustomFieldDataType.Date, + id: CustomFieldDataType.Date, name: $localize`Date`, }, { - id: PaperlessCustomFieldDataType.Integer, + id: CustomFieldDataType.Integer, name: $localize`Integer`, }, { - id: PaperlessCustomFieldDataType.Float, + id: CustomFieldDataType.Float, name: $localize`Number`, }, { - id: PaperlessCustomFieldDataType.Monetary, + id: CustomFieldDataType.Monetary, name: $localize`Monetary`, }, { - id: PaperlessCustomFieldDataType.String, + id: CustomFieldDataType.String, name: $localize`Text`, }, { - id: PaperlessCustomFieldDataType.Url, + id: CustomFieldDataType.Url, name: $localize`Url`, }, { - id: PaperlessCustomFieldDataType.DocumentLink, + id: CustomFieldDataType.DocumentLink, name: $localize`Document Link`, }, ] -export interface PaperlessCustomField extends ObjectWithId { - data_type: PaperlessCustomFieldDataType +export interface CustomField extends ObjectWithId { + data_type: CustomFieldDataType name: string created?: Date } diff --git a/src-ui/src/app/data/paperless-document-metadata.ts b/src-ui/src/app/data/document-metadata.ts similarity index 81% rename from src-ui/src/app/data/paperless-document-metadata.ts rename to src-ui/src/app/data/document-metadata.ts index b8c030ee8..ea353e2ac 100644 --- a/src-ui/src/app/data/paperless-document-metadata.ts +++ b/src-ui/src/app/data/document-metadata.ts @@ -1,4 +1,4 @@ -export interface PaperlessDocumentMetadata { +export interface DocumentMetadata { original_checksum?: string archived_checksum?: string diff --git a/src-ui/src/app/data/document-note.ts b/src-ui/src/app/data/document-note.ts new file mode 100644 index 000000000..bc33df60c --- /dev/null +++ b/src-ui/src/app/data/document-note.ts @@ -0,0 +1,7 @@ +import { ObjectWithId } from './object-with-id' + +export interface DocumentNote extends ObjectWithId { + created?: Date + note?: string + user?: number // User +} diff --git a/src-ui/src/app/data/paperless-document-suggestions.ts b/src-ui/src/app/data/document-suggestions.ts similarity index 78% rename from src-ui/src/app/data/paperless-document-suggestions.ts rename to src-ui/src/app/data/document-suggestions.ts index 295a1ab0e..85f9f9d22 100644 --- a/src-ui/src/app/data/paperless-document-suggestions.ts +++ b/src-ui/src/app/data/document-suggestions.ts @@ -1,4 +1,4 @@ -export interface PaperlessDocumentSuggestions { +export interface DocumentSuggestions { tags?: number[] correspondents?: number[] diff --git a/src-ui/src/app/data/document-type.ts b/src-ui/src/app/data/document-type.ts new file mode 100644 index 000000000..56b5ea8f7 --- /dev/null +++ b/src-ui/src/app/data/document-type.ts @@ -0,0 +1,3 @@ +import { MatchingModel } from './matching-model' + +export interface DocumentType extends MatchingModel {} diff --git a/src-ui/src/app/data/document.ts b/src-ui/src/app/data/document.ts new file mode 100644 index 000000000..2bdb954ce --- /dev/null +++ b/src-ui/src/app/data/document.ts @@ -0,0 +1,66 @@ +import { Correspondent } from './correspondent' +import { Tag } from './tag' +import { DocumentType } from './document-type' +import { Observable } from 'rxjs' +import { StoragePath } from './storage-path' +import { ObjectWithPermissions } from './object-with-permissions' +import { DocumentNote } from './document-note' +import { CustomFieldInstance } from './custom-field-instance' + +export interface SearchHit { + score?: number + rank?: number + + highlights?: string + note_highlights?: string +} + +export interface Document extends ObjectWithPermissions { + correspondent$?: Observable + + correspondent?: number + + document_type$?: Observable + + document_type?: number + + storage_path$?: Observable + + storage_path?: number + + title?: string + + content?: string + + tags$?: Observable + + tags?: number[] + + checksum?: string + + // UTC + created?: Date + + // localized date + created_date?: Date + + modified?: Date + + added?: Date + + original_file_name?: string + + archived_file_name?: string + + download_url?: string + + thumbnail_url?: string + + archive_serial_number?: number + + notes?: DocumentNote[] + + __search_hit__?: SearchHit + + custom_fields?: CustomFieldInstance[] +} diff --git a/src-ui/src/app/data/paperless-group.ts b/src-ui/src/app/data/group.ts similarity index 71% rename from src-ui/src/app/data/paperless-group.ts rename to src-ui/src/app/data/group.ts index b78efeb5a..38752b676 100644 --- a/src-ui/src/app/data/paperless-group.ts +++ b/src-ui/src/app/data/group.ts @@ -1,6 +1,6 @@ import { ObjectWithId } from './object-with-id' -export interface PaperlessGroup extends ObjectWithId { +export interface Group extends ObjectWithId { name?: string user_count?: number // not implemented yet diff --git a/src-ui/src/app/data/paperless-mail-account.ts b/src-ui/src/app/data/mail-account.ts similarity index 81% rename from src-ui/src/app/data/paperless-mail-account.ts rename to src-ui/src/app/data/mail-account.ts index 5be0c3e20..5ab8ba3b5 100644 --- a/src-ui/src/app/data/paperless-mail-account.ts +++ b/src-ui/src/app/data/mail-account.ts @@ -6,7 +6,7 @@ export enum IMAPSecurity { STARTTLS = 3, } -export interface PaperlessMailAccount extends ObjectWithPermissions { +export interface MailAccount extends ObjectWithPermissions { name: string imap_server: string diff --git a/src-ui/src/app/data/paperless-mail-rule.ts b/src-ui/src/app/data/mail-rule.ts similarity index 94% rename from src-ui/src/app/data/paperless-mail-rule.ts rename to src-ui/src/app/data/mail-rule.ts index f87ef55fa..2611fa3ba 100644 --- a/src-ui/src/app/data/paperless-mail-rule.ts +++ b/src-ui/src/app/data/mail-rule.ts @@ -32,7 +32,7 @@ export enum MailMetadataCorrespondentOption { FromCustom = 4, } -export interface PaperlessMailRule extends ObjectWithPermissions { +export interface MailRule extends ObjectWithPermissions { name: string account: number // PaperlessMailAccount.id diff --git a/src-ui/src/app/data/paperless-consumption-template.ts b/src-ui/src/app/data/paperless-consumption-template.ts deleted file mode 100644 index 94e6202c1..000000000 --- a/src-ui/src/app/data/paperless-consumption-template.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { ObjectWithId } from './object-with-id' - -export enum DocumentSource { - ConsumeFolder = 1, - ApiUpload = 2, - MailFetch = 3, -} - -export interface PaperlessConsumptionTemplate extends ObjectWithId { - name: string - - order: number - - sources: DocumentSource[] - - filter_filename: string - - filter_path?: string - - filter_mailrule?: number // PaperlessMailRule.id - - assign_title?: string - - assign_tags?: number[] // PaperlessTag.id - - assign_document_type?: number // PaperlessDocumentType.id - - assign_correspondent?: number // PaperlessCorrespondent.id - - assign_storage_path?: number // PaperlessStoragePath.id - - assign_owner?: number // PaperlessUser.id - - assign_view_users?: number[] // [PaperlessUser.id] - - assign_view_groups?: number[] // [PaperlessGroup.id] - - assign_change_users?: number[] // [PaperlessUser.id] - - assign_change_groups?: number[] // [PaperlessGroup.id] - - assign_custom_fields?: number[] // [PaperlessCustomField.id] -} diff --git a/src-ui/src/app/data/paperless-custom-field-instance.ts b/src-ui/src/app/data/paperless-custom-field-instance.ts deleted file mode 100644 index 600e523c8..000000000 --- a/src-ui/src/app/data/paperless-custom-field-instance.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ObjectWithId } from './object-with-id' -import { PaperlessCustomField } from './paperless-custom-field' - -export interface PaperlessCustomFieldInstance extends ObjectWithId { - document: number // PaperlessDocument - field: number // PaperlessCustomField - created: Date - value?: any -} diff --git a/src-ui/src/app/data/paperless-document-note.ts b/src-ui/src/app/data/paperless-document-note.ts deleted file mode 100644 index 569b49448..000000000 --- a/src-ui/src/app/data/paperless-document-note.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ObjectWithId } from './object-with-id' - -export interface PaperlessDocumentNote extends ObjectWithId { - created?: Date - note?: string - user?: number // PaperlessUser -} diff --git a/src-ui/src/app/data/paperless-document-type.ts b/src-ui/src/app/data/paperless-document-type.ts deleted file mode 100644 index 1aec65bc7..000000000 --- a/src-ui/src/app/data/paperless-document-type.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { MatchingModel } from './matching-model' - -export interface PaperlessDocumentType extends MatchingModel {} diff --git a/src-ui/src/app/data/paperless-document.ts b/src-ui/src/app/data/paperless-document.ts deleted file mode 100644 index 8071e2b45..000000000 --- a/src-ui/src/app/data/paperless-document.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { PaperlessCorrespondent } from './paperless-correspondent' -import { PaperlessTag } from './paperless-tag' -import { PaperlessDocumentType } from './paperless-document-type' -import { Observable } from 'rxjs' -import { PaperlessStoragePath } from './paperless-storage-path' -import { ObjectWithPermissions } from './object-with-permissions' -import { PaperlessDocumentNote } from './paperless-document-note' -import { PaperlessCustomFieldInstance } from './paperless-custom-field-instance' - -export interface SearchHit { - score?: number - rank?: number - - highlights?: string - note_highlights?: string -} - -export interface PaperlessDocument extends ObjectWithPermissions { - correspondent$?: Observable - - correspondent?: number - - document_type$?: Observable - - document_type?: number - - storage_path$?: Observable - - storage_path?: number - - title?: string - - content?: string - - tags$?: Observable - - tags?: number[] - - checksum?: string - - // UTC - created?: Date - - // localized date - created_date?: Date - - modified?: Date - - added?: Date - - original_file_name?: string - - archived_file_name?: string - - download_url?: string - - thumbnail_url?: string - - archive_serial_number?: number - - notes?: PaperlessDocumentNote[] - - __search_hit__?: SearchHit - - custom_fields?: PaperlessCustomFieldInstance[] -} diff --git a/src-ui/src/app/data/paperless-saved-view.ts b/src-ui/src/app/data/saved-view.ts similarity index 79% rename from src-ui/src/app/data/paperless-saved-view.ts rename to src-ui/src/app/data/saved-view.ts index b569fde00..b2941bb05 100644 --- a/src-ui/src/app/data/paperless-saved-view.ts +++ b/src-ui/src/app/data/saved-view.ts @@ -1,7 +1,7 @@ import { FilterRule } from './filter-rule' import { ObjectWithPermissions } from './object-with-permissions' -export interface PaperlessSavedView extends ObjectWithPermissions { +export interface SavedView extends ObjectWithPermissions { name?: string show_on_dashboard?: boolean diff --git a/src-ui/src/app/data/paperless-share-link.ts b/src-ui/src/app/data/share-link.ts similarity index 60% rename from src-ui/src/app/data/paperless-share-link.ts rename to src-ui/src/app/data/share-link.ts index 03dab58c9..debc8c111 100644 --- a/src-ui/src/app/data/paperless-share-link.ts +++ b/src-ui/src/app/data/share-link.ts @@ -1,18 +1,18 @@ import { ObjectWithPermissions } from './object-with-permissions' -export enum PaperlessFileVersion { +export enum FileVersion { Archive = 'archive', Original = 'original', } -export interface PaperlessShareLink extends ObjectWithPermissions { +export interface ShareLink extends ObjectWithPermissions { created: string // Date expiration?: string // Date slug: string - document: number // PaperlessDocument + document: number // Document file_version: string } diff --git a/src-ui/src/app/data/paperless-storage-path.ts b/src-ui/src/app/data/storage-path.ts similarity index 52% rename from src-ui/src/app/data/paperless-storage-path.ts rename to src-ui/src/app/data/storage-path.ts index cdd5b3e7a..82c957e17 100644 --- a/src-ui/src/app/data/paperless-storage-path.ts +++ b/src-ui/src/app/data/storage-path.ts @@ -1,5 +1,5 @@ import { MatchingModel } from './matching-model' -export interface PaperlessStoragePath extends MatchingModel { +export interface StoragePath extends MatchingModel { path?: string } diff --git a/src-ui/src/app/data/paperless-tag.ts b/src-ui/src/app/data/tag.ts similarity index 68% rename from src-ui/src/app/data/paperless-tag.ts rename to src-ui/src/app/data/tag.ts index 7265ae187..478dc674c 100644 --- a/src-ui/src/app/data/paperless-tag.ts +++ b/src-ui/src/app/data/tag.ts @@ -1,6 +1,6 @@ import { MatchingModel } from './matching-model' -export interface PaperlessTag extends MatchingModel { +export interface Tag extends MatchingModel { color?: string text_color?: string diff --git a/src-ui/src/app/data/paperless-uisettings.ts b/src-ui/src/app/data/ui-settings.ts similarity index 96% rename from src-ui/src/app/data/paperless-uisettings.ts rename to src-ui/src/app/data/ui-settings.ts index a8ef0f87f..329fc6aa0 100644 --- a/src-ui/src/app/data/paperless-uisettings.ts +++ b/src-ui/src/app/data/ui-settings.ts @@ -1,12 +1,12 @@ -import { PaperlessUser } from './paperless-user' +import { User } from './user' -export interface PaperlessUiSettings { - user: PaperlessUser +export interface UiSettings { + user: User settings: Object permissions: string[] } -export interface PaperlessUiSetting { +export interface UiSetting { key: string type: string default: any @@ -53,7 +53,7 @@ export const SETTINGS_KEYS = { DEFAULT_PERMS_EDIT_GROUPS: 'general-settings:permissions:default-edit-groups', } -export const SETTINGS: PaperlessUiSetting[] = [ +export const SETTINGS: UiSetting[] = [ { key: SETTINGS_KEYS.LANGUAGE, type: 'string', diff --git a/src-ui/src/app/data/paperless-user.ts b/src-ui/src/app/data/user.ts similarity index 74% rename from src-ui/src/app/data/paperless-user.ts rename to src-ui/src/app/data/user.ts index 72c3f7579..49216a274 100644 --- a/src-ui/src/app/data/paperless-user.ts +++ b/src-ui/src/app/data/user.ts @@ -1,6 +1,6 @@ import { ObjectWithId } from './object-with-id' -export interface PaperlessUser extends ObjectWithId { +export interface User extends ObjectWithId { username?: string first_name?: string last_name?: string @@ -8,7 +8,7 @@ export interface PaperlessUser extends ObjectWithId { is_staff?: boolean is_active?: boolean is_superuser?: boolean - groups?: number[] // PaperlessGroup[] + groups?: number[] // Group[] user_permissions?: string[] inherited_permissions?: string[] } diff --git a/src-ui/src/app/guards/dirty-saved-view.guard.ts b/src-ui/src/app/guards/dirty-saved-view.guard.ts index 7927654d5..9dd487d96 100644 --- a/src-ui/src/app/guards/dirty-saved-view.guard.ts +++ b/src-ui/src/app/guards/dirty-saved-view.guard.ts @@ -4,7 +4,7 @@ import { DocumentListComponent } from '../components/document-list/document-list import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { ConfirmDialogComponent } from '../components/common/confirm-dialog/confirm-dialog.component' import { SettingsService } from '../services/settings.service' -import { SETTINGS_KEYS } from '../data/paperless-uisettings' +import { SETTINGS_KEYS } from '../data/ui-settings' @Injectable() export class DirtySavedViewGuard { diff --git a/src-ui/src/app/pipes/custom-date.pipe.ts b/src-ui/src/app/pipes/custom-date.pipe.ts index 4a0bb3463..079091fa9 100644 --- a/src-ui/src/app/pipes/custom-date.pipe.ts +++ b/src-ui/src/app/pipes/custom-date.pipe.ts @@ -1,6 +1,6 @@ import { DatePipe } from '@angular/common' import { Inject, LOCALE_ID, Pipe, PipeTransform } from '@angular/core' -import { SETTINGS_KEYS } from '../data/paperless-uisettings' +import { SETTINGS_KEYS } from '../data/ui-settings' import { SettingsService } from '../services/settings.service' const FORMAT_TO_ISO_FORMAT = { diff --git a/src-ui/src/app/pipes/username.pipe.ts b/src-ui/src/app/pipes/username.pipe.ts index 79d2657a2..82d8ea2b6 100644 --- a/src-ui/src/app/pipes/username.pipe.ts +++ b/src-ui/src/app/pipes/username.pipe.ts @@ -5,13 +5,13 @@ import { PermissionType, PermissionsService, } from '../services/permissions.service' -import { PaperlessUser } from '../data/paperless-user' +import { User } from '../data/user' @Pipe({ name: 'username', }) export class UsernamePipe implements PipeTransform { - users: PaperlessUser[] + users: User[] constructor( permissionsService: PermissionsService, @@ -33,7 +33,7 @@ export class UsernamePipe implements PipeTransform { : $localize`Shared` } - getName(user: PaperlessUser): string { + getName(user: User): string { if (!user) return '' const name = [user.first_name, user.last_name].join(' ') if (name.length > 1) return name.trim() diff --git a/src-ui/src/app/services/document-list-view.service.spec.ts b/src-ui/src/app/services/document-list-view.service.spec.ts index 994fa019f..afbe83175 100644 --- a/src-ui/src/app/services/document-list-view.service.spec.ts +++ b/src-ui/src/app/services/document-list-view.service.spec.ts @@ -12,13 +12,13 @@ import { FILTER_HAS_TAGS_ALL, FILTER_HAS_TAGS_ANY, } from '../data/filter-rule-type' -import { PaperlessSavedView } from '../data/paperless-saved-view' +import { SavedView } from '../data/saved-view' import { FilterRule } from '../data/filter-rule' import { RouterTestingModule } from '@angular/router/testing' import { routes } from 'src/app/app-routing.module' import { PermissionsGuard } from '../guards/permissions.guard' import { SettingsService } from './settings.service' -import { SETTINGS_KEYS } from '../data/paperless-uisettings' +import { SETTINGS_KEYS } from '../data/ui-settings' const documents = [ { @@ -69,7 +69,7 @@ const filterRules: FilterRule[] = [ }, ] -const view: PaperlessSavedView = { +const view: SavedView = { id: 3, name: 'Saved View', sort_field: 'added', diff --git a/src-ui/src/app/services/document-list-view.service.ts b/src-ui/src/app/services/document-list-view.service.ts index 4fb2cda02..eece10994 100644 --- a/src-ui/src/app/services/document-list-view.service.ts +++ b/src-ui/src/app/services/document-list-view.service.ts @@ -7,9 +7,9 @@ import { cloneFilterRules, isFullTextFilterRule, } from '../utils/filter-rules' -import { PaperlessDocument } from '../data/paperless-document' -import { PaperlessSavedView } from '../data/paperless-saved-view' -import { SETTINGS_KEYS } from '../data/paperless-uisettings' +import { Document } from '../data/document' +import { SavedView } from '../data/saved-view' +import { SETTINGS_KEYS } from '../data/ui-settings' import { DOCUMENT_LIST_SERVICE } from '../data/storage-keys' import { paramsFromViewState, paramsToViewState } from '../utils/query-params' import { @@ -31,7 +31,7 @@ export interface ListViewState { /** * Current paginated list of documents displayed. */ - documents?: PaperlessDocument[] + documents?: Document[] currentPage: number @@ -149,7 +149,7 @@ export class DocumentListViewService { this.unsubscribeNotifier.next(true) } - activateSavedView(view: PaperlessSavedView) { + activateSavedView(view: SavedView) { this.rangeSelectionAnchorIndex = this.lastRangeSelectionToIndex = null if (view) { this._activeSavedViewId = view.id @@ -159,16 +159,13 @@ export class DocumentListViewService { } } - activateSavedViewWithQueryParams( - view: PaperlessSavedView, - queryParams: ParamMap - ) { + activateSavedViewWithQueryParams(view: SavedView, queryParams: ParamMap) { const viewState = paramsToViewState(queryParams) this.activateSavedView(view) this.currentPage = viewState.currentPage } - loadSavedView(view: PaperlessSavedView, closeCurrentView: boolean = false) { + loadSavedView(view: SavedView, closeCurrentView: boolean = false) { if (closeCurrentView) { this._activeSavedViewId = null } @@ -350,7 +347,7 @@ export class DocumentListViewService { this.saveDocumentListView() } - get documents(): PaperlessDocument[] { + get documents(): Document[] { return this.activeListViewState.documents } @@ -494,18 +491,18 @@ export class DocumentListViewService { }) } - isSelected(d: PaperlessDocument) { + isSelected(d: Document) { return this.selected.has(d.id) } - toggleSelected(d: PaperlessDocument): void { + toggleSelected(d: Document): void { if (this.selected.has(d.id)) this.selected.delete(d.id) else this.selected.add(d.id) this.rangeSelectionAnchorIndex = this.documentIndexInCurrentView(d.id) this.lastRangeSelectionToIndex = null } - selectRangeTo(d: PaperlessDocument) { + selectRangeTo(d: Document) { if (this.rangeSelectionAnchorIndex !== null) { const documentToIndex = this.documentIndexInCurrentView(d.id) const fromIndex = Math.min( diff --git a/src-ui/src/app/services/open-documents.service.ts b/src-ui/src/app/services/open-documents.service.ts index 17be66428..9c7d5bf7d 100644 --- a/src-ui/src/app/services/open-documents.service.ts +++ b/src-ui/src/app/services/open-documents.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core' -import { PaperlessDocument } from '../data/paperless-document' +import { Document } from '../data/document' import { OPEN_DOCUMENT_SERVICE } from '../data/storage-keys' import { DocumentService } from './rest/document.service' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' @@ -29,7 +29,7 @@ export class OpenDocumentsService { } } - private openDocuments: PaperlessDocument[] = [] + private openDocuments: Document[] = [] private dirtyDocuments: Set = new Set() refreshDocument(id: number) { @@ -48,15 +48,15 @@ export class OpenDocumentsService { } } - getOpenDocuments(): PaperlessDocument[] { + getOpenDocuments(): Document[] { return this.openDocuments } - getOpenDocument(id: number): PaperlessDocument { + getOpenDocument(id: number): Document { return this.openDocuments.find((d) => d.id == id) } - openDocument(doc: PaperlessDocument): Observable { + openDocument(doc: Document): Observable { if (this.openDocuments.find((d) => d.id == doc.id) == null) { if (this.openDocuments.length == this.MAX_OPEN_DOCUMENTS) { // at max, ensure changes arent lost @@ -74,13 +74,13 @@ export class OpenDocumentsService { return of(true) } - private finishOpenDocument(doc: PaperlessDocument) { + private finishOpenDocument(doc: Document) { this.openDocuments.unshift(doc) this.dirtyDocuments.delete(doc.id) this.save() } - setDirty(doc: PaperlessDocument, dirty: boolean) { + setDirty(doc: Document, dirty: boolean) { if (!this.openDocuments.find((d) => d.id == doc.id)) return if (dirty) this.dirtyDocuments.add(doc.id) else this.dirtyDocuments.delete(doc.id) @@ -90,7 +90,7 @@ export class OpenDocumentsService { return this.dirtyDocuments.size > 0 } - closeDocument(doc: PaperlessDocument): Observable { + closeDocument(doc: Document): Observable { let index = this.openDocuments.findIndex((d) => d.id == doc.id) if (index == -1) return of(true) if (!this.dirtyDocuments.has(doc.id)) { diff --git a/src-ui/src/app/services/permissions.service.spec.ts b/src-ui/src/app/services/permissions.service.spec.ts index 635c9beb9..968082ae9 100644 --- a/src-ui/src/app/services/permissions.service.spec.ts +++ b/src-ui/src/app/services/permissions.service.spec.ts @@ -4,27 +4,27 @@ import { PermissionType, PermissionsService, } from './permissions.service' -import { PaperlessDocument } from '../data/paperless-document' +import { Document } from '../data/document' describe('PermissionsService', () => { let permissionsService: PermissionsService - const docUnowned: PaperlessDocument = { + const docUnowned: Document = { title: 'Doc title', owner: null, } - const docOwned: PaperlessDocument = { + const docOwned: Document = { title: 'Doc title 2', owner: 1, } - const docNotOwned: PaperlessDocument = { + const docNotOwned: Document = { title: 'Doc title 3', owner: 2, } - const docUserViewGranted: PaperlessDocument = { + const docUserViewGranted: Document = { title: 'Doc title 4', owner: 2, permissions: { @@ -39,7 +39,7 @@ describe('PermissionsService', () => { }, } - const docUserEditGranted: PaperlessDocument = { + const docUserEditGranted: Document = { title: 'Doc title 5', owner: 2, permissions: { @@ -54,7 +54,7 @@ describe('PermissionsService', () => { }, } - const docGroupViewGranted: PaperlessDocument = { + const docGroupViewGranted: Document = { title: 'Doc title 4', owner: 2, permissions: { @@ -69,7 +69,7 @@ describe('PermissionsService', () => { }, } - const docGroupEditGranted: PaperlessDocument = { + const docGroupEditGranted: Document = { title: 'Doc title 5', owner: 2, permissions: { diff --git a/src-ui/src/app/services/permissions.service.ts b/src-ui/src/app/services/permissions.service.ts index b484e0bd3..a4e30d57e 100644 --- a/src-ui/src/app/services/permissions.service.ts +++ b/src-ui/src/app/services/permissions.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core' import { ObjectWithPermissions } from '../data/object-with-permissions' -import { PaperlessUser } from '../data/paperless-user' +import { User } from '../data/user' export enum PermissionAction { Add = 'add', @@ -34,9 +34,9 @@ export enum PermissionType { }) export class PermissionsService { private permissions: string[] - private currentUser: PaperlessUser + private currentUser: User - public initialize(permissions: string[], currentUser: PaperlessUser) { + public initialize(permissions: string[], currentUser: User) { this.permissions = permissions this.currentUser = currentUser } diff --git a/src-ui/src/app/services/rest/consumption-template.service.spec.ts b/src-ui/src/app/services/rest/consumption-template.service.spec.ts index 471007f03..920d0575c 100644 --- a/src-ui/src/app/services/rest/consumption-template.service.spec.ts +++ b/src-ui/src/app/services/rest/consumption-template.service.spec.ts @@ -6,13 +6,13 @@ import { commonAbstractPaperlessServiceTests } from './abstract-paperless-servic import { ConsumptionTemplateService } from './consumption-template.service' import { DocumentSource, - PaperlessConsumptionTemplate, -} from 'src/app/data/paperless-consumption-template' + ConsumptionTemplate, +} from 'src/app/data/consumption-template' let httpTestingController: HttpTestingController let service: ConsumptionTemplateService const endpoint = 'consumption_templates' -const templates: PaperlessConsumptionTemplate[] = [ +const templates: ConsumptionTemplate[] = [ { name: 'Template 1', id: 1, diff --git a/src-ui/src/app/services/rest/consumption-template.service.ts b/src-ui/src/app/services/rest/consumption-template.service.ts index e0181a27a..eb932ebf7 100644 --- a/src-ui/src/app/services/rest/consumption-template.service.ts +++ b/src-ui/src/app/services/rest/consumption-template.service.ts @@ -1,13 +1,13 @@ import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { tap } from 'rxjs' -import { PaperlessConsumptionTemplate } from 'src/app/data/paperless-consumption-template' +import { ConsumptionTemplate } from 'src/app/data/consumption-template' import { AbstractPaperlessService } from './abstract-paperless-service' @Injectable({ providedIn: 'root', }) -export class ConsumptionTemplateService extends AbstractPaperlessService { +export class ConsumptionTemplateService extends AbstractPaperlessService { loading: boolean constructor(http: HttpClient) { @@ -22,21 +22,21 @@ export class ConsumptionTemplateService extends AbstractPaperlessService this.reload())) } - update(o: PaperlessConsumptionTemplate) { + update(o: ConsumptionTemplate) { return super.update(o).pipe(tap(() => this.reload())) } - delete(o: PaperlessConsumptionTemplate) { + delete(o: ConsumptionTemplate) { return super.delete(o).pipe(tap(() => this.reload())) } } diff --git a/src-ui/src/app/services/rest/correspondent.service.ts b/src-ui/src/app/services/rest/correspondent.service.ts index c56dcce5a..04f1513a2 100644 --- a/src-ui/src/app/services/rest/correspondent.service.ts +++ b/src-ui/src/app/services/rest/correspondent.service.ts @@ -1,12 +1,12 @@ import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' -import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' +import { Correspondent } from 'src/app/data/correspondent' import { AbstractNameFilterService } from './abstract-name-filter-service' @Injectable({ providedIn: 'root', }) -export class CorrespondentService extends AbstractNameFilterService { +export class CorrespondentService extends AbstractNameFilterService { constructor(http: HttpClient) { super(http, 'correspondents') } diff --git a/src-ui/src/app/services/rest/custom-fields.service.ts b/src-ui/src/app/services/rest/custom-fields.service.ts index 352b94999..e951e68b0 100644 --- a/src-ui/src/app/services/rest/custom-fields.service.ts +++ b/src-ui/src/app/services/rest/custom-fields.service.ts @@ -2,13 +2,13 @@ import { Injectable } from '@angular/core' import { HttpClient, HttpParams } from '@angular/common/http' import { AbstractPaperlessService } from './abstract-paperless-service' import { Observable } from 'rxjs' -import { PaperlessCustomField } from 'src/app/data/paperless-custom-field' -import { PaperlessCustomFieldInstance } from 'src/app/data/paperless-custom-field-instance' +import { CustomField } from 'src/app/data/custom-field' +import { CustomFieldInstance } from 'src/app/data/custom-field-instance' @Injectable({ providedIn: 'root', }) -export class CustomFieldsService extends AbstractPaperlessService { +export class CustomFieldsService extends AbstractPaperlessService { constructor(http: HttpClient) { super(http, 'custom_fields') } diff --git a/src-ui/src/app/services/rest/document-notes.service.spec.ts b/src-ui/src/app/services/rest/document-notes.service.spec.ts index c07623042..df3f8ee30 100644 --- a/src-ui/src/app/services/rest/document-notes.service.spec.ts +++ b/src-ui/src/app/services/rest/document-notes.service.spec.ts @@ -3,9 +3,6 @@ import { Subscription } from 'rxjs' import { TestBed } from '@angular/core/testing' import { environment } from 'src/environments/environment' import { commonAbstractPaperlessServiceTests } from './abstract-paperless-service.spec' -import { MailFilterAttachmentType } from 'src/app/data/paperless-mail-rule' -import { MailMetadataTitleOption } from 'src/app/data/paperless-mail-rule' -import { MailAction } from 'src/app/data/paperless-mail-rule' import { DocumentNotesService } from './document-notes.service' let httpTestingController: HttpTestingController diff --git a/src-ui/src/app/services/rest/document-notes.service.ts b/src-ui/src/app/services/rest/document-notes.service.ts index 11bbde447..f053303cd 100644 --- a/src-ui/src/app/services/rest/document-notes.service.ts +++ b/src-ui/src/app/services/rest/document-notes.service.ts @@ -1,35 +1,31 @@ import { Injectable } from '@angular/core' import { HttpClient, HttpParams } from '@angular/common/http' -import { PaperlessDocumentNote } from 'src/app/data/paperless-document-note' +import { DocumentNote } from 'src/app/data/document-note' import { AbstractPaperlessService } from './abstract-paperless-service' import { Observable } from 'rxjs' @Injectable({ providedIn: 'root', }) -export class DocumentNotesService extends AbstractPaperlessService { +export class DocumentNotesService extends AbstractPaperlessService { constructor(http: HttpClient) { super(http, 'documents') } - getNotes(documentId: number): Observable { - return this.http.get( + getNotes(documentId: number): Observable { + return this.http.get( this.getResourceUrl(documentId, 'notes') ) } - addNote(id: number, note: string): Observable { - return this.http.post( - this.getResourceUrl(id, 'notes'), - { note: note } - ) + addNote(id: number, note: string): Observable { + return this.http.post(this.getResourceUrl(id, 'notes'), { + note: note, + }) } - deleteNote( - documentId: number, - noteId: number - ): Observable { - return this.http.delete( + deleteNote(documentId: number, noteId: number): Observable { + return this.http.delete( this.getResourceUrl(documentId, 'notes'), { params: new HttpParams({ fromString: `id=${noteId}` }) } ) diff --git a/src-ui/src/app/services/rest/document-type.service.ts b/src-ui/src/app/services/rest/document-type.service.ts index e2d96cb3a..649af0675 100644 --- a/src-ui/src/app/services/rest/document-type.service.ts +++ b/src-ui/src/app/services/rest/document-type.service.ts @@ -1,12 +1,12 @@ import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' -import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' +import { DocumentType } from 'src/app/data/document-type' import { AbstractNameFilterService } from './abstract-name-filter-service' @Injectable({ providedIn: 'root', }) -export class DocumentTypeService extends AbstractNameFilterService { +export class DocumentTypeService extends AbstractNameFilterService { constructor(http: HttpClient) { super(http, 'document_types') } diff --git a/src-ui/src/app/services/rest/document.service.ts b/src-ui/src/app/services/rest/document.service.ts index 9c1d4b61d..ee0f26187 100644 --- a/src-ui/src/app/services/rest/document.service.ts +++ b/src-ui/src/app/services/rest/document.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core' -import { PaperlessDocument } from 'src/app/data/paperless-document' -import { PaperlessDocumentMetadata } from 'src/app/data/paperless-document-metadata' +import { Document } from 'src/app/data/document' +import { DocumentMetadata } from 'src/app/data/document-metadata' import { AbstractPaperlessService } from './abstract-paperless-service' import { HttpClient, HttpParams } from '@angular/common/http' import { Observable } from 'rxjs' @@ -10,7 +10,7 @@ import { map, tap } from 'rxjs/operators' import { CorrespondentService } from './correspondent.service' import { DocumentTypeService } from './document-type.service' import { TagService } from './tag.service' -import { PaperlessDocumentSuggestions } from 'src/app/data/paperless-document-suggestions' +import { DocumentSuggestions } from 'src/app/data/document-suggestions' import { queryParamsFromFilterRules } from '../../utils/query-params' import { StoragePathService } from './storage-path.service' @@ -49,7 +49,7 @@ export interface SelectionData { @Injectable({ providedIn: 'root', }) -export class DocumentService extends AbstractPaperlessService { +export class DocumentService extends AbstractPaperlessService { private _searchQuery: string constructor( @@ -62,7 +62,7 @@ export class DocumentService extends AbstractPaperlessService super(http, 'documents') } - addObservablesToDocument(doc: PaperlessDocument) { + addObservablesToDocument(doc: Document) { if (doc.correspondent) { doc.correspondent$ = this.correspondentService.getCached( doc.correspondent @@ -93,7 +93,7 @@ export class DocumentService extends AbstractPaperlessService sortReverse?: boolean, filterRules?: FilterRule[], extraParams = {} - ): Observable> { + ): Observable> { return this.list( page, pageSize, @@ -114,8 +114,8 @@ export class DocumentService extends AbstractPaperlessService }).pipe(map((response) => response.results.map((doc) => doc.id))) } - get(id: number): Observable { - return this.http.get(this.getResourceUrl(id), { + get(id: number): Observable { + return this.http.get(this.getResourceUrl(id), { params: { full_perms: true, }, @@ -147,7 +147,7 @@ export class DocumentService extends AbstractPaperlessService return this.http.get(this.getResourceUrl(null, 'next_asn')) } - update(o: PaperlessDocument): Observable { + update(o: Document): Observable { // we want to only set created_date o.created = undefined return super.update(o) @@ -161,10 +161,8 @@ export class DocumentService extends AbstractPaperlessService ) } - getMetadata(id: number): Observable { - return this.http.get( - this.getResourceUrl(id, 'metadata') - ) + getMetadata(id: number): Observable { + return this.http.get(this.getResourceUrl(id, 'metadata')) } bulkEdit(ids: number[], method: string, args: any) { @@ -182,8 +180,8 @@ export class DocumentService extends AbstractPaperlessService ) } - getSuggestions(id: number): Observable { - return this.http.get( + getSuggestions(id: number): Observable { + return this.http.get( this.getResourceUrl(id, 'suggestions') ) } diff --git a/src-ui/src/app/services/rest/group.service.ts b/src-ui/src/app/services/rest/group.service.ts index 5cfa42133..31cc6311d 100644 --- a/src-ui/src/app/services/rest/group.service.ts +++ b/src-ui/src/app/services/rest/group.service.ts @@ -1,14 +1,14 @@ import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { Observable, switchMap } from 'rxjs' -import { PaperlessGroup } from 'src/app/data/paperless-group' +import { Group } from 'src/app/data/group' import { PermissionsService } from '../permissions.service' import { AbstractNameFilterService } from './abstract-name-filter-service' @Injectable({ providedIn: 'root', }) -export class GroupService extends AbstractNameFilterService { +export class GroupService extends AbstractNameFilterService { constructor( http: HttpClient, private permissionService: PermissionsService @@ -16,7 +16,7 @@ export class GroupService extends AbstractNameFilterService { super(http, 'groups') } - update(o: PaperlessGroup): Observable { + update(o: Group): Observable { return this.getCached(o.id).pipe( switchMap((initialGroup) => { initialGroup.permissions?.forEach((perm) => { diff --git a/src-ui/src/app/services/rest/mail-account.service.spec.ts b/src-ui/src/app/services/rest/mail-account.service.spec.ts index 86e09e241..80a66f28b 100644 --- a/src-ui/src/app/services/rest/mail-account.service.spec.ts +++ b/src-ui/src/app/services/rest/mail-account.service.spec.ts @@ -4,7 +4,7 @@ import { TestBed } from '@angular/core/testing' import { environment } from 'src/environments/environment' import { commonAbstractPaperlessServiceTests } from './abstract-paperless-service.spec' import { MailAccountService } from './mail-account.service' -import { IMAPSecurity } from 'src/app/data/paperless-mail-account' +import { IMAPSecurity } from 'src/app/data/mail-account' let httpTestingController: HttpTestingController let service: MailAccountService diff --git a/src-ui/src/app/services/rest/mail-account.service.ts b/src-ui/src/app/services/rest/mail-account.service.ts index 0d9736c5e..fb0b0ed23 100644 --- a/src-ui/src/app/services/rest/mail-account.service.ts +++ b/src-ui/src/app/services/rest/mail-account.service.ts @@ -2,13 +2,13 @@ import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { combineLatest, Observable } from 'rxjs' import { tap } from 'rxjs/operators' -import { PaperlessMailAccount } from 'src/app/data/paperless-mail-account' +import { MailAccount } from 'src/app/data/mail-account' import { AbstractPaperlessService } from './abstract-paperless-service' @Injectable({ providedIn: 'root', }) -export class MailAccountService extends AbstractPaperlessService { +export class MailAccountService extends AbstractPaperlessService { loading: boolean constructor(http: HttpClient) { @@ -23,33 +23,31 @@ export class MailAccountService extends AbstractPaperlessService this.reload())) } - update(o: PaperlessMailAccount) { + update(o: MailAccount) { return super.update(o).pipe(tap(() => this.reload())) } - patchMany( - objects: PaperlessMailAccount[] - ): Observable { + patchMany(objects: MailAccount[]): Observable { return combineLatest(objects.map((o) => super.patch(o))).pipe( tap(() => this.reload()) ) } - delete(o: PaperlessMailAccount) { + delete(o: MailAccount) { return super.delete(o).pipe(tap(() => this.reload())) } - test(o: PaperlessMailAccount) { + test(o: MailAccount) { const account = Object.assign({}, o) delete account['set_permissions'] return this.http.post(this.getResourceUrl() + 'test/', account) diff --git a/src-ui/src/app/services/rest/mail-rule.service.spec.ts b/src-ui/src/app/services/rest/mail-rule.service.spec.ts index 69ef7cb34..cc5ac9928 100644 --- a/src-ui/src/app/services/rest/mail-rule.service.spec.ts +++ b/src-ui/src/app/services/rest/mail-rule.service.spec.ts @@ -4,9 +4,9 @@ import { TestBed } from '@angular/core/testing' import { environment } from 'src/environments/environment' import { commonAbstractPaperlessServiceTests } from './abstract-paperless-service.spec' import { MailRuleService } from './mail-rule.service' -import { MailFilterAttachmentType } from 'src/app/data/paperless-mail-rule' -import { MailMetadataTitleOption } from 'src/app/data/paperless-mail-rule' -import { MailAction } from 'src/app/data/paperless-mail-rule' +import { MailFilterAttachmentType } from 'src/app/data/mail-rule' +import { MailMetadataTitleOption } from 'src/app/data/mail-rule' +import { MailAction } from 'src/app/data/mail-rule' let httpTestingController: HttpTestingController let service: MailRuleService diff --git a/src-ui/src/app/services/rest/mail-rule.service.ts b/src-ui/src/app/services/rest/mail-rule.service.ts index c40157598..caa73ed2c 100644 --- a/src-ui/src/app/services/rest/mail-rule.service.ts +++ b/src-ui/src/app/services/rest/mail-rule.service.ts @@ -2,13 +2,13 @@ import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { combineLatest, Observable } from 'rxjs' import { tap } from 'rxjs/operators' -import { PaperlessMailRule } from 'src/app/data/paperless-mail-rule' +import { MailRule } from 'src/app/data/mail-rule' import { AbstractPaperlessService } from './abstract-paperless-service' @Injectable({ providedIn: 'root', }) -export class MailRuleService extends AbstractPaperlessService { +export class MailRuleService extends AbstractPaperlessService { loading: boolean constructor(http: HttpClient) { @@ -23,27 +23,27 @@ export class MailRuleService extends AbstractPaperlessService }) } - private mailRules: PaperlessMailRule[] = [] + private mailRules: MailRule[] = [] get allRules() { return this.mailRules } - create(o: PaperlessMailRule) { + create(o: MailRule) { return super.create(o).pipe(tap(() => this.reload())) } - update(o: PaperlessMailRule) { + update(o: MailRule) { return super.update(o).pipe(tap(() => this.reload())) } - patchMany(objects: PaperlessMailRule[]): Observable { + patchMany(objects: MailRule[]): Observable { return combineLatest(objects.map((o) => super.patch(o))).pipe( tap(() => this.reload()) ) } - delete(o: PaperlessMailRule) { + delete(o: MailRule) { return super.delete(o).pipe(tap(() => this.reload())) } } diff --git a/src-ui/src/app/services/rest/saved-view.service.spec.ts b/src-ui/src/app/services/rest/saved-view.service.spec.ts index ffd2099ba..fb9271362 100644 --- a/src-ui/src/app/services/rest/saved-view.service.spec.ts +++ b/src-ui/src/app/services/rest/saved-view.service.spec.ts @@ -5,7 +5,7 @@ import { environment } from 'src/environments/environment' import { commonAbstractPaperlessServiceTests } from './abstract-paperless-service.spec' import { SavedViewService } from './saved-view.service' import { SettingsService } from '../settings.service' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' let httpTestingController: HttpTestingController let service: SavedViewService diff --git a/src-ui/src/app/services/rest/saved-view.service.ts b/src-ui/src/app/services/rest/saved-view.service.ts index bd0d9fb52..2a716bff1 100644 --- a/src-ui/src/app/services/rest/saved-view.service.ts +++ b/src-ui/src/app/services/rest/saved-view.service.ts @@ -2,16 +2,16 @@ 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 { SavedView } from 'src/app/data/saved-view' import { PermissionsService } from '../permissions.service' import { AbstractPaperlessService } from './abstract-paperless-service' import { SettingsService } from '../settings.service' -import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings' +import { SETTINGS_KEYS } from 'src/app/data/ui-settings' @Injectable({ providedIn: 'root', }) -export class SavedViewService extends AbstractPaperlessService { +export class SavedViewService extends AbstractPaperlessService { loading: boolean constructor( @@ -35,13 +35,13 @@ export class SavedViewService extends AbstractPaperlessService v.show_in_sidebar) const sorted: number[] = this.settingsService.get( @@ -56,7 +56,7 @@ export class SavedViewService extends AbstractPaperlessService v.show_on_dashboard) const sorted: number[] = this.settingsService.get( @@ -71,21 +71,21 @@ export class SavedViewService extends AbstractPaperlessService this.reload())) } - update(o: PaperlessSavedView) { + update(o: SavedView) { return super.update(o).pipe(tap(() => this.reload())) } - patchMany(objects: PaperlessSavedView[]): Observable { + patchMany(objects: SavedView[]): Observable { return combineLatest(objects.map((o) => super.patch(o))).pipe( tap(() => this.reload()) ) } - delete(o: PaperlessSavedView) { + delete(o: SavedView) { return super.delete(o).pipe(tap(() => this.reload())) } } diff --git a/src-ui/src/app/services/rest/share-link.service.ts b/src-ui/src/app/services/rest/share-link.service.ts index f69b54844..ef45b7b25 100644 --- a/src-ui/src/app/services/rest/share-link.service.ts +++ b/src-ui/src/app/services/rest/share-link.service.ts @@ -1,8 +1,5 @@ import { Injectable } from '@angular/core' -import { - PaperlessShareLink, - PaperlessFileVersion, -} from 'src/app/data/paperless-share-link' +import { ShareLink, FileVersion } from 'src/app/data/share-link' import { AbstractNameFilterService } from './abstract-name-filter-service' import { HttpClient } from '@angular/common/http' import { Observable } from 'rxjs' @@ -10,24 +7,24 @@ import { Observable } from 'rxjs' @Injectable({ providedIn: 'root', }) -export class ShareLinkService extends AbstractNameFilterService { +export class ShareLinkService extends AbstractNameFilterService { constructor(http: HttpClient) { super(http, 'share_links') } - getLinksForDocument(documentId: number): Observable { - return this.http.get( + getLinksForDocument(documentId: number): Observable { + return this.http.get( `${this.baseUrl}documents/${documentId}/${this.resourceName}/` ) } createLinkForDocument( documentId: number, - file_version: PaperlessFileVersion = PaperlessFileVersion.Archive, + file_version: FileVersion = FileVersion.Archive, expiration: Date = null ) { this.clearCache() - return this.http.post(this.getResourceUrl(), { + return this.http.post(this.getResourceUrl(), { document: documentId, file_version, expiration: expiration?.toISOString(), diff --git a/src-ui/src/app/services/rest/storage-path.service.ts b/src-ui/src/app/services/rest/storage-path.service.ts index 481330217..52997c7a0 100644 --- a/src-ui/src/app/services/rest/storage-path.service.ts +++ b/src-ui/src/app/services/rest/storage-path.service.ts @@ -1,12 +1,12 @@ import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' -import { PaperlessStoragePath } from 'src/app/data/paperless-storage-path' +import { StoragePath } from 'src/app/data/storage-path' import { AbstractNameFilterService } from './abstract-name-filter-service' @Injectable({ providedIn: 'root', }) -export class StoragePathService extends AbstractNameFilterService { +export class StoragePathService extends AbstractNameFilterService { constructor(http: HttpClient) { super(http, 'storage_paths') } diff --git a/src-ui/src/app/services/rest/tag.service.ts b/src-ui/src/app/services/rest/tag.service.ts index f15369c62..31aa7d7fd 100644 --- a/src-ui/src/app/services/rest/tag.service.ts +++ b/src-ui/src/app/services/rest/tag.service.ts @@ -1,12 +1,12 @@ import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' -import { PaperlessTag } from 'src/app/data/paperless-tag' +import { Tag } from 'src/app/data/tag' import { AbstractNameFilterService } from './abstract-name-filter-service' @Injectable({ providedIn: 'root', }) -export class TagService extends AbstractNameFilterService { +export class TagService extends AbstractNameFilterService { constructor(http: HttpClient) { super(http, 'tags') } diff --git a/src-ui/src/app/services/rest/user.service.ts b/src-ui/src/app/services/rest/user.service.ts index b4cfaffd6..a908a50e5 100644 --- a/src-ui/src/app/services/rest/user.service.ts +++ b/src-ui/src/app/services/rest/user.service.ts @@ -1,14 +1,14 @@ import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { Observable, switchMap } from 'rxjs' -import { PaperlessUser } from 'src/app/data/paperless-user' +import { User } from 'src/app/data/user' import { PermissionsService } from '../permissions.service' import { AbstractNameFilterService } from './abstract-name-filter-service' @Injectable({ providedIn: 'root', }) -export class UserService extends AbstractNameFilterService { +export class UserService extends AbstractNameFilterService { constructor( http: HttpClient, private permissionService: PermissionsService @@ -16,7 +16,7 @@ export class UserService extends AbstractNameFilterService { super(http, 'users') } - update(o: PaperlessUser): Observable { + update(o: User): Observable { return this.getCached(o.id).pipe( switchMap((initialUser) => { initialUser.user_permissions?.forEach((perm) => { diff --git a/src-ui/src/app/services/settings.service.spec.ts b/src-ui/src/app/services/settings.service.spec.ts index d0814bad9..0c148cec2 100644 --- a/src-ui/src/app/services/settings.service.spec.ts +++ b/src-ui/src/app/services/settings.service.spec.ts @@ -10,12 +10,9 @@ import { CookieService } from 'ngx-cookie-service' import { Subscription } from 'rxjs' import { environment } from 'src/environments/environment' import { AppModule } from '../app.module' -import { - PaperlessUiSettings, - SETTINGS_KEYS, -} from '../data/paperless-uisettings' +import { UiSettings, SETTINGS_KEYS } from '../data/ui-settings' import { SettingsService } from './settings.service' -import { PaperlessSavedView } from '../data/paperless-saved-view' +import { SavedView } from '../data/saved-view' describe('SettingsService', () => { let httpTestingController: HttpTestingController @@ -23,7 +20,7 @@ describe('SettingsService', () => { let cookieService: CookieService let subscription: Subscription - const ui_settings: PaperlessUiSettings = { + const ui_settings: UiSettings = { user: { username: 'testuser', first_name: 'Test', @@ -285,16 +282,16 @@ describe('SettingsService', () => { .flush(ui_settings) const setSpy = jest.spyOn(settingsService, 'set') settingsService.updateDashboardViewsSort([ - { id: 1 } as PaperlessSavedView, - { id: 4 } as PaperlessSavedView, + { id: 1 } as SavedView, + { id: 4 } as SavedView, ]) expect(setSpy).toHaveBeenCalledWith( SETTINGS_KEYS.DASHBOARD_VIEWS_SORT_ORDER, [1, 4] ) settingsService.updateSidebarViewsSort([ - { id: 1 } as PaperlessSavedView, - { id: 4 } as PaperlessSavedView, + { id: 1 } as SavedView, + { id: 4 } as SavedView, ]) expect(setSpy).toHaveBeenCalledWith( SETTINGS_KEYS.SIDEBAR_VIEWS_SORT_ORDER, diff --git a/src-ui/src/app/services/settings.service.ts b/src-ui/src/app/services/settings.service.ts index 267a37b98..9f8560322 100644 --- a/src-ui/src/app/services/settings.service.ts +++ b/src-ui/src/app/services/settings.service.ts @@ -17,15 +17,11 @@ import { hexToHsl, } from 'src/app/utils/color' import { environment } from 'src/environments/environment' -import { - PaperlessUiSettings, - SETTINGS, - SETTINGS_KEYS, -} from '../data/paperless-uisettings' -import { PaperlessUser } from '../data/paperless-user' +import { UiSettings, SETTINGS, SETTINGS_KEYS } from '../data/ui-settings' +import { User } from '../data/user' import { PermissionsService } from './permissions.service' import { ToastService } from './toast.service' -import { PaperlessSavedView } from '../data/paperless-saved-view' +import { SavedView } from '../data/saved-view' export interface LanguageOption { code: string @@ -240,7 +236,7 @@ export class SettingsService { protected baseUrl: string = environment.apiBaseUrl + 'ui_settings/' private settings: Object = {} - currentUser: PaperlessUser + currentUser: User public settingsSaved: EventEmitter = new EventEmitter() @@ -269,8 +265,8 @@ export class SettingsService { } // this is called by the app initializer in app.module - public initializeSettings(): Observable { - return this.http.get(this.baseUrl).pipe( + public initializeSettings(): Observable { + return this.http.get(this.baseUrl).pipe( first(), tap((uisettings) => { Object.assign(this.settings, uisettings.settings) @@ -546,16 +542,14 @@ export class SettingsService { } } - updateDashboardViewsSort( - dashboardViews: PaperlessSavedView[] - ): Observable { + updateDashboardViewsSort(dashboardViews: SavedView[]): Observable { this.set(SETTINGS_KEYS.DASHBOARD_VIEWS_SORT_ORDER, [ ...new Set(dashboardViews.map((v) => v.id)), ]) return this.storeSettings() } - updateSidebarViewsSort(sidebarViews: PaperlessSavedView[]): Observable { + updateSidebarViewsSort(sidebarViews: SavedView[]): Observable { this.set(SETTINGS_KEYS.SIDEBAR_VIEWS_SORT_ORDER, [ ...new Set(sidebarViews.map((v) => v.id)), ])