[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] branch master updated: added lookup history entry
From: |
gnunet |
Subject: |
[taler-donau] branch master updated: added lookup history entry |
Date: |
Sun, 14 Jan 2024 21:32:12 +0100 |
This is an automated email from the git hooks/post-receive script.
johannes-casaburi pushed a commit to branch master
in repository donau.
The following commit(s) were added to refs/heads/master by this push:
new 6c56bb6 added lookup history entry
6c56bb6 is described below
commit 6c56bb6e9d4ca638d50f4a51a92ea81a876f1be9
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Sun Jan 14 21:31:44 2024 +0100
added lookup history entry
---
src/donau/Makefile.am | 3 ++-
src/donau/donau-httpd_get-history-entry.c | 16 +++++++++-------
src/donau/donau-httpd_history.h | 12 ++++++++++++
src/include/donaudb_plugin.h | 15 +++++++++++++++
4 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/src/donau/Makefile.am b/src/donau/Makefile.am
index 627ec45..9cad482 100644
--- a/src/donau/Makefile.am
+++ b/src/donau/Makefile.am
@@ -44,7 +44,8 @@ donau_httpd_SOURCES = \
donau-httpd_config.c donau-httpd_config.h \
donau-httpd_get-charities.c donau_httpd_charity.h \
donau-httpd_get-charity.c donau-httpd_post-charity.c \
- donau-httpd_get-history.c donau-httpd_history.h \
+ donau-httpd_get-history-entry.c donau-httpd_history.h \
+ donau-httpd_get-history.c \
donau-httpd_terms.c donau-httpd_terms.h
# Testcases
diff --git a/src/donau/donau-httpd_get-history-entry.c
b/src/donau/donau-httpd_get-history-entry.c
index 51853c9..fedbd1b 100644
--- a/src/donau/donau-httpd_get-history-entry.c
+++ b/src/donau/donau-httpd_get-history-entry.c
@@ -38,7 +38,7 @@
#define MAX_RECORDS 1024
MHD_RESULT
-DH_handler_history_get (
+DH_handler_history_entry_get (
struct DH_RequestContext *rc,
const char *const args[])
{
@@ -68,13 +68,15 @@ DH_handler_history_get (
}
{
- struct DONAUDB_CharityMetaData meta;
+ const struct TALER_Amount *final_amount;
+ const uint64_t donation_year;
enum GNUNET_DB_QueryStatus qs;
MHD_RESULT result;
qs = DH_plugin->lookup_history_entry (DH_plugin->cls,
- charity_id,
- &meta);
+ charity_id,
+ &final_amount,
+ donation_year);
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR:
@@ -100,11 +102,11 @@ DH_handler_history_get (
rc->connection,
MHD_HTTP_OK,
TALER_JSON_pack_amount ("final_amount",
- meta.final_amount),
+ final_amount),
GNUNET_JSON_pack_uint64 ("donation_year",
- meta.donation_year));
+ donation_year));
- GNUNET_free (meta.final_amount);
+ GNUNET_free (final_amount);
return result;
}
}
diff --git a/src/donau/donau-httpd_history.h b/src/donau/donau-httpd_history.h
index 93e7782..aae8640 100644
--- a/src/donau/donau-httpd_history.h
+++ b/src/donau/donau-httpd_history.h
@@ -36,4 +36,16 @@ DH_handler_history_get (
struct DH_RequestContext *rc,
const char *const args[]);
+/**
+ * Handle a GET "/history/$charity_id" request.
+ *
+ * @param rc request context
+ * @param args GET arguments (should be one)
+ * @return MHD result code
+ */
+MHD_RESULT
+DH_handler_history_entry_get (
+ struct DH_RequestContext *rc,
+ const char *const args[]);
+
#endif
diff --git a/src/include/donaudb_plugin.h b/src/include/donaudb_plugin.h
index c841eb2..212b10f 100644
--- a/src/include/donaudb_plugin.h
+++ b/src/include/donaudb_plugin.h
@@ -447,6 +447,21 @@ struct DONAUDB_Plugin
DONAUDB_GetHistoryCallback cb,
void *cb_cls);
+ /**
+ * Lookup history entry.
+ *
+ * @param cls closure
+ * @param cb callback to invoke on each match
+ * @param cb_cls closure for @a cb
+ * @return database transaction status
+ */
+ enum GNUNET_DB_QueryStatus
+ (*lookup_history_entry)(
+ void *cls,
+ const uint64_t charity_id,
+ const struct TALER_Amount *final_amount,
+ const uint64_t donation_year);
+
/**
* Get donation_unit_key.
*
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-donau] branch master updated: added lookup history entry,
gnunet <=