[Linked Fields] Fix QA feedback (#542)

* Fix bug overwriting custom field types

* Add linkedId to export model for CLI
This commit is contained in:
Thomas Rittson 2021-11-12 05:59:01 +10:00 committed by GitHub
parent b99103d3f7
commit e02e663ce1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -118,7 +118,7 @@ export class AddEditCustomFieldsComponent implements OnChanges {
} }
this.cipher.fields this.cipher.fields
.filter(f => f.type = FieldType.Linked) .filter(f => f.type === FieldType.Linked)
.forEach(f => f.linkedId = this.linkedFieldOptions[0].value); .forEach(f => f.linkedId = this.linkedFieldOptions[0].value);
} }
} }

View File

@ -1,4 +1,5 @@
import { FieldType } from '../../enums/fieldType'; import { FieldType } from '../../enums/fieldType';
import { LinkedIdType } from '../../enums/linkedIdType';
import { FieldView } from '../view/fieldView'; import { FieldView } from '../view/fieldView';
@ -18,6 +19,7 @@ export class Field {
view.type = req.type; view.type = req.type;
view.value = req.value; view.value = req.value;
view.name = req.name; view.name = req.name;
view.linkedId = req.linkedId;
return view; return view;
} }
@ -25,12 +27,14 @@ export class Field {
domain.type = req.type; domain.type = req.type;
domain.value = req.value != null ? new EncString(req.value) : null; domain.value = req.value != null ? new EncString(req.value) : null;
domain.name = req.name != null ? new EncString(req.name) : null; domain.name = req.name != null ? new EncString(req.name) : null;
domain.linkedId = req.linkedId;
return domain; return domain;
} }
name: string; name: string;
value: string; value: string;
type: FieldType; type: FieldType;
linkedId: LinkedIdType;
constructor(o?: FieldView | FieldDomain) { constructor(o?: FieldView | FieldDomain) {
if (o == null) { if (o == null) {
@ -45,5 +49,6 @@ export class Field {
this.value = o.value?.encryptedString; this.value = o.value?.encryptedString;
} }
this.type = o.type; this.type = o.type;
this.linkedId = o.linkedId;
} }
} }