Class BelongsToLink

Represents a "BelongsTo" relationship link between entities within the ORM system. Instances of this class are used to track and manage associations where one entity belongs to another, encapsulating the connection details including the type of the foreign entity and its foreign key.

This class implements the BelongsToLinkProps interface, ensuring consistency in the properties used to describe the "BelongsTo" relationship.

Implements

Constructors

Properties

createdAt: Date

The timestamp marking when the link was created

foreignEntityType: string

The name of the entity type to which the link points (the "parent" entity in the relationship).

foreignKey: ForeignKey

The foreign key value identifying the specific instance of the foreign entity to which the link belongs. While it is a string, it represents the value of a ForeignKey attribute in the related entity.

id: string

A unique identifier for the link itself, automatically generated upon creation.

type: string

The type of the link, statically set to "BelongsToLink".

updatedAt: Date

The timestamp marking the last update to the link. Initially set to the same value as createdAt.

Methods

  • A static method to construct a BelongsToLinkProps object with specified properties, including auto-generated id and timestamp fields. This method facilitates the creation of new link instances without directly instantiating the class.

    Parameters

    • foreignEntityType: string

      The name of the entity type to which the new link will belong.

    • foreignKey: string

      The foreign key value identifying the specific instance of the foreign entity.

    Returns BelongsToLinkProps

    • A new BelongsToLinkProps object ready for use in creating or managing a "BelongsTo" relationship.

Generated using TypeDoc