11import { Messaging } from 'Messaging/Messaging'
22import BitcoinCore = require( 'bitcoin-core' )
33import { Container } from 'inversify'
4- import { Db , MongoClient } from 'mongodb'
4+ import { Collection , Db , MongoClient } from 'mongodb'
55import * as Pino from 'pino'
66import { pick } from 'ramda'
77
@@ -13,6 +13,7 @@ import { HealthController, HealthControllerConfiguration } from './HealthControl
1313import { HealthDAO } from './HealthDAO'
1414import { HealthService , HealthServiceConfiguration } from './HealthService'
1515import { IPFS , IPFSConfiguration } from './IPFS'
16+ import { IPFSDirectoryHashDAO } from './IPFSDirectoryHashDAO'
1617import { Router } from './Router'
1718
1819export interface HealthConfiguration
@@ -35,6 +36,7 @@ export class Health {
3536 private cron : HealthService
3637 private messaging : Messaging
3738 private router : Router
39+ private ipfsDirectoryHashInfoCollection : Collection
3840
3941 constructor ( configuration : HealthConfiguration ) {
4042 this . configuration = configuration
@@ -46,6 +48,8 @@ export class Health {
4648 this . mongoClient = await MongoClient . connect ( this . configuration . dbUrl )
4749 this . dbConnection = await this . mongoClient . db ( )
4850
51+ this . ipfsDirectoryHashInfoCollection = this . dbConnection . collection ( 'ipfsDirectoryHashInfo' )
52+
4953 const exchangesMessaging = pick (
5054 [ 'getHealth' , 'claimsNotDownloaded' ] ,
5155 this . configuration . exchanges ,
@@ -89,6 +93,10 @@ export class Health {
8993 this . container . bind < HealthServiceConfiguration > ( 'HealthServiceConfiguration' ) . toConstantValue ( {
9094 healthIntervalInSeconds : this . configuration . healthIntervalInSeconds ,
9195 } )
96+ this . container
97+ . bind < Collection > ( 'IPFSDirectoryHashInfoCollection' )
98+ . toConstantValue ( this . ipfsDirectoryHashInfoCollection )
99+
92100 this . container . bind < ExchangeConfiguration > ( 'ExchangeConfiguration' ) . toConstantValue ( this . configuration . exchanges )
93101 this . container . bind < Messaging > ( 'Messaging' ) . toConstantValue ( this . messaging )
94102 this . container . bind < Router > ( 'Router' ) . to ( Router )
@@ -101,5 +109,6 @@ export class Health {
101109 feeEstimateMinTargetBlock : this . configuration . feeEstimateMinTargetBlock ,
102110 } )
103111 this . container . bind < HealthDAO > ( 'HealthDAO' ) . to ( HealthDAO )
112+ this . container . bind < IPFSDirectoryHashDAO > ( 'IPFSDirectoryHashDAO' ) . to ( IPFSDirectoryHashDAO )
104113 }
105114}
0 commit comments