Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 1x 1x 1x 1x 1x 1x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x | import {Getter, inject} from '@loopback/core';
import {BelongsToAccessor, HasManyRepositoryFactory, HasOneRepositoryFactory, repository} from '@loopback/repository';
import {CompanyRepository, CountryRepository, FlowRepository, TradeLaneFlowRepository, UserRepository} from '.';
import {LogChainDataSource} from '../datasources';
import {
Company,
CompanyLocation,
Country,
Flow,
TradeLane,
TradeLaneFlow,
TradeLaneRelations,
User,
} from '../models';
import {BaseCrudRepository} from './base-crud.repository.base';
export class TradeLaneRepository extends BaseCrudRepository<
TradeLane,
typeof TradeLane.prototype.id,
TradeLaneRelations
> {
public readonly creator: BelongsToAccessor<User, typeof User.prototype.id>;
public readonly modifier: BelongsToAccessor<User, typeof User.prototype.id>;
public readonly pol_country: HasOneRepositoryFactory<Country, typeof CompanyLocation.prototype.id>;
public readonly pod_country: HasOneRepositoryFactory<Country, typeof CompanyLocation.prototype.id>;
public readonly flows: HasManyRepositoryFactory<Flow, typeof TradeLane.prototype.id>;
public readonly company: BelongsToAccessor<Company, typeof User.prototype.id>;
public readonly trade_lane_flow: HasOneRepositoryFactory<TradeLaneFlow, typeof TradeLaneFlow.prototype.id>;
constructor(
@inject('datasources.logchain') dataSource: LogChainDataSource,
@repository.getter('CountryRepository')
protected country_repo_getter: Getter<CountryRepository>,
@repository.getter('UserRepository')
protected user_repo_getter: Getter<UserRepository>,
@repository.getter('FlowRepository')
protected flow_repo_getter: Getter<FlowRepository>,
@repository.getter('CompanyRepository')
protected comp_repo_getter: Getter<CompanyRepository>,
@repository.getter('TradeLaneFlowRepository')
protected trade_lane_flow_repo_getter: Getter<TradeLaneFlowRepository>,
) {
super(TradeLane, dataSource);
// register creator relation
this.creator = this.createBelongsToAccessor('creator', user_repo_getter);
// register modifier relation
this.modifier = this.createBelongsToAccessor('modifier', user_repo_getter);
// POL Country
this.pol_country = this.createHasOneRepositoryFactoryFor('pol_country', country_repo_getter);
this.registerInclusionResolver('pol_country', this.pol_country.inclusionResolver);
// POD Country
this.pod_country = this.createHasOneRepositoryFactoryFor('pod_country', country_repo_getter);
this.registerInclusionResolver('pod_country', this.pod_country.inclusionResolver);
// Trade lane flow
this.trade_lane_flow = this.createHasOneRepositoryFactoryFor('trade_lane_flow', trade_lane_flow_repo_getter);
this.registerInclusionResolver('trade_lane_flow', this.trade_lane_flow.inclusionResolver);
// Flow
this.flows = this.createHasManyRepositoryFactoryFor('flows', flow_repo_getter);
this.registerInclusionResolver('flows', this.flows.inclusionResolver);
// Company
this.company = this.createBelongsToAccessor('company', comp_repo_getter);
}
}
|