diff options
Diffstat (limited to 'src/clj/queue_api/routes')
-rw-r--r-- | src/clj/queue_api/routes/services.clj | 7 |
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"] |