Page Contents

Home > @loopback/sequelize > SequelizeCrudRepository > createHasOneRepositoryFactoryFor

SequelizeCrudRepository.createHasOneRepositoryFactoryFor() method

Function to create a constrained hasOne relation repository factory

Signature:

protected createHasOneRepositoryFactoryFor<Target extends Entity, TargetID, ForeignKeyType>(relationName: string, targetRepositoryGetter: Getter<EntityCrudRepository<Target, TargetID>> | {
        [repoType: string]: Getter<EntityCrudRepository<Target, TargetID>>;
    }): HasOneRepositoryFactory<Target, ForeignKeyType>;

Parameters

Parameter Type Description
relationName string Name of the relation defined on the source model
targetRepositoryGetter Getter<EntityCrudRepository<Target, TargetID>> | { [repoType: string]: Getter<EntityCrudRepository<Target, TargetID>>; }  

Returns:

HasOneRepositoryFactory<Target, ForeignKeyType>