indentation

This commit is contained in:
Gered 2013-05-22 23:36:25 -04:00
parent 7a559a40df
commit e4a38bca70

View file

@ -8,31 +8,31 @@
(defn get-file [file]
(let [f (ensure-prefix file "/")]
(couch/with-db files
(if-let [file-info (->first-view-value
(couch/get-view "files" "listPublished" {:key f}))]
(let [id (:_id file-info)
attachment (:filename file-info)
attachment-info (second (first (:_attachments file-info)))
gz (couch/get-attachment id attachment)]
(if gz
(merge
{:data gz}
attachment-info)))))))
(if-let [file-info (->first-view-value
(couch/get-view "files" "listPublished" {:key f}))]
(let [id (:_id file-info)
attachment (:filename file-info)
attachment-info (second (first (:_attachments file-info)))
gz (couch/get-attachment id attachment)]
(if gz
(merge
{:data gz}
attachment-info)))))))
(defn list-files [path]
(let [p (ensure-prefix-suffix path "/")]
(if-let [file-list (->view-values
(couch/with-db files
(couch/get-view "files" "listPublishedByPath" {:key p})))]
(map
(fn [f]
(let [attachment (second (first (:_attachments f)))]
{:id (:_id f)
:filename (:filename f)
:last_modified (parse-timestamp (:last_modified_at f))
:content-type (:content_type attachment)
:size (:length attachment)}))
file-list))))
(couch/with-db files
(couch/get-view "files" "listPublishedByPath" {:key p})))]
(map
(fn [f]
(let [attachment (second (first (:_attachments f)))]
{:id (:_id f)
:filename (:filename f)
:last_modified (parse-timestamp (:last_modified_at f))
:content-type (:content_type attachment)
:size (:length attachment)}))
file-list))))
(defn get-tree []
(->view-keys