aboutsummaryrefslogtreecommitdiff
path: root/src/clj/queue_api/routes/services.clj
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2018-02-18 21:00:55 -0300
committerGabriel A. Giovanini <mail@gabrielgio.me>2018-02-18 21:00:55 -0300
commit9dd6aeb32d21ed8673bdd490341302fd7f37d2fc (patch)
tree8362688060eaea737f40ddf514648a22f8c2d4fe /src/clj/queue_api/routes/services.clj
parent48bd546122842012a65572fa436fe58cfd965ca7 (diff)
downloadqueue-api-9dd6aeb32d21ed8673bdd490341302fd7f37d2fc.tar.gz
queue-api-9dd6aeb32d21ed8673bdd490341302fd7f37d2fc.tar.bz2
queue-api-9dd6aeb32d21ed8673bdd490341302fd7f37d2fc.zip
Adds functions that were missing
Diffstat (limited to 'src/clj/queue_api/routes/services.clj')
-rw-r--r--src/clj/queue_api/routes/services.clj7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/clj/queue_api/routes/services.clj b/src/clj/queue_api/routes/services.clj
index d432517..e8f03f9 100644
--- a/src/clj/queue_api/routes/services.clj
+++ b/src/clj/queue_api/routes/services.clj
@@ -38,10 +38,13 @@
:urgent urgent})
(ok))
(POST "/" []
- :return {:job_request {:job_id String :agent_id String}}
+ :return {:job_request {:job_id s/Any :agent_id String}}
:body-params [agent_id :- String]
:summary "Request a job to a given agent"
- (ok (db/dequeue-job agent_id))))
+ (let [j (db/dequeue-job agent_id)]
+ (if (nil? j)
+ (bad-request {:message "Agent does not exist"})
+ (ok j)))))
(context "/queue" []
:tags ["queue"]