UNPKG

1.38 kBTypeScriptView Raw
1import { Getter } from '@loopback/core';
2import { DataObject, Options } from '../../common-types';
3import { Entity } from '../../model';
4import { EntityCrudRepository } from '../../repositories';
5/**
6 * CRUD operations for a target repository of a ReferencesMany relation
7 */
8export interface ReferencesManyRepository<Target extends Entity> {
9 /**
10 * Gets the target model instance
11 * @param options
12 * @returns A promise resolved with the target object or rejected
13 * with an EntityNotFoundError when target model instance was not found.
14 */
15 get(options?: Options): Promise<Target>;
16}
17export declare class DefaultReferencesManyRepository<TargetEntity extends Entity, TargetIds, TargetRepository extends EntityCrudRepository<TargetEntity, TargetIds>> implements ReferencesManyRepository<TargetEntity> {
18 getTargetRepository: Getter<TargetRepository>;
19 constraint: DataObject<TargetEntity>;
20 /**
21 * Constructor of DefaultReferencesManyEntityCrudRepository
22 * @param getTargetRepository - the getter of the related target model repository instance
23 * @param constraint - the key value pair representing foreign key name to constrain
24 * the target repository instance
25 */
26 constructor(getTargetRepository: Getter<TargetRepository>, constraint: DataObject<TargetEntity>);
27 get(options?: Options): Promise<TargetEntity>;
28}