[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libeufin] branch master updated (263dab1 -> a8bde64)
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libeufin] branch master updated (263dab1 -> a8bde64) |
Date: |
Fri, 27 Sep 2019 19:47:09 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a change to branch master
in repository libeufin.
from 263dab1 fix /admin/customers/:id response
new 20d7304 ide files
new a8bde64 refactoring
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.idea/.gitignore | 3 ++
.idea/codeStyles/Project.xml | 10 +++++
.idea/codeStyles/codeStyleConfig.xml | 5 +++
.idea/gradle.xml | 19 ++++++++++
.idea/misc.xml | 4 ++
.idea/vcs.xml | 6 +++
src/main/kotlin/Main.kt | 73 ++++++++++++++++++------------------
src/main/kotlin/tech/libeufin/DB.kt | 1 -
8 files changed, 83 insertions(+), 38 deletions(-)
create mode 100644 .idea/.gitignore
create mode 100644 .idea/codeStyles/Project.xml
create mode 100644 .idea/codeStyles/codeStyleConfig.xml
create mode 100644 .idea/gradle.xml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/vcs.xml
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..0e40fe8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+
+# Default ignored files
+/workspace.xml
\ No newline at end of file
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..1bec35e
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,10 @@
+<component name="ProjectCodeStyleConfiguration">
+ <code_scheme name="Project" version="173">
+ <JetCodeStyleSettings>
+ <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
+ </JetCodeStyleSettings>
+ <codeStyleSettings language="kotlin">
+ <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
+ </codeStyleSettings>
+ </code_scheme>
+</component>
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml
b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..79ee123
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+<component name="ProjectCodeStyleConfiguration">
+ <state>
+ <option name="USE_PER_PROJECT_SETTINGS" value="true" />
+ </state>
+</component>
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..0580a45
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="GradleSettings">
+ <option name="linkedExternalProjectsSettings">
+ <GradleProjectSettings>
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
+ <option name="gradleHome" value="/usr/share/java/gradle" />
+ <option name="gradleJvm" value="12" />
+ <option name="modules">
+ <set>
+ <option value="$PROJECT_DIR$" />
+ </set>
+ </option>
+ <option name="useQualifiedModuleNames" value="true" />
+ </GradleProjectSettings>
+ </option>
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..6ed36dd
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ExternalStorageConfigurationManager" enabled="true" />
+</project>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="Git" />
+ </component>
+</project>
\ No newline at end of file
diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt
index c36849d..8bc678e 100644
--- a/src/main/kotlin/Main.kt
+++ b/src/main/kotlin/Main.kt
@@ -33,8 +33,6 @@ import org.w3c.dom.Document
import tech.libeufin.messages.HEVResponseDataType
import javax.xml.bind.JAXBElement
import io.ktor.features.*
-import io.netty.handler.codec.http.HttpContent
-import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.transactions.transaction
import tech.libeufin.tech.libeufin.*
import java.lang.NumberFormatException
@@ -63,22 +61,8 @@ fun main() {
}
post("/admin/customers") {
-
- var returnId = 0
- try {
-
- val body = call.receive<CustomerRequest>()
- logger.info(body.toString())
-
- transaction {
- val newBankCustomer = BankCustomers.insertAndGetId {
- it[name] = body.name
- it[ebicsSubscriber] = createSubscriber().id
- }
-
- returnId = newBankCustomer.value
- }
-
+ val body = try {
+ call.receive<CustomerRequest>()
} catch (e: Exception) {
e.printStackTrace()
call.respond(
@@ -87,6 +71,26 @@ fun main() {
)
return@post
}
+ logger.info(body.toString())
+
+ val returnId = transaction {
+ val myUserId = EbicsUser.new { }
+ val myPartnerId = EbicsPartner.new { }
+ val mySystemId = EbicsSystem.new { }
+ val subscriber = EbicsSubscriber.new {
+ userId = myUserId
+ partnerId = myPartnerId
+ systemId = mySystemId
+ state = SubscriberStates.NEW
+ }
+ println("subscriber ID: ${subscriber.id.value}")
+ val customer = BankCustomer.new {
+ name = body.name
+ ebicsSubscriber = subscriber
+ }
+ println("name: ${customer.name}")
+ return@transaction customer.id.value
+ }
call.respond(
HttpStatusCode.OK,
@@ -98,32 +102,20 @@ fun main() {
get("/admin/customers/{id}") {
- var id = -1
- var tmp: CustomerInfo? = null
- var result: ResultRow? = null
-
- try {
- id = call.parameters["id"]!!.toInt()
- logger.info("Querying ID: $id")
+ val id: Int = try {
+ call.parameters["id"]!!.toInt()
} catch (e: NumberFormatException) {
call.respond(
HttpStatusCode.BadRequest,
SandboxError(e.message.toString())
)
+ return@get
}
- transaction {
- val singleton = BankCustomers.select { BankCustomers.id eq
id }
- result = singleton.firstOrNull()
-
- if (null != result)
- tmp = CustomerInfo(
- result?.get(BankCustomers.name) as String,
- customerEbicsInfo = CustomerEbicsInfo(
-
result?.get(BankCustomers.ebicsSubscriber)?.value as Int
- )
- )
+ logger.info("Querying ID: $id")
+ val result = transaction {
+ BankCustomer.findById(id)
}
if (null == result) {
@@ -134,9 +126,16 @@ fun main() {
return@get
}
+ val tmp = CustomerInfo(
+ result.name,
+ customerEbicsInfo = CustomerEbicsInfo(
+ result.ebicsSubscriber.userId.id.value
+ )
+ )
+
call.respond(
HttpStatusCode.OK,
- tmp as CustomerInfo
+ tmp
)
}
diff --git a/src/main/kotlin/tech/libeufin/DB.kt
b/src/main/kotlin/tech/libeufin/DB.kt
index 2ed8931..70abf04 100644
--- a/src/main/kotlin/tech/libeufin/DB.kt
+++ b/src/main/kotlin/tech/libeufin/DB.kt
@@ -1,6 +1,5 @@
package tech.libeufin.tech.libeufin
-import com.sun.org.apache.bcel.internal.generic.NEW
import org.jetbrains.exposed.dao.*
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.transactions.transaction
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [libeufin] branch master updated (263dab1 -> a8bde64),
gnunet <=