diff --git a/src/main/scala/code/api/v2_0_0/JSONFactory2.0.0.scala b/src/main/scala/code/api/v2_0_0/JSONFactory2.0.0.scala index bc194a130..8649a9a71 100644 --- a/src/main/scala/code/api/v2_0_0/JSONFactory2.0.0.scala +++ b/src/main/scala/code/api/v2_0_0/JSONFactory2.0.0.scala @@ -38,11 +38,12 @@ import code.TransactionTypes.TransactionType.TransactionType import code.meetings.Meeting import code.model.dataAccess.OBPUser import code.transactionrequests.TransactionRequests._ +import com.sksamuel.elastic4s.source.DocumentMap import net.liftweb.common.{Full, Box} // import code.api.util.APIUtil.ApiLink -import code.api.v1_2_1.{AmountOfMoneyJSON, JSONFactory => JSONFactory121, MinimalBankJSON => MinimalBankJSON121, OtherAccountJSON => OtherAccountJSON121, ThisAccountJSON => ThisAccountJSON121, TransactionDetailsJSON => TransactionDetailsJSON121, UserJSON => UserJSON121, ViewJSON => ViewJSON121} +import code.api.v1_2_1.{JSONFactory => JSONFactory121, MinimalBankJSON => MinimalBankJSON121, OtherAccountJSON => OtherAccountJSON121, ThisAccountJSON => ThisAccountJSON121, TransactionDetailsJSON => TransactionDetailsJSON121, UserJSON => UserJSON121, ViewJSON => ViewJSON121, TransactionMetadataJSON, AmountOfMoneyJSON} import code.api.v1_4_0.JSONFactory1_4_0.{CustomerFaceImageJson, ChallengeJSON, TransactionRequestAccountJSON} import code.kycchecks.KycCheck import code.kycdocuments.KycDocument @@ -305,6 +306,19 @@ case class TransactionRequestBodyJSON ( ) + + + +case class TransactionJSON ( + id : String, + account : ThisAccountJSON121, + counterparty : OtherAccountJSON121, + details : TransactionDetailsJSON121, + metadata : TransactionMetadataJSON + ) // extends DocumentMap + + + object JSONFactory200{ // Modified in 2.0.0 diff --git a/src/main/scala/code/search/search.scala b/src/main/scala/code/search/search.scala index 2dec266c7..4bd6107f9 100644 --- a/src/main/scala/code/search/search.scala +++ b/src/main/scala/code/search/search.scala @@ -1,6 +1,6 @@ package code.search -import code.api.v1_2_1.TransactionJSON +import code.api.v2_0_0.TransactionJSON import com.sksamuel.elastic4s.ElasticClient import com.sksamuel.elastic4s.ElasticDsl._ @@ -16,8 +16,9 @@ class search { */ - // WIP - def indexTransaction (transaction: TransactionJSON) { + // Index a Transaction + // Put into a index that has the viewId and version in the name. + def indexTransaction (viewId: String, transaction: TransactionJSON) { val client = ElasticClient.local @@ -26,15 +27,15 @@ class search { // https://github.com/sksamuel/elastic4s/blob/master/guide/source.md - client.execute { index into "transaction_v1.2.1" doc TransactionJSON }.await - //client.execute { index into "transactions" JacksonSource (TransactionJSON) }.await + // TODO + // client.execute { index into viewId + "transaction_v1.2.1" doc transaction }.await - - val resp = client.execute { search in "bands/artists" query "coldplay" }.await - println(resp) - //logger.debug(s"Search request ${req.show}") + + //val resp = client.execute { search in "bands/artists" query "coldplay" }.await + //println(resp) + }