Alexis Hernandez
6 years ago
2 changed files with 20 additions and 6 deletions
@ -0,0 +1,18 @@ |
|||||
|
package com.xsn.explorer.models |
||||
|
|
||||
|
import com.xsn.explorer.models.persisted.Block |
||||
|
import io.scalaland.chimney.dsl._ |
||||
|
|
||||
|
/** |
||||
|
* The package is a bridge between model domains, for example, sometimes you will have a rpc.Block but need a |
||||
|
* persisted.Block, this is where the transormation logic lives. |
||||
|
*/ |
||||
|
package object transformers { |
||||
|
|
||||
|
def toPersistedBlock(rpcBlock: rpc.Block): persisted.Block = { |
||||
|
rpcBlock |
||||
|
.into[Block] |
||||
|
.withFieldConst(_.extractionMethod, Block.ExtractionMethod.ProofOfWork) // TODO: Get proper method |
||||
|
.transform |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue