feat: begin working on implementing record methods

This commit is contained in:
StevanFreeborn
2023-02-09 22:21:20 -06:00
parent 3b3e210920
commit fde8b50717
30 changed files with 629 additions and 286 deletions
+10 -16
View File
@@ -1,4 +1,6 @@
import { FormulaOutputType } from '../enums/FormulaOutputType';
import { type FieldStatus } from '../enums/FieldStatus';
import { type FieldType } from '../enums/FieldType';
import { type FormulaOutputType } from '../enums/FormulaOutputType';
import { Field } from './Field';
import { type ListValue } from './ListValue';
@@ -21,35 +23,27 @@ export class FormulaField extends Field {
* @param {number} id - The id of the formula field.
* @param {number} appId - The id of the app the formula field belongs to.
* @param {string} name - The name of the formula field.
* @param {string} type - The type of the formula field.
* @param {string} status - The status of the formula field.
* @param {FieldType} type - The type of the formula field.
* @param {FieldStatus} status - The status of the formula field.
* @param {boolean} isRequired - Whether the formula field is required.
* @param {boolean} isUnique - Whether the formula field is unique.
* @param {string} outputType - The output type of the formula field.
* @param {FormulaOutputType} outputType - The output type of the formula field.
* @param {ListValue[]} values - The list values of the formula field.
* @returns {FormulaField} - A new FormulaField.
* @throws {Error} - Throws an error if the outputType is not a valid FormulaOutputType.
*/
constructor(
id: number,
appId: number,
name: string,
type: string,
status: string,
type: FieldType,
status: FieldStatus,
isRequired: boolean,
isUnique: boolean,
outputType: string,
outputType: FormulaOutputType,
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.outputType = outputType;
this.values = values;
}
}