All files / src/repositories regulatory-declarations.repository.ts

19.51% Statements 8/41
100% Branches 0/0
0% Functions 0/1
15.38% Lines 6/39

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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 981x 1x   1x 1x       1x           1x                                                                                                                                                                      
import { inject, Getter } from '@loopback/core';
import { repository, BelongsToAccessor, HasManyRepositoryFactory, HasOneRepositoryFactory } from '@loopback/repository';
 
import { LogChainDataSource } from '@logchain/datasources';
import {
  RegulatoryDeclarations, RegulatoryDeclarationsRelations, User, Company, Flow, CompanyRegulatory,
  RegulatoryDocuments, RegulatoryItems, RegulatoryParties, RegulatoryCargos, RegulatoryTransports, RegulatoryCustomsProcedureCodes, RegulatoryInvoices
} from '@logchain/models';
import {
  BaseCrudRepository, UserViewRepository, CompanyRepository, CompanyRegulatoryRepository, FlowRepository, RegulatoryCargosRepository,
  RegulatoryDocumentsRepository, RegulatoryItemsRepository, RegulatoryPartiesRepository,
  RegulatoryTransportsRepository, RegulatoryCustomsProcedureCodesRepository, RegulatoryInvoicesRepository
} from '.';
 
export class RegulatoryDeclarationsRepository extends BaseCrudRepository<
  RegulatoryDeclarations,
  typeof RegulatoryDeclarations.prototype.id,
  RegulatoryDeclarationsRelations
> {
 
  public readonly creator: BelongsToAccessor<User, typeof User.prototype.id>;
  public readonly modifier: BelongsToAccessor<User, typeof User.prototype.id>;
  public readonly verifier: BelongsToAccessor<User, typeof User.prototype.id>;
  public readonly submitter: BelongsToAccessor<User, typeof User.prototype.id>;
  public readonly company: BelongsToAccessor<Company, typeof Company.prototype.id>;
  public readonly flow: BelongsToAccessor<Flow, typeof Flow.prototype.id>;
  public readonly regulatory: BelongsToAccessor<CompanyRegulatory, typeof Flow.prototype.id>;
  public readonly documents: HasManyRepositoryFactory<RegulatoryDocuments, typeof RegulatoryDeclarations.prototype.id>;
  public readonly items: HasManyRepositoryFactory<RegulatoryItems, typeof RegulatoryDeclarations.prototype.id>;
  public readonly parties: HasManyRepositoryFactory<RegulatoryParties, typeof RegulatoryDeclarations.prototype.id>;
  public readonly cargo: HasOneRepositoryFactory<RegulatoryCargos, typeof RegulatoryDeclarations.prototype.id>;
  public readonly transports: HasManyRepositoryFactory<RegulatoryTransports, typeof RegulatoryDeclarations.prototype.id>;
  public readonly customsProcedureCodes: HasManyRepositoryFactory<RegulatoryCustomsProcedureCodes, typeof RegulatoryDeclarations.prototype.id>;
  public readonly invoices: HasManyRepositoryFactory<RegulatoryInvoices, typeof RegulatoryDeclarations.prototype.id>;
 
  constructor(
    @inject('datasources.logchain') dataSource: LogChainDataSource,
    @repository.getter('UserViewRepository')
    protected userRepoGetter: Getter<UserViewRepository>,
    @repository.getter('CompanyRepository')
    protected companyRepositoryGetter: Getter<CompanyRepository>,
    @repository.getter('FlowRepository')
    protected flowRepositoryGetter: Getter<FlowRepository>,
    @repository.getter('CompanyRegulatoryRepository')
    protected companyRegulatoryRepositoryGetter: Getter<CompanyRegulatoryRepository>,
    @repository.getter('RegulatoryDocumentsRepository')
    protected regulatoryDocumentsRepositoryGetter: Getter<RegulatoryDocumentsRepository>,
    @repository.getter('RegulatoryItemsRepository')
    protected regulatoryItemsRepositoryGetter: Getter<RegulatoryItemsRepository>,
    @repository.getter('RegulatoryPartiesRepository')
    protected regulatoryPartiesRepositoryGetter: Getter<RegulatoryPartiesRepository>,
    @repository.getter('RegulatoryCargosRepository')
    protected regulatoryCargosRepositoryGetter: Getter<RegulatoryCargosRepository>,
    @repository.getter('RegulatoryTransportsRepository')
    protected regulatoryTransportsRepositoryGetter: Getter<RegulatoryTransportsRepository>,
    @repository.getter('RegulatoryCustomsProcedureCodesRepository')
    protected regulatoryCustomsProcedureCodesRepositoryGetter: Getter<RegulatoryCustomsProcedureCodesRepository>,
    @repository.getter('RegulatoryInvoicesRepository')
    protected regulatoryInvoicesRepositoryGetter: Getter<RegulatoryInvoicesRepository>,
  ) {
    super(RegulatoryDeclarations, dataSource);
    this.invoices = this.createHasManyRepositoryFactoryFor('invoices', regulatoryInvoicesRepositoryGetter,);
    this.registerInclusionResolver('invoices', this.invoices.inclusionResolver);
 
    this.customsProcedureCodes = this.createHasManyRepositoryFactoryFor('customsProcedureCodes', regulatoryCustomsProcedureCodesRepositoryGetter,);
    this.registerInclusionResolver('customsProcedureCodes', this.customsProcedureCodes.inclusionResolver);
 
    this.transports = this.createHasManyRepositoryFactoryFor('transports', regulatoryTransportsRepositoryGetter);
    this.registerInclusionResolver('transports', this.transports.inclusionResolver);
 
    this.cargo = this.createHasOneRepositoryFactoryFor('cargo', regulatoryCargosRepositoryGetter);
    this.registerInclusionResolver('cargo', this.cargo.inclusionResolver);
 
    this.parties = this.createHasManyRepositoryFactoryFor('parties', regulatoryPartiesRepositoryGetter,);
    this.registerInclusionResolver('parties', this.parties.inclusionResolver);
 
    this.items = this.createHasManyRepositoryFactoryFor('items', regulatoryItemsRepositoryGetter,);
    this.registerInclusionResolver('items', this.items.inclusionResolver);
 
    this.documents = this.createHasManyRepositoryFactoryFor('documents', regulatoryDocumentsRepositoryGetter,);
    this.registerInclusionResolver('documents', this.documents.inclusionResolver);
 
    this.regulatory = this.createBelongsToAccessor('regulatory', companyRegulatoryRepositoryGetter,);
 
    this.flow = this.createBelongsToAccessor('flow', flowRepositoryGetter,);
 
    this.company = this.createBelongsToAccessor('company', companyRepositoryGetter);
 
    this.creator = this.createBelongsToAccessor('creator', userRepoGetter);
 
    this.modifier = this.createBelongsToAccessor('modifier', userRepoGetter);
 
    this.submitter = this.createBelongsToAccessor('submitter', userRepoGetter);
 
    this.verifier = this.createBelongsToAccessor('verifier', userRepoGetter);
  }
}