All files / src/repositories flow-reference.repository.ts

80% Statements 8/10
100% Branches 0/0
50% Functions 1/2
75% Lines 6/8

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 311x 1x 1x 1x   1x           48x                                      
import {inject} from '@loopback/core';
import {LogChainDataSource} from '../datasources';
import {FlowReference, FlowReferenceRelations} from '../models';
import {BaseCrudRepository} from './base-crud.repository.base';
 
export class FlowReferenceRepository extends BaseCrudRepository<
  FlowReference,
  typeof FlowReference.prototype.id,
  FlowReferenceRelations
> {
  constructor(@inject('datasources.logchain') dataSource: LogChainDataSource) {
    super(FlowReference, dataSource);
  }
 
  /**
   * Find reference documents by journey id.
   * @param flow_id The flow id.
   * @param step_id The step id.
   */
  async findRefDocumentsByJourneyId(
    flow_id: number,
    step_id: number,
  ): Promise<FlowReference[]> {
    const docs = await this.execute(
      `SELECT * FROM get_ref_documents_for_journey_point ( FALSE, $1, $2 );`,
      [flow_id, step_id],
    );
    return docs as FlowReference[];
  }
}