From 7aae12c732fee47010c493ea6c40a60b9a696555 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 1 Sep 2023 12:45:06 +0200 Subject: [PATCH] :bug: Fix clone operaton of dbg handler --- backend/src/app/http/debug.clj | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/backend/src/app/http/debug.clj b/backend/src/app/http/debug.clj index cf98b3f7b..1b9995069 100644 --- a/backend/src/app/http/debug.clj +++ b/backend/src/app/http/debug.clj @@ -111,15 +111,18 @@ (contains? params :clone) (let [profile (profile/get-profile pool profile-id) - project-id (:default-project-id profile) - data (blob/decode data)] - (create-file pool {:id (uuid/next) - :name (str "Cloned file: " filename) - :project-id project-id - :profile-id profile-id - :data data}) - {::yrs/status 201 - ::yrs/body "OK CREATED"}) + project-id (:default-project-id profile)] + + (db/run! pool (fn [{:keys [::db/conn]}] + (create-file conn {:id file-id + :name (str "Cloned file: " filename) + :project-id project-id + :profile-id profile-id}) + (db/update! conn :file + {:data data} + {:id file-id}) + {::yrs/status 201 + ::yrs/body "OK CREATED"}))) :else (prepare-response (blob/decode data))))))