gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: fix db query


From: gnunet
Subject: [libeufin] branch master updated: fix db query
Date: Thu, 14 May 2020 20:34:52 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new f24e223  fix db query
f24e223 is described below

commit f24e223a17be232485bed5696f1a3800d023f4ef
Author: MS <address@hidden>
AuthorDate: Thu May 14 20:34:33 2020 +0200

    fix db query
---
 integration-tests/test-ebics-new.py               | 15 ++++++++-------
 nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt |  7 +++++--
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/integration-tests/test-ebics-new.py 
b/integration-tests/test-ebics-new.py
index 764e7c3..5a11be8 100755
--- a/integration-tests/test-ebics-new.py
+++ b/integration-tests/test-ebics-new.py
@@ -258,17 +258,18 @@ assertResponse(
     )
 )
 
-nexus.terminate()
-sandbox.terminate()
-exit(44)
-
-#4
+#4, make sure history is empty
 resp = assertResponse(
     get(
-        "http://localhost:5001/users/{}/history".format(USERNAME)
+        
"http://localhost:5001/bank-accounts/{}/collected-transactions".format(BANK_ACCOUNT_LABEL),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
     )
 )
-assert(len(resp.json().get("payments")) == 0)
+assert(len(resp.json().get("transactions")) == 0)
+
+nexus.terminate()
+sandbox.terminate()
+exit(44)
 
 #5.a
 assertResponse(
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index 7b7c19d..aa73709 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -414,15 +414,17 @@ fun main() {
              */
             get("/bank-accounts/{accountid}/collected-transactions") {
                 val userId = 
authenticateRequest(call.request.headers["Authorization"])
+                val bankAccount = expectNonNull(call.parameters["accountid"])
                 val start = call.request.queryParameters["start"]
                 val end = call.request.queryParameters["end"]
                 val ret = Transactions()
                 transaction {
                     RawBankTransactionEntity.find {
                         RawBankTransactionsTable.nexusUser eq userId and
+                                (RawBankTransactionsTable.bankAccount eq 
bankAccount) and
                                 RawBankTransactionsTable.bookingDate.between(
-                                    parseDashedDate(start ?: "1970-01-01"),
-                                    parseDashedDate(end ?: 
DateTime.now().toDashedDate())
+                                    parseDashedDate(start ?: 
"1970-01-01").millis,
+                                    parseDashedDate(end ?: 
DateTime.now().toDashedDate()).millis
                                 )
                     }.forEach {
                         ret.transactions.add(
@@ -438,6 +440,7 @@ fun main() {
                         )
                     }
                 }
+                call.respond(ret)
                 return@get
             }
             /**

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]