 
 (defn get-institution-imagery [{:keys [params]}]
   (let [institution-id (tc/str->int (:institutionId params))
-        user-id        (tc/str->int (:userId params))]
+        user-id        (:userId params)]
     (data-response (prepare-imagery (call-sql "select_imagery_by_institution" institution-id user-id)
                                     (is-inst-admin-query? user-id institution-id)))))
 
 (defn get-project-imagery [{:keys [params]}]
   (let [project-id (tc/str->int (:projectId params))
-        user-id    (tc/str->int (:userId params))
-        token-key   (:tokenKey params)]
+        user-id    (:userId params)
+        token-key  (:tokenKey params)]
     (data-response (prepare-imagery (call-sql "select_imagery_by_project" project-id user-id token-key)
                                     false))))
 

  (let [institution-id       (tc/str->int (:institutionId params))
        imagery-title        (:imageryTitle params)
        imagery-attribution  (:imageryAttribution params)
        source-config        (tc/json->jsonb (:sourceConfig params))
        add-to-all-projects? (tc/str->bool (:addToAllProjects params) true)]
    (if (sql-primitive (call-sql "imagery_name_taken" institution-id imagery-title -1))
      (data-response "The title you have chosen is already taken.")

  (let [imagery-id           (tc/str->int (:imageryId params))
        imagery-title        (:imageryTitle params)
        imagery-attribution  (:imageryAttribution params)
        source-config        (tc/clj->jsonb (:sourceConfig params))
        add-to-all-projects? (tc/str->bool (:addToAllProjects params) true)
        institution-id       (:institution_id (get-imagery-by-id imagery-id))]
    (if (sql-primitive (call-sql "imagery_name_taken" institution-id imagery-title imagery-id))
      (data-response "The title you have chosen is already taken.")
      (do
        (call-sql "update_institution_imagery"
