summaryrefslogtreecommitdiff
path: root/nexus
diff options
context:
space:
mode:
authorMS <ms@taler.net>2021-01-26 18:31:06 +0100
committerMS <ms@taler.net>2021-01-26 18:31:06 +0100
commitfbf42e3a6d45a224481cb3ca7fa96056554d4469 (patch)
treea9f0b982166914a43daa7c144bb69b0e84eccdac /nexus
parent916a3189ce3c4852dbf498b4cf6fa96ba9f9f1de (diff)
downloadlibeufin-fbf42e3a6d45a224481cb3ca7fa96056554d4469.tar.gz
libeufin-fbf42e3a6d45a224481cb3ca7fa96056554d4469.tar.bz2
libeufin-fbf42e3a6d45a224481cb3ca7fa96056554d4469.zip
fix task deletion
Diffstat (limited to 'nexus')
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt28
1 files 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 a5ca7d06..ed714dc4 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
}