[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: store facade data
From: |
gnunet |
Subject: |
[libeufin] branch master updated: store facade data |
Date: |
Thu, 28 May 2020 14:49:28 +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 d8bb66f store facade data
d8bb66f is described below
commit d8bb66f402e4aebf3c091bd31dcbadd6cb1995b9
Author: MS <ms@taler.net>
AuthorDate: Thu May 28 14:49:22 2020 +0200
store facade data
---
nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt | 2 +-
nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 19 ++++++++++++++-----
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 5f22d1d..916fea0 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -280,7 +280,7 @@ object FacadesTable : IdTable<String>() {
val bankAccountsWrite = text("bankAccountsWrite")
val bankConnectionsRead = text("bankConnectionsRead")
val bankConnectionsWrite = text("bankConnectionsWrite")
- val config = blob("config")
+ val config = blob("config").nullable() /* what's the best format to store
Any? */
}
class FacadeEntity(id: EntityID<String>) : Entity<String>(id) {
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index afb6a99..b41292f 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -949,14 +949,23 @@ fun serverMain(dbName: String) {
}
post("/facades") {
val body = call.receive<FacadeInfo>()
- /**
- * db work here.
- */
-
+ val user = authenticateRequest(call.request)
+ if (user.id.value != body.creator) throw NexusError(
+ HttpStatusCode.BadRequest, "Facade creator !=
authenticated user"
+ )
+ transaction {
+ FacadeEntity.new(body.name) {
+ type = body.type
+ creator = user
+ bankAccountsRead =
body.bankAccountsRead.joinToString("|")
+ bankAccountsWrite =
body.bankAccountsWrite.joinToString("|")
+ bankConnectionsRead =
body.bankConnectionsRead.joinToString("|")
+ bankConnectionsWrite =
body.bankConnectionsWrite.joinToString("|")
+ }
+ }
call.respondText("Facade created")
return@post
}
-
/**
* Hello endpoint.
*/
--
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: store facade data,
gnunet <=