Class ToOneRelationship<T_target>

Type Parameters

Constructors

Properties

Accessors

Methods

Constructors

Properties

type: Type<T_target>

Type of the model

Accessors

  • get id(): undefined | string
  • Gets the id of the document for this relationship.

    Returns undefined | string

  • set id(newId: undefined | string): void
  • Sets the id for this relation.

    If there is a model already loaded and the newid makes the relationship invalid, it will remove the model aswell.

    Parameters

    • newId: undefined | string

    Returns void

  • get invalid(): boolean
  • Returns boolean

  • get model(): undefined | T_target
  • The loaded model

    Returns undefined | T_target

  • get modelIfValid(): undefined | T_target
  • Gets the model if it is validated against the id, or undefined otherwise.

    Returns undefined | T_target

  • get valid(): boolean
  • Whether or not the id and the model match.

    If the id is falsy, the value must be falsy too to be valid. If there is an id, then the model must be loaded and have the same id.

    Returns boolean

Methods

  • Sets the model of the relationship. The model must have an id.

    It will update the id of the relationship.

    Parameters

    Returns void