diff --git a/libs/common/src/models/response/organization-export.response.ts b/libs/common/src/models/response/organization-export.response.ts index 949ce6a2a12..af1152dc2f9 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 9d19ebc0149..4c2f51026af 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));