commit 6d5d4960e19d0a765786dfee86b82258d3358902
parent a1a9e3d4d38c89cd47e2ba57a21eefb854b4dd21
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date: Thu, 26 Sep 2019 14:48:25 +0200
DB schema for Ebics 'subscribers'.
Diffstat:
1 file changed, 45 insertions(+), 2 deletions(-)
diff --git a/src/main/kotlin/tech/libeufin/DB.kt b/src/main/kotlin/tech/libeufin/DB.kt
@@ -62,8 +62,6 @@ enum class KeyStates {
RELEASED
}
-
-
/**
* This table information *not* related to EBICS, for all
* its customers.
@@ -72,9 +70,54 @@ object Customer: IntIdTable() {
val customerId: Column<String> = varchar(
"customerId",
CUSTOMER_ID_MAX_LENGTH).primaryKey()
+ val ebicsUserId = reference("ebicsUserId", EbicsUsers)
+}
+
+/**
+ * The following three tables define IDs that make a EBCIS
+ * 'subscriber' exist. Each EBICS subscriber is the tuple:
+ *
+ * - UserID, the human who is performing a EBICS task.
+ * - PartnerID, the legal entity that signed a formal agreement with the financial institution.
+ * - SystemID, (optional) the machine that is handling the EBICS task on behalf of the UserID.
+ */
+
+/**
+ * Table for UserID.
+ */
+object EbicsUsers: IntIdTable() {
+ // For simplicity, this entity is implemented by the
+ // 'id' field provided by the table constructor by default.
+}
+
+/**
+ * Table for UserID.
+ */
+object EbicsPartners: IntIdTable() {
+ // For simplicity, this entity is implemented by the
+ // 'id' field provided by the table constructor by default.
+}
+
+/**
+ * Table for UserID.
+ */
+object EbicsSystems: IntIdTable() {
+ // For simplicity, this entity is implemented by the
+ // 'id' field provided by the table constructor by default.
}
/**
+ * Subscribers table. This table associates users with partners
+ * and systems. Each value can appear multiple times in the same column.
+ */
+object EbicsSubscribers: IntIdTable() {
+ val userId = reference("UserId", EbicsUsers)
+ val partnerId = reference("PartnerId", EbicsPartners)
+ val systemId = reference("SystemId", EbicsSystems)
+}
+
+
+/**
* This table maps customers with EBICS subscribers.
*/
object CustomerSubscriberMap: IntIdTable(){