gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] 03/03: fix task deletion


From: gnunet
Subject: [libeufin] 03/03: fix task deletion
Date: Tue, 26 Jan 2021 18:31:30 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

commit fbf42e3a6d45a224481cb3ca7fa96056554d4469
Author: MS <ms@taler.net>
AuthorDate: Tue Jan 26 18:31:06 2021 +0100

    fix task deletion
---
 .../tech/libeufin/nexus/server/NexusServer.kt      | 28 ++++++++++------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
index a5ca7d0..ed714dc 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -480,26 +480,24 @@ fun serverMain(dbName: String, host: String, port: Int) {
 
             get("/bank-accounts/{accountId}/schedule/{taskId}") {
                 requireSuperuser(call.request)
+                val taskId = ensureNonNull(call.parameters["taskId"])
                 val task = transaction {
                     NexusScheduledTaskEntity.find {
-                        NexusScheduledTasksTable.taskName eq 
ensureNonNull(call.parameters["taskId"])
+                        NexusScheduledTasksTable.taskName eq taskId
                     }.firstOrNull()
                 }
+                if (task == null) throw NexusError(HttpStatusCode.NotFound, 
"Task ${taskId} wasn't found")
                 call.respond(
-                    if (task != null) {
-                        AccountTask(
-                            resourceId = task.resourceId,
-                            resourceType = task.resourceType,
-                            taskName = task.taskName,
-                            taskCronspec = task.taskCronspec,
-                            taskType = task.taskType,
-                            taskParams = task.taskParams,
-                            nextScheduledExecutionSec = 
task.nextScheduledExecutionSec,
-                            prevScheduledExecutionSec = 
task.prevScheduledExecutionSec
-                        )
-                    } else {
-                        object {}
-                    }
+                    AccountTask(
+                        resourceId = task.resourceId,
+                        resourceType = task.resourceType,
+                        taskName = task.taskName,
+                        taskCronspec = task.taskCronspec,
+                        taskType = task.taskType,
+                        taskParams = task.taskParams,
+                        nextScheduledExecutionSec = 
task.nextScheduledExecutionSec,
+                        prevScheduledExecutionSec = 
task.prevScheduledExecutionSec
+                    )
                 )
                 return@get
             }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]