Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(ns cljobs.resources.manage.os-projects
(:require [cljobs.resources.common :as c]
[cljobs.db.validations :as v]
[cljobs.db.queries :as q]
[datomic.api :as d]))
(def new-data (c/query-result q/user-os-projects))
(defn process-params
(-> (c/assoc-user ctx :os-project/user)
(update-in [:request :params]
[:os-project/repo-url :os-project/home-page-url])))
(def result-data (c/result-data (c/query-result-owned q/user-os-projects)
(c/query-result q/published-os-projects)))
(defn resource-decisions
{:create {:post! (comp c/add-result c/create process-params)
:handle-created result-data}
:update {:authorized? (c/user-owns? :os-project/user)
:put! (comp c/add-result c/update)
:handle-ok result-data}
:delete {:authorized? (c/user-owns? :os-project/user)
:delete! (comp c/add-result c/delete)
:delete-enacted? true
:respond-with-entity? true
:handle-ok result-data}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment