Skip to content

Commit

Permalink
Reverted batch cgc-name removal (and other-names addition/removal) re…
Browse files Browse the repository at this point in the history
…sponse structure to state before cb1f4d7 (and analoguous for other-names) #304
  • Loading branch information
mluypaert committed Sep 11, 2020
1 parent d6b6329 commit 7fc046f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/wormbase/names/batch/gene.clj
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
:x-name ::batch-add-other-names-genes
:parameters {:body-params {:data ::wsg/update-other-names-batch
:prov ::wsp/provenance}}
:responses (wnu/response-map ok {:schema ::wsb/success-response})
:responses wnbg/data-changed-responses
:handler (fn [request]
(wnbg/adjust-attr-vals :gene/id
:gene/other-names
Expand All @@ -136,7 +136,7 @@
:x-name ::batch-delete-other-names-genes
:parameters {:body-params {:data ::wsg/update-other-names-batch
:prov ::wsp/provenance}}
:responses (wnu/response-map ok {:schema ::wsb/success-response})
:responses wnbg/data-changed-responses
:handler (fn [request]
(wnbg/adjust-attr-vals :gene/id
:gene/other-names
Expand Down Expand Up @@ -168,7 +168,7 @@
request))
(sweet/DELETE "/cgc-name" request
:summary "Remove CGC names from a gene."
:responses (wnu/response-map ok {:schema ::wsb/success-response})
:responses wnbg/data-changed-responses
:body [data {:data ::wsg/cgc-names}
prov {:prov ::wsp/provenance}]
(wnbg/adjust-attr-vals :gene/cgc-name
Expand Down
9 changes: 8 additions & 1 deletion src/wormbase/names/batch/generic.clj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
:descrpition "Information provided about entity status changes."})
(wnu/response-map)))

(def data-changed-responses
(-> wnu/default-responses
(dissoc not-modified)
(assoc ok {:schema ::wsb/data-changed
:description "Information provided about entity data changes."})
(wnu/response-map)))

(defn conform-data-drop-labels
"Conform data to an 'or' spec, striping away the label.
Expand Down Expand Up @@ -257,7 +264,7 @@
cdata
prov
:batch-size bsize)]
(ok result)))))
(ok {(if add :added :retracted) result})))))

(defn retract-names [request entity-type]
(let [name-attr (keyword entity-type "name")
Expand Down
3 changes: 3 additions & 0 deletions src/wormbase/specs/batch.clj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
(s/def ::status-changed (stc/spec (s/map-of (s/and keyword #{:dead :live :suppressed :retracted})
::success-response)))

(s/def ::data-changed (stc/spec (s/map-of (s/and keyword #{:added :retracted})
::success-response)))

(s/def ::merge-into :gene/id)
(s/def ::merge-from :gene/id)

Expand Down

0 comments on commit 7fc046f

Please sign in to comment.