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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import {Getter, inject} from '@loopback/core';
import {
BelongsToAccessor,
HasManyThroughRepositoryFactory,
HasOneRepositoryFactory,
repository,
HasManyRepositoryFactory,
} from '@loopback/repository';
import {BaseCrudRepository, CompanyPersonaRepository, CountryRepository, UserViewRepository} from '.';
import {LogChainDataSource} from '../datasources';
import {CompanyLocation, CompanyPersona, Country, Persona, User, CompanyRegulatory} from '../models';
import {PersonaRepository} from './persona.repository';
import {CompanyRegulatoryRepository} from './company-regulatory.repository';
import {CompanyView, CompanyViewRelations} from '@logchain/models/views';
export class CompanyViewRepository extends BaseCrudRepository<CompanyView, typeof CompanyView.prototype.id, CompanyViewRelations> {
public readonly creator: BelongsToAccessor<User, typeof User.prototype.id>;
public readonly modifier: BelongsToAccessor<User, typeof User.prototype.id>;
public readonly main_contact: HasOneRepositoryFactory<User, typeof User.prototype.id>;
public readonly personas: HasManyThroughRepositoryFactory<
Persona,
typeof Persona.prototype.id,
CompanyPersona,
typeof CompanyView.prototype.id
>;
public readonly country: HasOneRepositoryFactory<Country, typeof CompanyLocation.prototype.id>;
public readonly regulations: HasManyRepositoryFactory<CompanyRegulatory, typeof CompanyView.prototype.id>;
constructor(
@inject('datasources.logchain') dataSource: LogChainDataSource,
@repository.getter('CompanyPersonaRepository')
protected comp_persona_repo_getter: Getter<CompanyPersonaRepository>,
@repository.getter('PersonaRepository')
protected persona_repo_getter: Getter<PersonaRepository>,
@repository.getter('UserViewRepository')
protected user_repo_getter: Getter<UserViewRepository>,
@repository.getter('CountryRepository')
protected country_repo_getter: Getter<CountryRepository>,
@repository.getter('CompanyRegulatoryRepository')
protected companyRegulatoryRepositoryGetter: Getter<CompanyRegulatoryRepository>,
) {
super(CompanyView, dataSource);
this.regulations = this.createHasManyRepositoryFactoryFor('regulations', companyRegulatoryRepositoryGetter);
this.registerInclusionResolver('regulations', this.regulations.inclusionResolver);
this.creator = this.createBelongsToAccessor('creator', user_repo_getter);
this.modifier = this.createBelongsToAccessor('modifier', user_repo_getter);
this.personas = this.createHasManyThroughRepositoryFactoryFor(
'personas',
persona_repo_getter,
comp_persona_repo_getter,
);
this.main_contact = this.createHasOneRepositoryFactoryFor('main_contact', user_repo_getter);
this.registerInclusionResolver('main_contact', this.main_contact.inclusionResolver);
this.country = this.createHasOneRepositoryFactoryFor('country', country_repo_getter);
this.registerInclusionResolver('country', this.country.inclusionResolver);
}
}
|