From 4afe0f5d89f97445c397687585568e983b296266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rui=20Tom=C3=A9?= <108268980+r-tome@users.noreply.github.com> Date: Mon, 7 Nov 2022 12:03:24 +0000 Subject: [PATCH] [EC-584] Fixed OrganizationExportResponse to correctly parse data (#3641) * [EC-584] Fixed OrganizationExportResponse to correctly parse data and use CollectionResponse and CipherResponse constructors * [EC-584] Removed ListResponse from OrganizationExportResponse properties * Bumped web version to 2022.10.3 (#3957) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Revert "Bumped web version to 2022.10.3 (#3957)" This reverts commit 5d8d547cd2e0fae7255d29536ad00ee00fbfa514. * Web version bump to 2022.11.0 for QA testing * Revert "Web version bump to 2022.11.0 for QA testing" This reverts commit 484db431ed5ef7f115084e11143bbce1b8c82619. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Joseph Flinn --- .../response/organization-export.response.ts | 15 ++++++++++----- libs/common/src/services/export.service.ts | 16 ++++------------ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/libs/common/src/models/response/organization-export.response.ts b/libs/common/src/models/response/organization-export.response.ts index 949ce6a2a1..af1152dc2f 100644 --- a/libs/common/src/models/response/organization-export.response.ts +++ b/libs/common/src/models/response/organization-export.response.ts @@ -1,15 +1,20 @@ import { BaseResponse } from "./base.response"; import { CipherResponse } from "./cipher.response"; import { CollectionResponse } from "./collection.response"; -import { ListResponse } from "./list.response"; export class OrganizationExportResponse extends BaseResponse { - collections: ListResponse; - ciphers: ListResponse; + collections: CollectionResponse[]; + ciphers: CipherResponse[]; constructor(response: any) { super(response); - this.collections = this.getResponseProperty("Collections"); - this.ciphers = this.getResponseProperty("Ciphers"); + const collections = this.getResponseProperty("Collections"); + if (collections != null) { + this.collections = collections.map((c: any) => new CollectionResponse(c)); + } + const ciphers = this.getResponseProperty("Ciphers"); + if (ciphers != null) { + this.ciphers = ciphers.map((c: any) => new CipherResponse(c)); + } } } diff --git a/libs/common/src/services/export.service.ts b/libs/common/src/services/export.service.ts index 9d19ebc014..4c2f51026a 100644 --- a/libs/common/src/services/export.service.ts +++ b/libs/common/src/services/export.service.ts @@ -248,12 +248,8 @@ export class ExportService implements ExportServiceAbstraction { this.apiService.getOrganizationExport(organizationId).then((exportData) => { const exportPromises: any = []; if (exportData != null) { - if ( - exportData.collections != null && - exportData.collections.data != null && - exportData.collections.data.length > 0 - ) { - exportData.collections.data.forEach((c) => { + if (exportData.collections != null && exportData.collections.length > 0) { + exportData.collections.forEach((c) => { const collection = new Collection(new CollectionData(c as CollectionDetailsResponse)); exportPromises.push( collection.decrypt().then((decCol) => { @@ -262,12 +258,8 @@ export class ExportService implements ExportServiceAbstraction { ); }); } - if ( - exportData.ciphers != null && - exportData.ciphers.data != null && - exportData.ciphers.data.length > 0 - ) { - exportData.ciphers.data + if (exportData.ciphers != null && exportData.ciphers.length > 0) { + exportData.ciphers .filter((c) => c.deletedDate === null) .forEach((c) => { const cipher = new Cipher(new CipherData(c));