aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2018-02-20 00:21:24 -0300
committerGabriel A. Giovanini <mail@gabrielgio.me>2018-02-20 00:21:24 -0300
commit71eb6b34ce80cc91ab1e713f2c5b32076c3ee940 (patch)
tree6cc740597d52f0836e06fa3d7c6374a22e475b59
parentd1c15fe5fa8d5aac6a7ca056e79ca8872971a9d9 (diff)
downloadqueue-api-71eb6b34ce80cc91ab1e713f2c5b32076c3ee940.tar.gz
queue-api-71eb6b34ce80cc91ab1e713f2c5b32076c3ee940.tar.bz2
queue-api-71eb6b34ce80cc91ab1e713f2c5b32076c3ee940.zip
Simplifies q-job and doc
-rw-r--r--project.clj2
-rw-r--r--src/clj/queue_api/db/core.clj28
2 files changed, 16 insertions, 14 deletions
diff --git a/project.clj b/project.clj
index e9738db..d5d9a0f 100644
--- a/project.clj
+++ b/project.clj
@@ -1,6 +1,6 @@
(defproject queue-api "0.1.0"
- :description "Api for a simple job queue"
+ :description "A simple job queue api"
:url "https://gitlab.com/gabrielgio/queue-api"
:dependencies [[clj-time "0.14.2"]
diff --git a/src/clj/queue_api/db/core.clj b/src/clj/queue_api/db/core.clj
index faa4d65..e0eb491 100644
--- a/src/clj/queue_api/db/core.clj
+++ b/src/clj/queue_api/db/core.clj
@@ -52,18 +52,18 @@
`s`: status of the job
`ts`: types of the job"
[u s & ts]
- (let [q (->> (d/q '[:find ?d ?id
- :in $ ?u ?s ?ts
- :where
- [?e :job/date ?d]
- [?e :job/id ?id]
- [?e :job/urgent ?u]
- [?e :job/status ?s]
- [?e :job/type ?t]
- [(clojure.string/includes? ?ts ?t)]]
- @conn u s ts)
- (sort-by first))]
- (map #(d/entity @conn [:job/id (last %)]) q)))
+ (->> (d/q '[:find ?d ?id
+ :in $ ?u ?s ?ts
+ :where
+ [?e :job/date ?d]
+ [?e :job/id ?id]
+ [?e :job/urgent ?u]
+ [?e :job/status ?s]
+ [?e :job/type ?t]
+ [(clojure.string/includes? ?ts ?t)]]
+ @conn u s ts)
+ (sort-by first)
+ (map #(d/entity @conn [:job/id (last %)]))))
(defn q-status
"Query job filtering only by `s`"
@@ -112,7 +112,9 @@
p
(q-skillset (:agent/secondary-skillset a)))))))
-(defn t-job
+(defn
+ "Transact status `s` and agent `a` of a job `id`"
+ t-job
([^String id ^Keyword s]
(d/transact! conn [{:job/id id
:job/status s}]))