[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: endpoint to list public accounts
From: |
gnunet |
Subject: |
[libeufin] branch master updated: endpoint to list public accounts |
Date: |
Tue, 19 Oct 2021 10:52:21 +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 52d80a4 endpoint to list public accounts
52d80a4 is described below
commit 52d80a4e5ceaec11b741a480d92b18b19e0e2795
Author: ms <ms@taler.net>
AuthorDate: Tue Oct 19 10:52:15 2021 +0200
endpoint to list public accounts
---
.../src/main/kotlin/tech/libeufin/sandbox/DB.kt | 2 ++
.../src/main/kotlin/tech/libeufin/sandbox/JSON.kt | 13 ++++++++++++
.../src/main/kotlin/tech/libeufin/sandbox/Main.kt | 23 ++++++++++++++++++++--
3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index 5ab0bda..7a48531 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -116,6 +116,7 @@ object DemobankCustomersTable : LongIdTable() {
val username = text("username")
val passwordHash = text("passwordHash")
val isDebit = bool("isDebit").default(false)
+ val name = text("name").nullable()
}
class DemobankCustomerEntity(id: EntityID<Long>) : LongEntity(id) {
@@ -126,6 +127,7 @@ class DemobankCustomerEntity(id: EntityID<Long>) :
LongEntity(id) {
var username by DemobankCustomersTable.username
var passwordHash by DemobankCustomersTable.passwordHash
var isDebit by DemobankCustomersTable.isDebit
+ var name by DemobankCustomersTable.name
}
/**
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
index 8569d44..92992e0 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
@@ -77,6 +77,19 @@ data class CustomerRegistration(
val password: String
)
+/**
+ * More detailed information about one customer. This type
+ * is mainly required along public histories and/or customer
+ * data unrelated to the Access API.
+ */
+data class CustomerInfo(
+ val username: String,
+ val name: String,
+ val balance: String,
+ val iban: String,
+ // more ..?
+)
+
data class CamtParams(
// name/label of the bank account to query.
val bankaccount: String,
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 4b9f520..5f78fa6 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -1106,8 +1106,27 @@ val sandboxApp: Application.() -> Unit = {
// [...]
get("/public-accounts") {
- // List public accounts. Does not require any
authentication.
- // XXX: New!
+ val ret = object {
+ val publicAccounts = mutableListOf<CustomerInfo>()
+ }
+ transaction {
+ DemobankCustomerEntity.find {
+ DemobankCustomersTable.isPublic eq true
+ }.forEach {
+ ret.publicAccounts.add(
+ CustomerInfo(
+ username = it.username,
+ balance = it.balance,
+ iban = "To Do",
+ name = it.name ?: throw
internalServerError(
+ "Found name-less public account,
username: ${it.username}"
+ )
+ )
+ )
+ }
+ }
+ call.respond(ret)
+ return@get
}
get("/public-accounts/{account_name}/history") {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: endpoint to list public accounts,
gnunet <=