                   (let [loc (str "/api/projects/" (:id result))]
                     (rsp/created loc result)))))))
 
+;; --- Update Project
+
+(s/def ::update-project|path
+  (s/keys :req-un [::id]))
+
+(s/def ::update-project|body
+  (s/keys :req-un [::name ::version]))
+
 (defn update-project
   "Update project"
-  {:parameters {:path {:id [st/required st/uuid-str]}
-                :body {:name [st/required st/string]
-                       :version [st/required st/integer]}}}
+  {:parameters {:path ::update-project|path
+                :body ::update-project|body}
+   :validation :spec}
   [{:keys [user parameters] :as req}]
   (let [id (get-in parameters [:path :id])
         data (get parameters :body)

            [uxbox.util.uuid :as uuid]
            [uxbox.util.exceptions :as ex]))

(defn list-projects
  {:description "List projects"}
  [{:keys [user] :as req}]

    (->> (sv/query message)
         (p/map rsp/ok))))

;; --- Create Projects

(s/def ::create-project|body
  (s/keys :req-un [::name]
          :opt-un [::id]))

(defn create-project
  "Create project"
  {:parameters {:body ::create-project|body}
   :validation :spec}
  [{:keys [user parameters] :as req}]
  (let [data (get parameters :body)
        message (assoc data :type :create-project :user user)]
