From 7cfe768dbd430d52612c0f1806c45a28c3c8c6a9 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Sun, 24 Jan 2021 16:05:39 +0100 Subject: [PATCH] :sparkles: Add helper for access file data on server repl. --- backend/src/app/srepl/main.clj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/src/app/srepl/main.clj b/backend/src/app/srepl/main.clj index 7225bbf5d..a923449f8 100644 --- a/backend/src/app/srepl/main.clj +++ b/backend/src/app/srepl/main.clj @@ -34,6 +34,15 @@ {:data data} {:id id}))) +(defn get-file + [id] + (with-open [conn (db/open (:app.db/pool system))] + (let [file (db/get-by-id conn :file id)] + (-> file + (update :data app.util.blob/decode) + (update :data pmg/migrate-data))))) + + ;; Examples ;; (def backup (update-file #uuid "1586e1f0-3e02-11eb-b1d2-556a2f641513" identity)) ;; (def x (update-file #uuid "1586e1f0-3e02-11eb-b1d2-556a2f641513" (fn [{:keys [data] :as file}] (update-in data [:pages-index #uuid "878278c0-3ef0-11eb-9d67-8551e7624f43" :objects] dissoc nil))))