From b9e1725e4f9bebce7e426431a1f8524efd026662 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Thu, 22 Feb 2018 02:09:53 -0300 Subject: Readme --- README.md | 14 +++++++------- src/clj/queue_api/routes/services.clj | 2 +- test/clj/queue_api/test/handler.clj | 2 -- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 16658a9..8e89454 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ then access [localhost:3000/swagger-ui](http://localhost:3000/swagger-ui/index.h ## Stack -I chose [luminus](http://www.luminusweb.net/) for my stack as it makes the initial setup way easier, it provides a wide range profiles for a bunch of technologies. +I chose [luminus](http://www.luminusweb.net/) for my stack as it makes the initial setup way easier, it provides a wide range of profiles for a bunch of technologies. I bootstrapped the project with `lein new luminus queue-api +swagger +service +kibit` plus datascrypt which doesn't come with Luminus. ### +Swagger @@ -21,7 +21,7 @@ When possible I always add it to a project for it make easier to visualize and t ### +Service -To remove all front end stuff since I don't need it. +To remove all frontend stuff that I don't need it. ### +Kibit @@ -29,7 +29,7 @@ It gives some insight how to make you code more idiomatic. ### Datascript -[datascript](https://github.com/tonsky/datascript) was chosen for its easy setup, after little to no effort I had it working. +[Datascript](https://github.com/tonsky/datascript) was chosen for its easy setup, after little to no effort I had it working. Even though it was meant to run on browser it fit nicely in the project, and because it works pretty much like Datomic it has [powerful query system](https://docs.datomic.com/on-prem/query.html) and works seamlessly with clojure. Additionally it had an okay [non-documentation](https://github.com/tonsky/datascript/wiki/Getting-started) with some [samples](https://github.com/kristianmandrup/datascript-tutorial) and if I couldn't find for Datascript I'd search for a Datomic seeing that query system of both are compatible. @@ -47,16 +47,16 @@ Project has two models: * `:agent/job` reference to job that the agent is processing * Job * `:job/id` unique identification of a job - * `:job/status` current status of the job it can be: + * `:job/status` status of the job, it can be: * `:unassigned` it is waiting to be assigned * `:processing` it is being precessed by an agent * `:completed` it has been done with. * `:job/agent` reference a job that is processing this job or had processed it. * `:job/type` type of the job that it can perform * `:job/date` date time for when job has entered the system. - * `:job/urgent` urgent flag that tell when a job has higher priority. + * `:job/urgent` urgent flag that tells when a job has higher priority. -Those models wrap up in schema: +Those models wrap up in the following schema to datascript: ```clojure {:agent/id {:db/unique :db.unique/identity} @@ -69,7 +69,7 @@ Those models wrap up in schema: ### services.clj -After all luminus file there is actually two files that have the core logic of the app `services.clj` and `db/core.cljs`. +After all luminus file there is actually two files that have the core logic for the app, `services.clj` and `db/core.cljs`. For `services.clj` it holds all code for endpoint definition and input validation. Considering the exercise requirements there is a need for 5 endpoints: diff --git a/src/clj/queue_api/routes/services.clj b/src/clj/queue_api/routes/services.clj index c3c83e9..9b8cc91 100644 --- a/src/clj/queue_api/routes/services.clj +++ b/src/clj/queue_api/routes/services.clj @@ -11,7 +11,7 @@ {:id s/Str :name s/Str :primary_skillset [s/Str] - (s/optional-key :secondary_skillset) [s/Str]}) + :secondary_skillset [s/Str]}) (s/defschema new-job {:id s/Str diff --git a/test/clj/queue_api/test/handler.clj b/test/clj/queue_api/test/handler.clj index 9dd13eb..75ce8f3 100644 --- a/test/clj/queue_api/test/handler.clj +++ b/test/clj/queue_api/test/handler.clj @@ -47,7 +47,6 @@ (json-body {:agent_id "644be0ce-035d-48cb-867e-8e6de2714a8d"}) app)] (is (= 200 (:status response)))))) - (deftest job-test (testing "Job route PUT" (let [response (-> (request :put "/job") @@ -62,7 +61,6 @@ :urgent false}) app)] (is (= 400 (:status response))))) - (testing "Job route POST" (let [response (-> (request :post "/job") (json-body {:agent_id "644be0ce-035d-48cb-867e-8e6de2714a8d"}) -- cgit v1.2.3