Added a type to OtherInformation

This commit is contained in:
Giuseppe Digilio
2018-12-27 17:47:51 +01:00
parent 5bbea16265
commit f9c69b7441
2 changed files with 7 additions and 12 deletions

View File

@@ -1,41 +1,32 @@
import { IntegrationModel } from './integration.model';
import { autoserialize } from 'cerialize';
import { isNotEmpty } from '../../../shared/empty.util';
import { PLACEHOLDER_PARENT_METADATA } from '../../../shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
import { OtherInformation } from '../../../shared/form/builder/models/form-field-metadata-value.model';
export class AuthorityValue extends IntegrationModel {
@autoserialize
id: string;
@autoserialize
display: string;
@autoserialize
value: string;
@autoserialize
otherInformation: any;
otherInformation: OtherInformation;
@autoserialize
language: string;
@autoserialize
hasAuthority(): boolean {
return isNotEmpty(this.id);
}
@autoserialize
hasValue(): boolean {
return isNotEmpty(this.value);
}
@autoserialize
hasOtherInformation(): boolean {
return isNotEmpty(this.otherInformation);
}
@autoserialize
hasPlaceholder() {
return this.hasValue() && this.value === PLACEHOLDER_PARENT_METADATA;
}

View File

@@ -2,6 +2,10 @@ import { isEmpty, isNotEmpty, isNotNull } from '../../../empty.util';
import { ConfidenceType } from '../../../../core/integration/models/confidence-type';
import { PLACEHOLDER_PARENT_METADATA } from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
export interface OtherInformation {
[name: string]: string
}
export class FormFieldMetadataValueObject {
metadata?: string;
value: any;
@@ -12,7 +16,7 @@ export class FormFieldMetadataValueObject {
place: number;
closed: boolean;
label: string;
otherInformation: any;
otherInformation: OtherInformation;
constructor(value: any = null,
language: any = null,