                                            :name name
                                            :version version})]
     (some-> (sc/fetch-one conn sqlv)
-            (usc/normalize-attrs)
-            (decode-data))))
+            (data/normalize-attrs))))
 
-(def ^:private update-collection-scheme
+(def update-collection-scheme
   (assoc create-collection-scheme
          :version [us/required us/integer]))
 

  (let [sqlv (sql/delete-image {:id id :user user})]
    (pos? (sc/execute conn sqlv))))

(def ^:private delete-image-schema
  {:id [us/uuid]
   :user [us/required us/uuid]})


  [conn {:keys [id user file collection]}]
  (let [id (or id (uuid/v4))
        filename (.getFileName ^UploadedFile file)
        ext (FilenameUtils/getExtension filename)
        path @(st/save md/storage (str id "." ext) file)
        sqlv (sql/create-image {:id id
                                :path path
                                :collection collection
                                :user user})]
    (some-> (sc/fetch-one conn sqlv)
            (data/normalize-attrs))))

(def create-image-schema
  {:id [us/uuid]
   :user [us/required us/uuid]
   :file [us/required us/uploaded-file]})
