All files / src/repositories flow.view.repository.ts

100% Statements 32/32
100% Branches 0/0
100% Functions 1/1
100% Lines 30/30

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 98 99 100 1011x 1x 1x                   1x                       1x     1x                         48x   48x   48x   48x   48x   48x   48x   48x   48x     48x 48x       48x 48x       48x       48x       48x       48x 48x       48x 48x       48x 48x       48x 48x      
import {FlowView} from '@logchain/models/views';
import {Getter, inject} from '@loopback/core';
import {BelongsToAccessor, HasManyRepositoryFactory, HasOneRepositoryFactory, repository} from '@loopback/repository';
import {
  CompanyRepository,
  FlowDefaultRepository,
  FlowGroupRepository,
  FlowJourneyPointRepository,
  FlowPersonaRepository,
  TradeLaneRepository,
  UserRepository,
} from '.';
import {LogChainDataSource} from '../datasources';
import {
  Company,
  FlowDefault,
  FlowDiscussion,
  FlowGroup,
  FlowJourneyPoint,
  FlowPersona,
  FlowRelations,
  TradeLane,
  User,
} from '../models';
import {BaseCrudRepository} from './base-crud.repository.base';
import {FlowDiscussionRepository} from './flow-discussion.repository';
 
export class FlowViewRepository extends BaseCrudRepository<FlowView, typeof FlowView.prototype.id, FlowRelations> {
  public readonly flow_default: HasOneRepositoryFactory<FlowDefault, typeof FlowView.prototype.id>;
  public readonly trade_lane: HasOneRepositoryFactory<TradeLane, typeof FlowView.prototype.id>;
  public readonly creator: BelongsToAccessor<User, typeof User.prototype.id>;
  public readonly company: BelongsToAccessor<Company, typeof Company.prototype.id>;
  public readonly modifier: BelongsToAccessor<User, typeof User.prototype.id>;
  public readonly groups: HasManyRepositoryFactory<FlowGroup, typeof FlowView.prototype.id>;
  public readonly journey_points: HasManyRepositoryFactory<FlowJourneyPoint, typeof FlowView.prototype.id>;
  public readonly personas: HasManyRepositoryFactory<FlowPersona, typeof FlowView.prototype.id>;
  public readonly histories: HasManyRepositoryFactory<FlowDiscussion, typeof FlowView.prototype.id>;
  constructor(
    @inject('datasources.logchain') dataSource: LogChainDataSource,
    @repository.getter('FlowGroupRepository')
    protected flow_group_repo_getter: Getter<FlowGroupRepository>,
    @repository.getter('FlowPersonaRepository')
    protected flow_persona_repo_getter: Getter<FlowPersonaRepository>,
    @repository.getter('FlowJourneyPointRepository')
    protected flow_journey_point_repo_getter: Getter<FlowJourneyPointRepository>,
    @repository.getter('TradeLaneRepository')
    protected trade_lane_repo_getter: Getter<TradeLaneRepository>,
    @repository.getter('UserRepository')
    protected user_repo_getter: Getter<UserRepository>,
    @repository.getter('CompanyRepository')
    protected company_repo_getter: Getter<CompanyRepository>,
    @repository.getter('FlowDefaultRepository')
    protected flow_default_repo_getter: Getter<FlowDefaultRepository>,
    @repository.getter('FlowDiscussionRepository')
    protected flow_discussion_repo_getter: Getter<FlowDiscussionRepository>,
  ) {
    super(FlowView, dataSource);
 
    // ------- FLOW DEFAULT ------- //
    this.flow_default = this.createHasOneRepositoryFactoryFor('flow_default', flow_default_repo_getter);
    this.registerInclusionResolver('flow_default', this.flow_default.inclusionResolver);
    // ------- FLOW DEFAULT ------- //
 
    // ------- TRADE LANE   ------- //
    this.trade_lane = this.createHasOneRepositoryFactoryFor('trade_lane', trade_lane_repo_getter);
    this.registerInclusionResolver('trade_lane', this.trade_lane.inclusionResolver);
    // ------- TRADE LANE   ------- //
 
    // ------- CREATOR      ------- //
    this.creator = this.createBelongsToAccessor('creator', user_repo_getter);
    // ------- CREATOR      ------- //
 
    // ------- COMPANY CREATOR      ------- //
    this.company = this.createBelongsToAccessor('company', company_repo_getter);
    // ------- COMPANY CREATOR      ------- //
 
    // ------- MODIFIER     ------- //
    this.modifier = this.createBelongsToAccessor('modifier', user_repo_getter);
    // ------- MODIFIER     ------- //
 
    // ------- GROUPS     ------- //
    this.groups = this.createHasManyRepositoryFactoryFor('groups', flow_group_repo_getter);
    this.registerInclusionResolver('groups', this.groups.inclusionResolver);
    // ------- GROUPS     ------- //
 
    // ------- JOURNEY POINTS     ------- //
    this.journey_points = this.createHasManyRepositoryFactoryFor('journey_points', flow_journey_point_repo_getter);
    this.registerInclusionResolver('journey_points', this.journey_points.inclusionResolver);
    // ------- JOURNEY POINTS     ------- //
 
    // ------- REFERENCE PERSONAS  ------- //
    this.personas = this.createHasManyRepositoryFactoryFor('personas', flow_persona_repo_getter);
    this.registerInclusionResolver('personas', this.personas.inclusionResolver);
    // ------- REFERENCE PERSONAS  ------- //
 
    // -------- FLOW DISCUSSION ------- //
    this.histories = this.createHasManyRepositoryFactoryFor('histories', flow_discussion_repo_getter);
    this.registerInclusionResolver('histories', this.histories.inclusionResolver);
  }
}