All files / src/observers validator.observer.ts

100% Statements 12/12
100% Branches 0/0
75% Functions 3/4
100% Lines 10/10

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 451x 1x   1x 1x             1x     1x   1x   1x               1x 1x                                  
import { Application, CoreBindings, inject, lifeCycleObserver, LifeCycleObserver, } from '@loopback/core';
import { repository } from '@loopback/repository';
 
import { CalistaDropdownRepository, LocodeRepository } from '@logchain/repositories';
import { ActionsValidator, RegulatoryDeclarationsValidator } from '@logchain/validators';
 
/**
 * This class will be bound to the application as a `LifeCycleObserver` during
 * `boot`
 */
@lifeCycleObserver('')
export class CheckObserver implements LifeCycleObserver {
  constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    private app: Application,
    @repository(CalistaDropdownRepository)
    public calistaDropdownRepo: CalistaDropdownRepository,
    @repository(LocodeRepository)
    public locodeRepo: LocodeRepository,
  ) { }
 
  /**
   * This method will be invoked when the application initializes. It will be
   * called at most once for a given application instance.
   */
  async init(): Promise<void> {
    new RegulatoryDeclarationsValidator(this.app, this.calistaDropdownRepo, this.locodeRepo);
    new ActionsValidator(this.app);
  }
 
  /**
   * This method will be invoked when the application starts.
   */
  async start(): Promise<void> {
    // Add your logic for start
  }
 
  /**
   * This method will be invoked when the application stops.
   */
  async stop(): Promise<void> {
    // Add your logic for stop
  }
}