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