mirror of
https://github.com/penpot/penpot.git
synced 2025-01-25 07:58:49 -05:00
✨ Fix linter issues on backend tasks ns directory.
This commit is contained in:
parent
ce3c055819
commit
6881e3d795
6 changed files with 14 additions and 30 deletions
|
@ -10,13 +10,11 @@
|
|||
(ns app.tasks.delete-object
|
||||
"Generic task for permanent deletion of objects."
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.metrics :as mtx]
|
||||
[app.util.storage :as ust]))
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]))
|
||||
|
||||
(s/def ::type keyword?)
|
||||
(s/def ::id ::us/uuid)
|
||||
|
@ -24,10 +22,10 @@
|
|||
(s/def ::props
|
||||
(s/keys :req-un [::id ::type]))
|
||||
|
||||
(defmulti handle-deletion (fn [conn props] (:type props)))
|
||||
(defmulti handle-deletion (fn [_ props] (:type props)))
|
||||
|
||||
(defmethod handle-deletion :default
|
||||
[conn {:keys [type id] :as props}]
|
||||
[_conn {:keys [type]}]
|
||||
(log/warn "no handler found for" type))
|
||||
|
||||
(defn handler
|
||||
|
|
|
@ -10,13 +10,11 @@
|
|||
(ns app.tasks.delete-profile
|
||||
"Task for permanent deletion of profiles."
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.db :as db]
|
||||
[app.metrics :as mtx]
|
||||
[app.util.storage :as ust]))
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]))
|
||||
|
||||
(declare delete-profile-data)
|
||||
(declare delete-teams)
|
||||
|
@ -51,11 +49,6 @@
|
|||
(delete-files conn profile-id)
|
||||
(delete-profile conn profile-id))
|
||||
|
||||
(def ^:private sql:select-profile
|
||||
"select id, is_demo, deleted_at
|
||||
from profile
|
||||
where id=? for update")
|
||||
|
||||
(def ^:private sql:remove-owned-teams
|
||||
"with teams as (
|
||||
select distinct
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
(ns app.tasks.maintenance
|
||||
(:require
|
||||
[app.common.spec :as us]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.metrics :as mtx]
|
||||
[app.util.time :as dt]
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
returning *")
|
||||
|
||||
(defn trim-media-storage
|
||||
[{:keys [props] :as task}]
|
||||
[_task]
|
||||
(letfn [(decode-row [{:keys [data] :as row}]
|
||||
(cond-> row
|
||||
(db/pgobject? data) (assoc :data (db/decode-pgobject data))))
|
||||
|
|
|
@ -9,12 +9,10 @@
|
|||
|
||||
(ns app.tasks.sendmail
|
||||
(:require
|
||||
[clojure.tools.logging :as log]
|
||||
[app.common.data :as d]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.util.emails :as emails]
|
||||
[app.config :as cfg]
|
||||
[app.metrics :as mtx]))
|
||||
[app.metrics :as mtx]
|
||||
[app.util.emails :as emails]
|
||||
[clojure.tools.logging :as log]))
|
||||
|
||||
(defn- send-console!
|
||||
[config email]
|
||||
|
|
|
@ -9,15 +9,12 @@
|
|||
|
||||
(ns app.tasks.trim-file
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.tools.logging :as log]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.spec :as us]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
[app.tasks :as tasks]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.time :as dt]))
|
||||
[app.util.time :as dt]
|
||||
[clojure.tools.logging :as log]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Task: Trim File
|
||||
|
@ -27,7 +24,7 @@
|
|||
;; associated with file but not used by any page.
|
||||
|
||||
(defn decode-row
|
||||
[{:keys [data metadata changes] :as row}]
|
||||
[{:keys [data] :as row}]
|
||||
(cond-> row
|
||||
(bytes? data) (assoc :data (blob/decode data))))
|
||||
|
||||
|
@ -90,7 +87,7 @@
|
|||
nil)))
|
||||
|
||||
(defn handler
|
||||
[{:keys [props] :as task}]
|
||||
[_task]
|
||||
(log/debug "Running 'trim-file' task.")
|
||||
(loop []
|
||||
(let [files (retrieve-candidates db/pool)]
|
||||
|
|
Loading…
Add table
Reference in a new issue