0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-11 23:31:21 -05:00

Merge pull request #4806 from penpot/niwinz-bugfix-10

🐛 Properly report erorrs on importation
This commit is contained in:
Alejandro 2024-06-27 07:37:58 +02:00 committed by GitHub
commit ff4d66ec75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 45 additions and 15 deletions

View file

@ -61,6 +61,8 @@
(let [result (handler)] (let [result (handler)]
(events/tap :end result)) (events/tap :end result))
(catch Throwable cause (catch Throwable cause
(l/err :hint "unexpected error on processing sse response"
:cause cause)
(events/tap :error (errors/handle' cause request))) (events/tap :error (errors/handle' cause request)))
(finally (finally
(sp/close! events/*channel*) (sp/close! events/*channel*)

View file

@ -30,14 +30,12 @@
;; --- Command: export-binfile ;; --- Command: export-binfile
(def ^:private (def ^:private schema:export-binfile
schema:export-binfile [:map {:title "export-binfile"}
(sm/define [:name :string]
[:map {:title "export-binfile"} [:file-id ::sm/uuid]
[:name :string] [:include-libraries :boolean]
[:file-id ::sm/uuid] [:embed-assets :boolean]])
[:include-libraries :boolean]
[:embed-assets :boolean]]))
(sv/defmethod ::export-binfile (sv/defmethod ::export-binfile
"Export a penpot file in a binary format." "Export a penpot file in a binary format."
@ -76,13 +74,11 @@
{:id project-id}) {:id project-id})
result)) result))
(def ^:private (def ^:private schema:import-binfile
schema:import-binfile [:map {:title "import-binfile"}
(sm/define [:name :string]
[:map {:title "import-binfile"} [:project-id ::sm/uuid]
[:name :string] [:file ::media/upload]])
[:project-id ::sm/uuid]
[:file ::media/upload]]))
(sv/defmethod ::import-binfile (sv/defmethod ::import-binfile
"Import a penpot file in a binary format." "Import a penpot file in a binary format."

View file

@ -582,6 +582,38 @@
:deleted-at (dt/now) :deleted-at (dt/now)
:id file-id}))))) :id file-id})))))
(defn process-deleted-teams-cascade
[]
(->> (db/exec! main/system ["select id, deleted_at from team where deleted_at is not null"])
(run! (fn [{:keys [id deleted-at]}]
(wrk/invoke! (-> main/system
(assoc ::wrk/task :delete-object)
(assoc ::wrk/params {:object :team
:deleted-at deleted-at
:id id})))))))
(defn process-deleted-projects-cascade
[]
(->> (db/exec! main/system ["select id, deleted_at from project where deleted_at is not null"])
(run! (fn [{:keys [id deleted-at]}]
(wrk/invoke! (-> main/system
(assoc ::wrk/task :delete-object)
(assoc ::wrk/params {:object :project
:deleted-at deleted-at
:id id})))))))
(defn process-deleted-files-cascade
[]
(->> (db/exec! main/system ["select id, deleted_at from file where deleted_at is not null"])
(run! (fn [{:keys [id deleted-at]}]
(wrk/invoke! (-> main/system
(assoc ::wrk/task :delete-object)
(assoc ::wrk/params {:object :file
:deleted-at deleted-at
:id id})))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MISC ;; MISC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;