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;
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;
}
}

View File

@ -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<CollectionView> {

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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');
}
}

View File

@ -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;
}
}