diff --git a/backend/src/app/rpc/commands/files_thumbnails.clj b/backend/src/app/rpc/commands/files_thumbnails.clj index 712c21204..373683840 100644 --- a/backend/src/app/rpc/commands/files_thumbnails.clj +++ b/backend/src/app/rpc/commands/files_thumbnails.clj @@ -285,26 +285,29 @@ (sv/defmethod ::create-file-object-thumbnail {::doc/added "1.19" ::doc/module :files - ::climit/id :file-thumbnail-ops + ::climit/id :file-thumbnail-ops/by-profile ::climit/key-fn ::rpc/profile-id + + ::rtry/enabled true + ::rtry/when rtry/conflict-exception? + ::audit/skip true ::sm/params schema:create-file-object-thumbnail} [cfg {:keys [::rpc/profile-id file-id object-id media tag]}] + (media/validate-media-type! media) + (media/validate-media-size! media) + (db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}] (files/check-edition-permissions! conn profile-id file-id) - (media/validate-media-type! media) - (media/validate-media-size! media) - (when-not (db/read-only? conn) (let [cfg (-> cfg (update ::sto/storage media/configure-assets-storage) (assoc ::rtry/when rtry/conflict-exception?) (assoc ::rtry/max-retries 5) (assoc ::rtry/label "create-file-object-thumbnail"))] - (rtry/invoke cfg create-file-object-thumbnail! - file-id object-id media (or tag "frame"))))))) + (create-file-object-thumbnail! cfg file-id object-id media (or tag "frame"))))))) ;; --- MUTATION COMMAND: delete-file-object-thumbnail @@ -400,6 +403,8 @@ ::audit/skip true ::climit/id :file-thumbnail-ops ::climit/key-fn ::rpc/profile-id + ::rtry/enabled true + ::rtry/when rtry/conflict-exception? ::sm/params [:map {:title "create-file-thumbnail"} [:file-id ::sm/uuid] [:revn :int] @@ -409,10 +414,6 @@ (db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}] (files/check-edition-permissions! conn profile-id file-id) (when-not (db/read-only? conn) - (let [cfg (-> cfg - (update ::sto/storage media/configure-assets-storage) - (assoc ::rtry/when rtry/conflict-exception?) - (assoc ::rtry/max-retries 5) - (assoc ::rtry/label "create-thumbnail")) - media (rtry/invoke cfg create-file-thumbnail! params)] + (let [cfg (update cfg ::sto/storage media/configure-assets-storage) + media (create-file-thumbnail! cfg params)] {:uri (files/resolve-public-uri (:id media))})))))