blob: 5d6d6cbfd3d17ec2b42e0899b5615febfd49ccdc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
(ns queue-api.routes.services
(:require [ring.util.http-response :refer :all]
[compojure.api.sweet :refer :all]
[schema.core :as s]
[queue-api.db.core :as db]))
(defapi service-routes
{:swagger {:ui "/swagger-ui"
:spec "/swagger.json"
:data {:info {:version "1.0.0"
:title "Job Queue API"
:description "Manages agent resources"}}}}
(context "/agent" []
(PUT "/" []
:body-params [id :- String, name :- String, primary_skillset :- [String], secondary_skillset :- [String]]
:summary "Add a new agent"
(db/add-agent
{:id id
:name name
:primary-skillset primary_skillset
:secondary-skillset secondary_skillset})
(ok))
(POST "/" []
:return [{:type String :jobs s/Int}]
:body-params [agent_id :- String]
:summary "Get a summary of an agent"
(ok (db/get-agent agent_id))))
(context "/job" []
(PUT "/" []
:body-params [id :- String, type :- String, urgent :- Boolean]
:summary "Add a new job"
(db/add-job {:id id
:type type
:urgent urgent})
(ok))
(POST "/" []
:return {:job_request {:job_id String :agent_id String}}
:body-params [agent_id :- String]
:summary "Request a job for a agent"
(ok (db/request-job agent_id))))
(context "/queue" []
(GET "/" []
:return {:completed [String]
:processing[String]
:unassigned [String]}
:summary "Get a summary of an agent"
(ok (db/sum-queue)))))
|