|
|
@ -34,32 +34,31 @@
|
|
|
|
(:params req))))
|
|
|
|
(:params req))))
|
|
|
|
(list! schema-uuid req))))
|
|
|
|
(list! schema-uuid req))))
|
|
|
|
|
|
|
|
|
|
|
|
(defn form! [uuid]
|
|
|
|
|
|
|
|
(forms-inst/with-attributes
|
|
|
|
|
|
|
|
(domain-attr/find-by-instance! uuid)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn instance! [uuid]
|
|
|
|
(defn instance! [uuid]
|
|
|
|
(domain/full-instance-by-uuid! uuid))
|
|
|
|
(domain/full-instance-by-uuid! uuid))
|
|
|
|
|
|
|
|
|
|
|
|
(defn show! [uuid req]
|
|
|
|
(defn show! [uuid req]
|
|
|
|
(view/show! (instance! uuid) req))
|
|
|
|
(view/show! (instance! uuid) req))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn form! [uuid attrs]
|
|
|
|
|
|
|
|
(forms-inst/with-attributes attrs))
|
|
|
|
|
|
|
|
|
|
|
|
(defn edit-form! [uuid req]
|
|
|
|
(defn edit-form! [uuid req]
|
|
|
|
(let [instance (instance! uuid)
|
|
|
|
(let [instance (instance! uuid)
|
|
|
|
attrs (domain-attr/find-by-instance! uuid)
|
|
|
|
attrs (domain-attr/find-by-instance! uuid)
|
|
|
|
user-uuid (get-in req [:session :uuid])]
|
|
|
|
user-uuid (get-in req [:session :uuid])]
|
|
|
|
(view/edit! instance
|
|
|
|
(view/edit! instance
|
|
|
|
(form! uuid)
|
|
|
|
(form! uuid attrs)
|
|
|
|
(forms-inst/instance->form-data instance)
|
|
|
|
(forms-inst/instance->form-data instance)
|
|
|
|
(domain-schema/accessible-schemas! user-uuid)
|
|
|
|
(domain-schema/accessible-schemas! user-uuid)
|
|
|
|
req)))
|
|
|
|
req)))
|
|
|
|
|
|
|
|
|
|
|
|
(defn edit! [uuid req]
|
|
|
|
(defn edit! [uuid req]
|
|
|
|
(let [form-def (form! uuid)
|
|
|
|
(let [attrs (domain-attr/find-by-instance! uuid)
|
|
|
|
|
|
|
|
form-def (form! uuid attrs)
|
|
|
|
instance (instance! uuid)]
|
|
|
|
instance (instance! uuid)]
|
|
|
|
(if (form/valid? form-def req)
|
|
|
|
(if (form/valid? form-def req)
|
|
|
|
(let [form-data (form/form-data form-def req)
|
|
|
|
(let [form-data (form/form-data form-def req)
|
|
|
|
attrs (domain-attr/find-by-instance! uuid)
|
|
|
|
|
|
|
|
form-instance (forms-inst/form-data->instance form-data attrs)
|
|
|
|
form-instance (forms-inst/form-data->instance form-data attrs)
|
|
|
|
instance (assoc form-instance :uuid uuid)]
|
|
|
|
instance (assoc form-instance :uuid uuid)]
|
|
|
|
(domain/edit! instance)
|
|
|
|
(domain/edit! instance)
|
|
|
|