feat: begin working on implementing record methods
This commit is contained in:
@@ -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';
|
||||
|
||||
/**
|
||||
@@ -20,35 +22,27 @@ export class ReferenceField extends Field {
|
||||
* @param {number} id - The id of the reference field.
|
||||
* @param {number} appId - The id of the app the reference field belongs to.
|
||||
* @param {string} name - The name of the reference field.
|
||||
* @param {string} type - The type of the reference field.
|
||||
* @param {string} status - The status of the reference field.
|
||||
* @param {FieldType} type - The type of the reference field.
|
||||
* @param {FieldStatus} status - The status of the reference field.
|
||||
* @param {boolean} isRequired - Whether the reference field is required.
|
||||
* @param {boolean} isUnique - Whether the reference field is unique.
|
||||
* @param {string} multiplicity - The multiplicity of the reference field.
|
||||
* @param {Multiplicity} multiplicity - The multiplicity of the reference field.
|
||||
* @param {number} referencedAppId - The id of the app the reference field references.
|
||||
* @returns {ReferenceField} - A new ReferenceField.
|
||||
* @throws {Error} - Throws an error if the multiplicity is not a valid Multiplicity.jjkdleroritlasaxmvjd
|
||||
*/
|
||||
constructor(
|
||||
id: number,
|
||||
appId: number,
|
||||
name: string,
|
||||
type: string,
|
||||
status: string,
|
||||
type: FieldType,
|
||||
status: FieldStatus,
|
||||
isRequired: boolean,
|
||||
isUnique: boolean,
|
||||
multiplicity: string,
|
||||
multiplicity: Multiplicity,
|
||||
referencedAppId: number
|
||||
) {
|
||||
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.referencedAppId = referencedAppId;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user