move reports to red domain

This commit is contained in:
Dan Percic 2021-10-29 13:51:43 +03:00
parent 086c2733bb
commit 223399d6eb
18 changed files with 88 additions and 143 deletions

View File

@ -1,5 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { LicenseReport } from '@redaction/red-ui-http';
import { ConfigService } from '@services/config.service';
import * as moment from 'moment';
import { TranslateService } from '@ngx-translate/core';
@ -8,6 +7,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { UserService } from '@services/user.service';
import { RouterHistoryService } from '@services/router-history.service';
import { LicenseReportService } from '../../services/licence-report.service';
import { ILicenseReport } from '@red/domain';
@Component({
selector: 'redaction-license-information-screen',
@ -24,9 +24,9 @@ export class LicenseInformationScreenComponent implements OnInit {
},
];
currentInfo: LicenseReport = {};
totalInfo: LicenseReport = {};
unlicensedInfo: LicenseReport = {};
currentInfo: ILicenseReport = {};
totalInfo: ILicenseReport = {};
unlicensedInfo: ILicenseReport = {};
totalLicensedNumberOfPages = 0;
analysisPercentageOfLicense = 100;
barChart: any[];

View File

@ -1,7 +1,7 @@
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { AppStateService } from '@state/app-state.service';
import { PlaceholdersResponse, ReportTemplate } from '@redaction/red-ui-http';
import { PlaceholdersResponse } from '@redaction/red-ui-http';
import { download } from '@utils/file-download-utils';
import { ConfirmationDialogInput, LoadingService, Toaster } from '@iqser/common-ui';
import { PermissionsService } from '@services/permissions.service';
@ -14,6 +14,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { AdminDialogService } from '../../services/admin-dialog.service';
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
import { ReportTemplateService } from '@services/report-template.service';
import { IReportTemplate } from '@red/domain';
interface Placeholder {
placeholder: string;
@ -31,7 +32,7 @@ const placeholderTypes: PlaceholderType[] = ['generalPlaceholders', 'fileAttribu
})
export class ReportsScreenComponent implements OnInit {
placeholders: Placeholder[];
availableTemplates: ReportTemplate[];
availableTemplates: IReportTemplate[];
@ViewChild('fileInput') private _fileInput: ElementRef;
@ -57,7 +58,7 @@ export class ReportsScreenComponent implements OnInit {
this._loadingService.loadWhile(this._uploadTemplate($event));
}
async download(template: ReportTemplate) {
async download(template: IReportTemplate) {
this._loadingService.start();
try {
const data = await this._reportTemplateService
@ -71,7 +72,7 @@ export class ReportsScreenComponent implements OnInit {
}
}
deleteTemplate(template: ReportTemplate) {
deleteTemplate(template: IReportTemplate) {
this._dialogService.openDialog('confirm', null, null, () => {
this._loadingService.loadWhile(this._deleteTemplate(template));
});
@ -120,7 +121,7 @@ export class ReportsScreenComponent implements OnInit {
this._fileInput.nativeElement.value = null;
}
private async _deleteTemplate(template: ReportTemplate) {
private async _deleteTemplate(template: IReportTemplate) {
await this._reportTemplateService.delete(template.dossierTemplateId, template.templateId).toPromise();
await this._loadReportTemplates();
}

View File

@ -1,15 +1,15 @@
import { Injectable, Injector } from '@angular/core';
import { GenericService, QueryParam, RequiredParam, Validate } from '@iqser/common-ui';
import { LicenseReport, LicenseReportRequest } from '@redaction/red-ui-http';
import { ILicenseReport, ILicenseReportRequest } from '@red/domain';
@Injectable()
export class LicenseReportService extends GenericService<LicenseReport> {
export class LicenseReportService extends GenericService<ILicenseReport> {
constructor(protected readonly _injector: Injector) {
super(_injector, 'report');
}
@Validate()
licenseReport(@RequiredParam() body: LicenseReportRequest, limit?: number, offset?: number) {
licenseReport(@RequiredParam() body: ILicenseReportRequest, limit?: number, offset?: number) {
const queryParams: QueryParam[] = [];
if (limit) {
queryParams.push({ key: 'limit', value: limit });

View File

@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { MatDialogRef } from '@angular/material/dialog';
import { ReportTemplate } from '@redaction/red-ui-http';
import { DownloadFileType, IDossierRequest, IDossierTemplate, IReportTemplate } from '@red/domain';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import * as moment from 'moment';
import { downloadTypesTranslations } from '../../../../translations/download-types-translations';
@ -8,7 +8,6 @@ import { IconButtonTypes } from '@iqser/common-ui';
import { DossiersService } from '@services/entity-services/dossiers.service';
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
import { ReportTemplateService } from '@services/report-template.service';
import { DownloadFileType, IDossierRequest, IDossierTemplate } from '@red/domain';
@Component({
templateUrl: './add-dossier-dialog.component.html',
@ -69,7 +68,7 @@ export class AddDossierDialogComponent {
return this.dossierForm.invalid;
}
reportTemplateValueMapper = (reportTemplate: ReportTemplate) => reportTemplate.templateId;
reportTemplateValueMapper = (reportTemplate: IReportTemplate) => reportTemplate.templateId;
async saveDossier(addMembers = false) {
const savedDossier = await this._dossiersService.createOrUpdate(this._formToObject()).toPromise();

View File

@ -1,7 +1,6 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ReportTemplate } from '@redaction/red-ui-http';
import { Dossier, DownloadFileType, IReportTemplate } from '@red/domain';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Dossier, DownloadFileType } from '@red/domain';
import { EditDossierSectionInterface } from '../edit-dossier-section.interface';
import { downloadTypesTranslations } from '../../../../../translations/download-types-translations';
import { DossiersService } from '@services/entity-services/dossiers.service';
@ -18,7 +17,7 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
key: type,
label: downloadTypesTranslations[type],
}));
availableReportTypes: ReportTemplate[] = [];
availableReportTypes: IReportTemplate[] = [];
@Input() dossier: Dossier;
@Output() readonly updateDossier = new EventEmitter();
@ -62,7 +61,7 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
return this.dossierForm?.invalid;
}
reportTemplateValueMapper = (reportTemplate: ReportTemplate) => reportTemplate.templateId;
reportTemplateValueMapper = (reportTemplate: IReportTemplate) => reportTemplate.templateId;
async ngOnInit() {
this.availableReportTypes =

View File

@ -1,8 +1,9 @@
import { Injectable, Injector } from '@angular/core';
import { GenericService, HeadersConfiguration, RequiredParam, Validate } from '@iqser/common-ui';
import { PlaceholdersResponse, ReportTemplate } from '@redaction/red-ui-http';
import { PlaceholdersResponse } from '@redaction/red-ui-http';
import { Observable } from 'rxjs';
import { HttpResponse } from '@angular/common/http';
import { IReportTemplate } from '@red/domain';
@Injectable({
providedIn: 'root',
@ -35,7 +36,7 @@ export class ReportTemplateService extends GenericService<unknown> {
@Validate()
getAvailableReportTemplates(@RequiredParam() dossierTemplateId: string) {
return this.getAll<ReportTemplate[]>(`${this._defaultModelPath}/${dossierTemplateId}`);
return this.getAll<IReportTemplate[]>(`${this._defaultModelPath}/${dossierTemplateId}`);
}
@Validate()

View File

@ -13,3 +13,4 @@ export * from './lib/geometry';
export * from './lib/file-attributes';
export * from './lib/files';
export * from './lib/downloads';
export * from './lib/reports';

View File

@ -0,0 +1,5 @@
export * from './report-data';
export * from './report-template';
export * from './types';
export * from './license-report.request';
export * from './license-report';

View File

@ -0,0 +1,8 @@
import { List } from '@iqser/common-ui';
export interface ILicenseReportRequest {
dossierIds?: List;
endDate?: Date;
requestId?: string;
startDate?: Date;
}

View File

@ -0,0 +1,16 @@
import { IReportData } from './report-data';
export interface ILicenseReport {
data?: IReportData[];
endDate?: Date;
limit?: number;
numberOfAnalyses?: number;
numberOfAnalyzedFiles?: number;
numberOfAnalyzedPages?: number;
numberOfDossiers?: number;
numberOfOcrFiles?: number;
numberOfOcrPages?: number;
offset?: number;
requestId?: string;
startDate?: Date;
}

View File

@ -0,0 +1,13 @@
import { ReportStatus } from './types';
export interface IReportData {
addedDate?: Date;
analysisCount?: number;
deletedDate?: Date;
dossier?: string;
fileName?: string;
lastUpdatedDate?: Date;
numberOfAnalyzedPages?: number;
numberOfOcrPages?: number;
status?: ReportStatus;
}

View File

@ -0,0 +1,9 @@
export interface IReportTemplate {
activeByDefault?: boolean;
dossierTemplateId?: string;
fileName?: string;
multiFileReport?: boolean;
storageId?: string;
templateId?: string;
uploadDate?: string;
}

View File

@ -0,0 +1,15 @@
export const ReportStatuses = {
APPROVED: 'APPROVED',
DELETED: 'DELETED',
ERROR: 'ERROR',
FULLREPROCESS: 'FULLREPROCESS',
OCR_PROCESSING: 'OCR_PROCESSING',
PROCESSING: 'PROCESSING',
REPROCESS: 'REPROCESS',
UNASSIGNED: 'UNASSIGNED',
UNDER_APPROVAL: 'UNDER_APPROVAL',
UNDER_REVIEW: 'UNDER_REVIEW',
UNPROCESSED: 'UNPROCESSED',
} as const;
export type ReportStatus = keyof typeof ReportStatuses;

View File

@ -1,27 +0,0 @@
/**
* API Documentation for Redaction Gateway
* Description for redaction
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { ReportData } from './reportData';
export interface LicenseReport {
data?: Array<ReportData>;
endDate?: Date;
limit?: number;
numberOfAnalyses?: number;
numberOfAnalyzedFiles?: number;
numberOfAnalyzedPages?: number;
numberOfDossiers?: number;
numberOfOcrFiles?: number;
numberOfOcrPages?: number;
offset?: number;
requestId?: string;
startDate?: Date;
}

View File

@ -1,18 +0,0 @@
/**
* API Documentation for Redaction Gateway
* Description for redaction
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface LicenseReportRequest {
dossierIds?: Array<string>;
endDate?: Date;
requestId?: string;
startDate?: Date;
}

View File

@ -6,11 +6,7 @@ export * from './digitalSignatureViewModel';
export * from './generalConfigurationModel';
export * from './idRemoval';
export * from './imageRecategorizationRequest';
export * from './licenseReport';
export * from './licenseReportRequest';
export * from './placeholdersResponse';
export * from './reportData';
export * from './reportTemplate';
export * from './rules';
export * from './smtp-configuration';
export * from './watermarkModel';

View File

@ -1,52 +0,0 @@
/**
* API Documentation for Redaction Gateway
* Description for redaction
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface ReportData {
addedDate?: Date;
analysisCount?: number;
deletedDate?: Date;
dossier?: string;
fileName?: string;
lastUpdatedDate?: Date;
numberOfAnalyzedPages?: number;
numberOfOcrPages?: number;
status?: ReportData.StatusEnum;
}
export namespace ReportData {
export type StatusEnum =
| 'APPROVED'
| 'DELETED'
| 'ERROR'
| 'FULLREPROCESS'
| 'INDEXING'
| 'OCR_PROCESSING'
| 'PROCESSING'
| 'REPROCESS'
| 'UNASSIGNED'
| 'UNDER_APPROVAL'
| 'UNDER_REVIEW'
| 'UNPROCESSED';
export const StatusEnum = {
APPROVED: 'APPROVED' as StatusEnum,
DELETED: 'DELETED' as StatusEnum,
ERROR: 'ERROR' as StatusEnum,
FULLREPROCESS: 'FULLREPROCESS' as StatusEnum,
OCR_PROCESSING: 'OCR_PROCESSING' as StatusEnum,
PROCESSING: 'PROCESSING' as StatusEnum,
REPROCESS: 'REPROCESS' as StatusEnum,
UNASSIGNED: 'UNASSIGNED' as StatusEnum,
UNDER_APPROVAL: 'UNDER_APPROVAL' as StatusEnum,
UNDER_REVIEW: 'UNDER_REVIEW' as StatusEnum,
UNPROCESSED: 'UNPROCESSED' as StatusEnum,
};
}

View File

@ -1,21 +0,0 @@
/**
* API Documentation for Redaction Gateway
* Description for redaction
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface ReportTemplate {
activeByDefault?: boolean;
dossierTemplateId?: string;
fileName?: string;
multiFileReport?: boolean;
storageId?: string;
templateId?: string;
uploadDate?: string;
}