collection externalId

This commit is contained in:
Kyle Spearrin 2019-03-07 15:17:58 -05:00
parent 3b3b71d841
commit 79fea92b81
6 changed files with 15 additions and 1 deletions

View File

@ -4,12 +4,14 @@ export class CollectionData {
id: string; id: string;
organizationId: string; organizationId: string;
name: string; name: string;
externalId: string;
readOnly: boolean; readOnly: boolean;
constructor(response: CollectionDetailsResponse) { constructor(response: CollectionDetailsResponse) {
this.id = response.id; this.id = response.id;
this.organizationId = response.organizationId; this.organizationId = response.organizationId;
this.name = response.name; this.name = response.name;
this.externalId = response.externalId;
this.readOnly = response.readOnly; this.readOnly = response.readOnly;
} }
} }

View File

@ -9,6 +9,7 @@ export class Collection extends Domain {
id: string; id: string;
organizationId: string; organizationId: string;
name: CipherString; name: CipherString;
externalId: string;
readOnly: boolean; readOnly: boolean;
constructor(obj?: CollectionData, alreadyEncrypted: boolean = false) { constructor(obj?: CollectionData, alreadyEncrypted: boolean = false) {
@ -21,8 +22,9 @@ export class Collection extends Domain {
id: null, id: null,
organizationId: null, organizationId: null,
name: null, name: null,
externalId: null,
readOnly: null, readOnly: null,
}, alreadyEncrypted, ['id', 'organizationId', 'readOnly']); }, alreadyEncrypted, ['id', 'organizationId', 'externalId', 'readOnly']);
} }
decrypt(): Promise<CollectionView> { decrypt(): Promise<CollectionView> {

View File

@ -5,11 +5,13 @@ export class Collection {
const req = new Collection(); const req = new Collection();
req.organizationId = '00000000-0000-0000-0000-000000000000'; req.organizationId = '00000000-0000-0000-0000-000000000000';
req.name = 'Collection name'; req.name = 'Collection name';
req.externalId = null;
return req; return req;
} }
static toView(req: Collection, view = new CollectionView()) { static toView(req: Collection, view = new CollectionView()) {
view.name = req.name; view.name = req.name;
view.externalId = req.externalId;
if (view.organizationId == null) { if (view.organizationId == null) {
view.organizationId = req.organizationId; view.organizationId = req.organizationId;
} }
@ -18,10 +20,12 @@ export class Collection {
organizationId: string; organizationId: string;
name: string; name: string;
externalId: string;
// Use build method instead of ctor so that we can control order of JSON stringify for pretty print // Use build method instead of ctor so that we can control order of JSON stringify for pretty print
build(o: CollectionView) { build(o: CollectionView) {
this.organizationId = o.organizationId; this.organizationId = o.organizationId;
this.name = o.name; this.name = o.name;
this.externalId = o.externalId;
} }
} }

View File

@ -4,6 +4,7 @@ import { SelectionReadOnlyRequest } from './selectionReadOnlyRequest';
export class CollectionRequest { export class CollectionRequest {
name: string; name: string;
externalId: string;
groups: SelectionReadOnlyRequest[] = []; groups: SelectionReadOnlyRequest[] = [];
constructor(collection?: Collection) { constructor(collection?: Collection) {
@ -11,5 +12,6 @@ export class CollectionRequest {
return; return;
} }
this.name = collection.name ? collection.name.encryptedString : null; this.name = collection.name ? collection.name.encryptedString : null;
this.externalId = collection.externalId;
} }
} }

View File

@ -5,12 +5,14 @@ export class CollectionResponse extends BaseResponse {
id: string; id: string;
organizationId: string; organizationId: string;
name: string; name: string;
externalId: string;
constructor(response: any) { constructor(response: any) {
super(response); super(response);
this.id = this.getResponseProperty('Id'); this.id = this.getResponseProperty('Id');
this.organizationId = this.getResponseProperty('OrganizationId'); this.organizationId = this.getResponseProperty('OrganizationId');
this.name = this.getResponseProperty('Name'); this.name = this.getResponseProperty('Name');
this.externalId = this.getResponseProperty('ExternalId');
} }
} }

View File

@ -7,6 +7,7 @@ export class CollectionView implements View, ITreeNodeObject {
id: string = null; id: string = null;
organizationId: string = null; organizationId: string = null;
name: string = null; name: string = null;
externalId: string = null;
readOnly: boolean = null; readOnly: boolean = null;
constructor(c?: Collection) { constructor(c?: Collection) {
@ -17,5 +18,6 @@ export class CollectionView implements View, ITreeNodeObject {
this.id = c.id; this.id = c.id;
this.organizationId = c.organizationId; this.organizationId = c.organizationId;
this.readOnly = c.readOnly; this.readOnly = c.readOnly;
this.externalId = c.externalId;
} }
} }