mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-consumer.git
synced 2026-09-21 16:52:03 -07:00
Wired /bch REST API to BCH use-case lib
This commit is contained in:
@@ -42,9 +42,10 @@ class BchRESTControllerLib {
|
||||
async getStatus (ctx) {
|
||||
try {
|
||||
// const users = await _this.useCases.user.getAllUsers()
|
||||
const status = {
|
||||
test: 'test'
|
||||
}
|
||||
// const status = {
|
||||
// test: 'test'
|
||||
// }
|
||||
const status = await this.useCases.bch.getStatus()
|
||||
|
||||
ctx.body = { status }
|
||||
} catch (err) {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
This library contains business-logic for dealing with BCH wallet service
|
||||
providers. Most of these functions are called by the /bch REST API endpoints.
|
||||
*/
|
||||
|
||||
// const UserEntity = require('../entities/user')
|
||||
const { wlogger } = require('../adapters/wlogger')
|
||||
|
||||
class BchUseCases {
|
||||
constructor (localConfig = {}) {
|
||||
// console.log('User localConfig: ', localConfig)
|
||||
this.adapters = localConfig.adapters
|
||||
if (!this.adapters) {
|
||||
throw new Error(
|
||||
'Instance of adapters must be passed in when instantiating User Use Cases library.'
|
||||
)
|
||||
}
|
||||
|
||||
// Encapsulate dependencies
|
||||
// this.UserEntity = new UserEntity()
|
||||
// this.UserModel = this.adapters.localdb.Users
|
||||
}
|
||||
|
||||
async getStatus () {
|
||||
try {
|
||||
const status = {
|
||||
test: 'test'
|
||||
}
|
||||
|
||||
return status
|
||||
} catch (err) {
|
||||
// console.log('createUser() error: ', err)
|
||||
wlogger.error('Error in use-cases/bch.js/getStatus()')
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BchUseCases
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
const UserUseCases = require('./user')
|
||||
const BchUseCases = require('./bch')
|
||||
|
||||
class UseCases {
|
||||
constructor (localConfig = {}) {
|
||||
@@ -17,6 +18,7 @@ class UseCases {
|
||||
|
||||
// console.log('use-cases/index.js localConfig: ', localConfig)
|
||||
this.user = new UserUseCases(localConfig)
|
||||
this.bch = new BchUseCases(localConfig)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user