@fluentity/core
    Preparing search index...

    Variable BelongsToConst

    BelongsTo: (
        model: () => Constructor<Model<any>>,
        resource?: string,
    ) => PropertyDecoratorType = HasOne

    Alias for HasOne decorator. Used for better semantic meaning in certain relationship contexts.

    Type declaration

      • (model: () => Constructor<Model<any>>, resource?: string): PropertyDecoratorType
      • Decorator for creating a has-one relationship between models. Sets up a one-to-one relationship where a model has exactly one related model.

        Parameters

        • model: () => Constructor<Model<any>>

          Factory function that returns the related model constructor

        • Optionalresource: string

          Optional custom resource name for the relation

        Returns PropertyDecoratorType

        A property decorator function

        class User {
        @HasOne(() => Profile)
        profile: Profile;
        }
    class Post {
    @BelongsTo(() => User)
    author: User;
    }