mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 14:46:49 +00:00
Search WIP. Added v2.0.0 TransactionJSON
This commit is contained in:
parent
5712f18259
commit
01ddc4de24
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user