gnunet-svn
[Top][All Lists]
Advanced

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

[taler-bank] 02/02: completely remove history-range API


From: gnunet
Subject: [taler-bank] 02/02: completely remove history-range API
Date: Thu, 16 Jan 2020 20:14:14 +0100

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

dold pushed a commit to branch master
in repository bank.

commit 1250877d0c0744dbfa46e940af80a12ee7aaf2fe
Author: Florian Dold <address@hidden>
AuthorDate: Thu Jan 16 20:14:10 2020 +0100

    completely remove history-range API
---
 talerbank/app/schemas.py | 10 --------
 talerbank/app/urls.py    |  1 -
 talerbank/app/views.py   | 59 ------------------------------------------------
 3 files changed, 70 deletions(-)

diff --git a/talerbank/app/schemas.py b/talerbank/app/schemas.py
index 91d6c0a..291ec5b 100644
--- a/talerbank/app/schemas.py
+++ b/talerbank/app/schemas.py
@@ -205,16 +205,6 @@ class HistoryParams(BankValidator):
         start = forms.IntegerField(required=False)
 
 
-class HistoryRangeParams(BankValidator):
-    def __init__(self, data):
-        super(HistoryRangeParams, self).__init__(self.InnerValidator, data)
-
-    class InnerValidator(HistoryParamsBase):
-        # FIXME: adjust min/max values.
-        end = forms.IntegerField()
-        start = forms.IntegerField()
-
-
 class PaytoField(forms.Field):
     def __init__(self, **kwargs):
         super().__init__(**kwargs)
diff --git a/talerbank/app/urls.py b/talerbank/app/urls.py
index 776ca9f..58e7b70 100644
--- a/talerbank/app/urls.py
+++ b/talerbank/app/urls.py
@@ -55,7 +55,6 @@ urlpatterns = [
     path("accounts/register", views.register, name="register"),
     path("profile", views.profile_page, name="profile"),
     path("history", views.serve_history, name="history"),
-    path("history-range", views.serve_history_range, name="history-range"),
     path(
         "api/withdraw-operation/<str:withdraw_id>",
         views.api_withdraw_operation,
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index e22a421..22cf62f 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -51,7 +51,6 @@ import qrcode.image.svg
 import lxml
 from .schemas import (
     HistoryParams,
-    HistoryRangeParams,
     URLParamValidationError,
     AddIncomingData,
     JSONFieldException,
@@ -626,36 +625,6 @@ def direction_switch(bank_account, direction):
     return direction_switch.get(direction)
 
 
-##
-# Main routine querying for histories, based on _date ranges_.
-#
-# @param bank_account the bank account object whose
-#        history is being extracted.
-# @param direction takes the following three values,
-#        * debit: only entries where the querying user has _paid_
-#                 will be returned.
-#        * credit: only entries where the querying user _got_
-#                  paid will be returned.
-#        * both: both of the cases above will be returned.
-#        * cancel+: only entries where the querying user cancelled
-#                   the _receiving_ of money will be returned.
-#        * cancel-: only entries where the querying user cancelled
-#                   the _paying_ of money will be returned.
-# @param start timestamp of the oldest element allowed in the
-#        result.
-# @param end timestamp of the youngest element allowed in the
-#        result.
-# @param descending if True, then the results will have the
-#        youngest entry in the first position.
-def query_history_range(bank_account, direction, start, end, descending):
-    qs = BankTransaction.objects.filter(
-        direction_switch(bank_account, direction), Q(date__gte=start), 
Q(date__lte=end)
-    )
-
-    order = "-id" if descending else "id"
-    return qs.order_by(order)
-
-
 ##
 # Main routine querying for histories.
 #
@@ -733,34 +702,6 @@ def build_history_response(qs, cancelled, user_account):
     return history
 
 
-##
-# Serve a request of /history-range.
-#
-# @param request Django-specific HTTP request.
-# @param user_account the account whose history should be gotten.
-# @return Django-specific HTTP response object.
-@require_GET
-@login_via_headers
-def serve_history_range(request, user_account):
-
-    args = HistoryRangeParams(request.GET.dict())
-
-    start_td = datetime.fromtimestamp(args.get("start"))
-    end_td = datetime.fromtimestamp(args.get("end"))
-
-    qs = query_history_range(
-        user_account.bankaccount,
-        args.get("direction", "both"),
-        start_td,
-        end_td,
-        args.get("ordering"),
-    )
-
-    history = build_history_response(qs, args.get("cancelled", "show"), 
user_account)
-
-    return JsonResponse(dict(data=history), status=200)
-
-
 ##
 # Serve a request of /history.
 #

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



reply via email to

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