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 { Multiplicity } from '../enums/Multiplicity';
import { type FieldStatus } from '../enums/FieldStatus';
import { type FieldType } from '../enums/FieldType';
import { type Multiplicity } from '../enums/Multiplicity';
import { Field } from './Field';
import { type ListValue } from './ListValue';
@@ -26,37 +28,29 @@ export class ListField extends Field {
* @param {number} id - The id of the list field.
* @param {number} appId - The id of the app the list field belongs to.
* @param {string} name - The name of the list field.
* @param {string} type - The type of the list field.
* @param {string} status - The status of the list field.
* @param {FieldType} type - The type of the list field.
* @param {FieldStatus} status - The status of the list field.
* @param {boolean} isRequired - Whether the list field is required.
* @param {boolean} isUnique - Whether the list field is unique.
* @param {string} multiplicity - The multiplicity of the list field.
* @param {Multiplicity} multiplicity - The multiplicity of the list field.
* @param {number} listId - The id of the list the list field belongs to.
* @param {ListValue[]} values - The list values of the list field.
* @returns {ListField} - A new ListField.
* @throws {Error} - Throws an error if the multiplicity is not a valid Multiplicity.
*/
constructor(
id: number,
appId: number,
name: string,
type: string,
status: string,
type: FieldType,
status: FieldStatus,
isRequired: boolean,
isUnique: boolean,
multiplicity: string,
multiplicity: Multiplicity,
listId: number,
values: ListValue[]
) {
super(id, appId, name, type, status, isRequired, isUnique);
if (Multiplicity[multiplicity] === undefined) {
throw new Error(
`The multiplicity ${multiplicity} is not a valid Multiplicity.`
);
}
this.multiplicity = Multiplicity[multiplicity];
this.multiplicity = multiplicity;
this.listId = listId;
this.values = values;
}