fix: implement formula field, list field, and reference field as chilrden of the field class. fix: when converting api response data to appropriate field response make sure json field objects are converted to correct field class based upon type.

This commit is contained in:
StevanFreeborn
2023-02-04 22:00:19 -06:00
parent 48de5ec3b8
commit e6eae35e03
11 changed files with 717 additions and 34 deletions
+31
View File
@@ -0,0 +1,31 @@
import { FormulaOutputType } from '../enums/FormulaOutputType';
import { Field } from './Field';
import { type ListValue } from './ListValue';
export class FormulaField extends Field {
public outputType: FormulaOutputType;
public values: ListValue[];
constructor(
id: number,
appId: number,
name: string,
type: string,
status: string,
isRequired: boolean,
isUnique: boolean,
outputType: string,
values: ListValue[]
) {
super(id, appId, name, type, status, isRequired, isUnique);
if (FormulaOutputType[outputType] === undefined) {
throw new Error(
`The outputType ${outputType} is not a valid FormulaOutputType.`
);
}
this.outputType = FormulaOutputType[outputType];
this.values = values;
}
}