Felienne Hermans
Felienne Hermans
December 10th, 2021

Code Reading Club Reading Countdown - 10

Article cover photo

Countdown - Snippet 10

Today's code reading countdown in Clojure.

Snippet

CRCRC-10

Snippet in text

(sv/defmethod ::viewer-bundle {:auth false}
  [{:keys [pool] :as cfg} {:keys [profile-id file-id page-id token] :as params}]
  (db/with-atomic [conn pool]
    (let [file    (files/retrieve-file conn file-id)
          project (retrieve-project conn (:project-id file))
          page    (get-in file [:data :pages-index page-id])
          file    (merge (dissoc file :data)
                         (select-keys (:data file) [:colors :media :typographies]))
          users   (teams/retrieve-users conn (:team-id project))

          bundle  {:file file
                   :page page
                   :users users
                   :project project}]

      (if (string? token)
        (do
          (check-shared-token! conn file-id page-id token)
          (assoc bundle :token token))
        (let [stoken (retrieve-shared-token conn file-id page-id)]
          (files/check-read-permissions! conn profile-id file-id)
          (assoc bundle :token (:token stoken)))))))

Question

What data types are present in this snippet?

Submission

Submit your answer in our form.