From 9dd6aeb32d21ed8673bdd490341302fd7f37d2fc Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sun, 18 Feb 2018 21:00:55 -0300 Subject: Adds functions that were missing --- src/clj/queue_api/routes/services.clj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/clj/queue_api/routes/services.clj') 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"] -- cgit v1.2.3