From 79fea92b8152c70ed59188d6acd4948dd81ed235 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 7 Mar 2019 15:17:58 -0500 Subject: [PATCH] collection externalId --- src/models/data/collectionData.ts | 2 ++ src/models/domain/collection.ts | 4 +++- src/models/export/collection.ts | 4 ++++ src/models/request/collectionRequest.ts | 2 ++ src/models/response/collectionResponse.ts | 2 ++ src/models/view/collectionView.ts | 2 ++ 6 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/models/data/collectionData.ts b/src/models/data/collectionData.ts index 5d49ae2389..cc3ef64b97 100644 --- a/src/models/data/collectionData.ts +++ b/src/models/data/collectionData.ts @@ -4,12 +4,14 @@ export class CollectionData { id: string; organizationId: string; name: string; + externalId: string; readOnly: boolean; constructor(response: CollectionDetailsResponse) { this.id = response.id; this.organizationId = response.organizationId; this.name = response.name; + this.externalId = response.externalId; this.readOnly = response.readOnly; } } diff --git a/src/models/domain/collection.ts b/src/models/domain/collection.ts index 5d308f66b3..59bbf24d07 100644 --- a/src/models/domain/collection.ts +++ b/src/models/domain/collection.ts @@ -9,6 +9,7 @@ export class Collection extends Domain { id: string; organizationId: string; name: CipherString; + externalId: string; readOnly: boolean; constructor(obj?: CollectionData, alreadyEncrypted: boolean = false) { @@ -21,8 +22,9 @@ export class Collection extends Domain { id: null, organizationId: null, name: null, + externalId: null, readOnly: null, - }, alreadyEncrypted, ['id', 'organizationId', 'readOnly']); + }, alreadyEncrypted, ['id', 'organizationId', 'externalId', 'readOnly']); } decrypt(): Promise { diff --git a/src/models/export/collection.ts b/src/models/export/collection.ts index 85080e39f7..d4d9c7c3b1 100644 --- a/src/models/export/collection.ts +++ b/src/models/export/collection.ts @@ -5,11 +5,13 @@ export class Collection { const req = new Collection(); req.organizationId = '00000000-0000-0000-0000-000000000000'; req.name = 'Collection name'; + req.externalId = null; return req; } static toView(req: Collection, view = new CollectionView()) { view.name = req.name; + view.externalId = req.externalId; if (view.organizationId == null) { view.organizationId = req.organizationId; } @@ -18,10 +20,12 @@ export class Collection { organizationId: string; name: string; + externalId: string; // Use build method instead of ctor so that we can control order of JSON stringify for pretty print build(o: CollectionView) { this.organizationId = o.organizationId; this.name = o.name; + this.externalId = o.externalId; } } diff --git a/src/models/request/collectionRequest.ts b/src/models/request/collectionRequest.ts index 716b0acab5..20f869567d 100644 --- a/src/models/request/collectionRequest.ts +++ b/src/models/request/collectionRequest.ts @@ -4,6 +4,7 @@ import { SelectionReadOnlyRequest } from './selectionReadOnlyRequest'; export class CollectionRequest { name: string; + externalId: string; groups: SelectionReadOnlyRequest[] = []; constructor(collection?: Collection) { @@ -11,5 +12,6 @@ export class CollectionRequest { return; } this.name = collection.name ? collection.name.encryptedString : null; + this.externalId = collection.externalId; } } diff --git a/src/models/response/collectionResponse.ts b/src/models/response/collectionResponse.ts index 458945334f..eb9441c4d7 100644 --- a/src/models/response/collectionResponse.ts +++ b/src/models/response/collectionResponse.ts @@ -5,12 +5,14 @@ export class CollectionResponse extends BaseResponse { id: string; organizationId: string; name: string; + externalId: string; constructor(response: any) { super(response); this.id = this.getResponseProperty('Id'); this.organizationId = this.getResponseProperty('OrganizationId'); this.name = this.getResponseProperty('Name'); + this.externalId = this.getResponseProperty('ExternalId'); } } diff --git a/src/models/view/collectionView.ts b/src/models/view/collectionView.ts index 7f4e52ed90..760992ef89 100644 --- a/src/models/view/collectionView.ts +++ b/src/models/view/collectionView.ts @@ -7,6 +7,7 @@ export class CollectionView implements View, ITreeNodeObject { id: string = null; organizationId: string = null; name: string = null; + externalId: string = null; readOnly: boolean = null; constructor(c?: Collection) { @@ -17,5 +18,6 @@ export class CollectionView implements View, ITreeNodeObject { this.id = c.id; this.organizationId = c.organizationId; this.readOnly = c.readOnly; + this.externalId = c.externalId; } }