move download stuff to red-domain
This commit is contained in:
parent
f12bb20b39
commit
ff2f409079
@ -1,6 +1,6 @@
|
||||
import { Component, forwardRef, Injector } from '@angular/core';
|
||||
import { FileDownloadService } from '@upload-download/services/file-download.service';
|
||||
import { DownloadStatus } from '@upload-download/model/download-status';
|
||||
import { DownloadStatus } from '@red/domain';
|
||||
import {
|
||||
CircleButtonTypes,
|
||||
DefaultListingServicesTmp,
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import {
|
||||
DownloadResponse,
|
||||
DownloadStatusResponse,
|
||||
DownloadStatus,
|
||||
IDownloadResponse,
|
||||
IDownloadStatus,
|
||||
PrepareDownloadRequest,
|
||||
RemoveDownloadRequest,
|
||||
} from '@redaction/red-ui-http';
|
||||
IDownloadStatusResponse,
|
||||
IPrepareDownloadRequest,
|
||||
IRemoveDownloadRequest,
|
||||
} from '@red/domain';
|
||||
import { interval, Observable } from 'rxjs';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
import { map, mergeMap, tap } from 'rxjs/operators';
|
||||
import { DownloadStatus } from '../model/download-status';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { EntitiesService, List, RequiredParam, Validate } from '@iqser/common-ui';
|
||||
@ -48,7 +48,7 @@ export class FileDownloadService extends EntitiesService<DownloadStatus, IDownlo
|
||||
}
|
||||
|
||||
getStatuses(): Observable<IDownloadStatus[]> {
|
||||
return super._getOne<DownloadStatusResponse>(['status']).pipe(map(res => res.downloadStatus));
|
||||
return super._getOne<IDownloadStatusResponse>(['status']).pipe(map(res => res.downloadStatus));
|
||||
}
|
||||
|
||||
async performDownload(status: DownloadStatus) {
|
||||
@ -66,12 +66,12 @@ export class FileDownloadService extends EntitiesService<DownloadStatus, IDownlo
|
||||
}
|
||||
|
||||
@Validate()
|
||||
prepareDownload(@RequiredParam() body: PrepareDownloadRequest): Observable<DownloadResponse> {
|
||||
prepareDownload(@RequiredParam() body: IPrepareDownloadRequest): Observable<IDownloadResponse> {
|
||||
return this._post(body, `${this._defaultModelPath}/prepare`);
|
||||
}
|
||||
|
||||
@Validate()
|
||||
delete(@RequiredParam() body: RemoveDownloadRequest): Observable<unknown> {
|
||||
delete(@RequiredParam() body: IRemoveDownloadRequest): Observable<unknown> {
|
||||
return super._post(body, `${this._defaultModelPath}/delete`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,3 +12,4 @@ export * from './lib/redaction-log';
|
||||
export * from './lib/geometry';
|
||||
export * from './lib/file-attributes';
|
||||
export * from './lib/files';
|
||||
export * from './lib/downloads';
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
import { DownloadStatusType, IDownloadStatus } from '@redaction/red-ui-http';
|
||||
import { IListable, List } from '@iqser/common-ui';
|
||||
import { DownloadFileType } from '@red/domain';
|
||||
import { DownloadStatusType, IDownloadStatus } from './download-status';
|
||||
import { DownloadFileType } from '../shared';
|
||||
|
||||
export class DownloadStatus implements IDownloadStatus, IListable {
|
||||
readonly storageId: string;
|
||||
readonly creationDate?: string;
|
||||
readonly dossierId?: string;
|
||||
readonly downloadFileTypes?: List<DownloadFileType>;
|
||||
readonly fileIds?: List;
|
||||
readonly fileSize?: number;
|
||||
readonly fileSize: number;
|
||||
readonly filename?: string;
|
||||
readonly lastDownload?: string;
|
||||
readonly mimeType?: string;
|
||||
readonly status?: DownloadStatusType;
|
||||
readonly storageId?: string;
|
||||
readonly userId?: string;
|
||||
readonly size?: string;
|
||||
inProgress: boolean;
|
||||
inProgress = false;
|
||||
|
||||
constructor(downloadStatus: IDownloadStatus) {
|
||||
this.creationDate = downloadStatus.creationDate;
|
||||
@ -32,7 +32,7 @@ export class DownloadStatus implements IDownloadStatus, IListable {
|
||||
this.size = this._size;
|
||||
}
|
||||
|
||||
get id() {
|
||||
get id(): string {
|
||||
return this.storageId;
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ export class DownloadStatus implements IDownloadStatus, IListable {
|
||||
return this.storageId;
|
||||
}
|
||||
|
||||
get isReady() {
|
||||
get isReady(): boolean {
|
||||
return this.status === 'READY';
|
||||
}
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
import { IDownloadStatus } from './download-status';
|
||||
|
||||
export interface IDownloadStatusResponse {
|
||||
downloadStatus?: IDownloadStatus[];
|
||||
}
|
||||
@ -1,28 +1,17 @@
|
||||
/**
|
||||
* 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 { List } from '../red-types';
|
||||
import { DownloadFileType } from '@red/domain';
|
||||
import { List } from '@iqser/common-ui';
|
||||
import { DownloadFileType } from '../shared';
|
||||
|
||||
export interface IDownloadStatus {
|
||||
readonly creationDate?: string;
|
||||
readonly dossierId?: string;
|
||||
readonly downloadFileTypes?: List<DownloadFileType>;
|
||||
readonly fileIds?: List;
|
||||
readonly fileSize?: number;
|
||||
readonly fileSize: number;
|
||||
readonly filename?: string;
|
||||
readonly lastDownload?: string;
|
||||
readonly mimeType?: string;
|
||||
readonly status?: DownloadStatusType;
|
||||
readonly storageId?: string;
|
||||
readonly storageId: string;
|
||||
readonly userId?: string;
|
||||
}
|
||||
|
||||
3
libs/red-domain/src/lib/downloads/download.response.ts
Normal file
3
libs/red-domain/src/lib/downloads/download.response.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export interface IDownloadResponse {
|
||||
readonly storageId?: string;
|
||||
}
|
||||
6
libs/red-domain/src/lib/downloads/index.ts
Normal file
6
libs/red-domain/src/lib/downloads/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export * from './download.response';
|
||||
export * from './download-status';
|
||||
export * from './download-status.model';
|
||||
export * from './download-status.response';
|
||||
export * from './prepare-download.request';
|
||||
export * from './remove-download.request';
|
||||
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Object containing information on which file and report types should be included in the download.
|
||||
*/
|
||||
import { List } from '@iqser/common-ui';
|
||||
|
||||
export interface IPrepareDownloadRequest {
|
||||
readonly dossierId?: string;
|
||||
readonly fileIds?: List;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
import { List } from '@iqser/common-ui';
|
||||
|
||||
export interface IRemoveDownloadRequest {
|
||||
storageIds: List;
|
||||
}
|
||||
@ -1,15 +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 DownloadResponse {
|
||||
readonly storageId?: string;
|
||||
}
|
||||
@ -1,16 +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 { IDownloadStatus } from './downloadStatus';
|
||||
|
||||
export interface DownloadStatusResponse {
|
||||
downloadStatus?: IDownloadStatus[];
|
||||
}
|
||||
@ -4,9 +4,6 @@ export * from './colors';
|
||||
export * from './createUserRequest';
|
||||
export * from './digitalSignature';
|
||||
export * from './digitalSignatureViewModel';
|
||||
export * from './downloadResponse';
|
||||
export * from './downloadStatus';
|
||||
export * from './downloadStatusResponse';
|
||||
export * from './generalConfigurationModel';
|
||||
export * from './idRemoval';
|
||||
export * from './imageRecategorizationRequest';
|
||||
@ -14,8 +11,6 @@ export * from './licenseReport';
|
||||
export * from './licenseReportRequest';
|
||||
export * from './manualAddResponse';
|
||||
export * from './placeholdersResponse';
|
||||
export * from './prepareDownloadRequest';
|
||||
export * from './removeDownloadRequest';
|
||||
export * from './removeRedactionRequest';
|
||||
export * from './reportData';
|
||||
export * from './reportTemplate';
|
||||
|
||||
@ -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.
|
||||
*/
|
||||
|
||||
import { List } from '../red-types';
|
||||
|
||||
/**
|
||||
* Object containing information on which file and report types should be included in the download.
|
||||
*/
|
||||
export interface PrepareDownloadRequest {
|
||||
readonly dossierId?: string;
|
||||
readonly fileIds?: List;
|
||||
}
|
||||
@ -1,15 +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 RemoveDownloadRequest {
|
||||
storageIds?: Array<string>;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user