[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Add "facade info" object, both at DB a
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Add "facade info" object, both at DB and as JSON. |
Date: |
Thu, 28 May 2020 14:41:07 +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 683b475 Add "facade info" object, both at DB and as JSON.
683b475 is described below
commit 683b4754d05f9f762dcaf736df4fcb11ce2e60eb
Author: MS <ms@taler.net>
AuthorDate: Thu May 28 14:40:43 2020 +0200
Add "facade info" object, both at DB and as JSON.
---
nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt | 27 +++++++++++++++++++++++
nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt | 14 +++++++++---
nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 9 ++++++++
3 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 4566792..5f22d1d 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -8,6 +8,8 @@ import org.jetbrains.exposed.sql.StdOutSqlLogger
import org.jetbrains.exposed.sql.addLogger
import org.jetbrains.exposed.sql.transactions.TransactionManager
import org.jetbrains.exposed.sql.transactions.transaction
+import tech.libeufin.nexus.NexusBankConnectionsTable.entityId
+import tech.libeufin.nexus.NexusBankConnectionsTable.primaryKey
import tech.libeufin.util.EbicsInitState
import tech.libeufin.util.amount
import java.sql.Connection
@@ -269,6 +271,31 @@ class NexusBankConnectionEntity(id: EntityID<String>) :
Entity<String>(id) {
var owner by NexusUserEntity referencedOn NexusBankConnectionsTable.owner
}
+object FacadesTable : IdTable<String>() {
+ override val id =
NexusBankConnectionsTable.text("id").entityId().primaryKey()
+ val name = text("name")
+ val type = text("type")
+ val creator = reference("creator", NexusUsersTable)
+ val bankAccountsRead = text("bankAccountsRead")
+ val bankAccountsWrite = text("bankAccountsWrite")
+ val bankConnectionsRead = text("bankConnectionsRead")
+ val bankConnectionsWrite = text("bankConnectionsWrite")
+ val config = blob("config")
+}
+
+class FacadeEntity(id: EntityID<String>) : Entity<String>(id) {
+ companion object : EntityClass<String, FacadeEntity>(FacadesTable)
+ var name by FacadesTable.name
+ var type by FacadesTable.type
+ var creator by NexusUserEntity referencedOn FacadesTable.creator
+ var bankAccountsRead by FacadesTable.bankAccountsRead
+ var bankAccountsWrite by FacadesTable.bankAccountsWrite
+ var bankConnectionsRead by FacadesTable.bankConnectionsRead
+ var bankConnectionsWrite by FacadesTable.bankConnectionsWrite
+ var config by FacadesTable.config
+}
+
+
fun dbCreateTables(dbName: String) {
Database.connect("jdbc:sqlite:${dbName}", "org.sqlite.JDBC")
TransactionManager.manager.defaultIsolationLevel =
Connection.TRANSACTION_SERIALIZABLE
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
index e9c16ff..afb36f0 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
@@ -253,6 +253,17 @@ data class BankMessageInfo(
val length: Long
)
+data class FacadeInfo(
+ val name: String,
+ val type: String,
+ val creator: String,
+ val bankAccountsRead: MutableList<String> = mutableListOf(),
+ val bankAccountsWrite: MutableList<String> = mutableListOf(),
+ val bankConnectionsRead: MutableList<String> = mutableListOf(),
+ val bankConnectionsWrite: MutableList<String> = mutableListOf(),
+ val config: Any
+)
+
/**********************************************************************
* Convenience types (ONLY used to gather data together in one place) *
**********************************************************************/
@@ -267,6 +278,3 @@ data class Pain001Data(
)
-
-
-
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index cb3c638..afb6a99 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -947,6 +947,15 @@ fun serverMain(dbName: String) {
}
}
}
+ post("/facades") {
+ val body = call.receive<FacadeInfo>()
+ /**
+ * db work here.
+ */
+
+ 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: Add "facade info" object, both at DB and as JSON.,
gnunet <=