Skip to content

Commit

Permalink
Fix conditional to add files URLs in detail API
Browse files Browse the repository at this point in the history
[Re #1543]

* The conditional was wrong. It should be a cond instead of cond->. We
can only apply a single update not many in this case.
  • Loading branch information
lucassousaf committed Aug 16, 2023
1 parent 3934e38 commit 934b40b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions backend/src/gpml/handler/detail.clj
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,16 @@
(map dom.file/decode-file)
(srv.file/add-files-urls config)
(medley/index-by (comp str :id)))]
(cond-> resource
(cond
(= "stakeholder" resource-type)
(assoc :picture (get-in files-w-urls [picture_id :url]))
(assoc resource :picture (get-in files-w-urls [picture_id :url]))

(= "organisation" resource-type)
(assoc :logo (get-in files-w-urls [logo_id :url]))
(assoc resource :logo (get-in files-w-urls [logo_id :url]))

:else
(assoc :image (get-in files-w-urls [image_id :url])
(assoc resource
:image (get-in files-w-urls [image_id :url])
:thumbnail (get-in files-w-urls [thumbnail_id :url])))))

(defn- add-extra-details
Expand Down

0 comments on commit 934b40b

Please sign in to comment.