import { Repository } from 'typeorm' ; import { InjectRepository } from '@nestjs/typeorm' ; import { BlockchainProperties } from './blockchain-properties.entity' ; import { BlockchainPropertiesDTO } from './blockchain-properties.dto' ; export class BlockchainPropertiesService { constructor ( @ InjectRepository ( BlockchainProperties ) private readonly repository ) { } public async create ( netId , registry , issuer , rpcNode , platformOperatorPrivateKey , rpcNodeFallback ? , privateIssuer ? ) { const blockchain = this . repository . create ( { netId , registry , issuer , rpcNode , rpcNodeFallback , platformOperatorPrivateKey , privateIssuer } ) ; return this . repository . save ( blockchain ) ; } public async get ( ) { const [ blockchainProperties ] = await this . repository . find ( ) ; return blockchainProperties ; } public async dto ( ) { const [ blockchainProperties ] = await this . repository . find ( ) ; return { netId : blockchainProperties . netId , registry : blockchainProperties . registry , issuer : blockchainProperties . issuer , privateIssuer : blockchainProperties . privateIssuer , rpcNode : blockchainProperties . rpcNode , rpcNodeFallback : blockchainProperties . rpcNodeFallback } ; } }