mirror of
https://github.com/penpot/penpot.git
synced 2025-05-13 10:56:38 +02: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
|
(ns app.tasks.delete-object
|
||||||
"Generic task for permanent deletion of objects."
|
"Generic task for permanent deletion of objects."
|
||||||
(:require
|
(:require
|
||||||
[clojure.spec.alpha :as s]
|
|
||||||
[clojure.tools.logging :as log]
|
|
||||||
[app.common.exceptions :as ex]
|
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.db :as db]
|
[app.db :as db]
|
||||||
[app.metrics :as mtx]
|
[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 ::type keyword?)
|
||||||
(s/def ::id ::us/uuid)
|
(s/def ::id ::us/uuid)
|
||||||
|
@ -24,10 +22,10 @@
|
||||||
(s/def ::props
|
(s/def ::props
|
||||||
(s/keys :req-un [::id ::type]))
|
(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
|
(defmethod handle-deletion :default
|
||||||
[conn {:keys [type id] :as props}]
|
[_conn {:keys [type]}]
|
||||||
(log/warn "no handler found for" type))
|
(log/warn "no handler found for" type))
|
||||||
|
|
||||||
(defn handler
|
(defn handler
|
||||||
|
|
|
@ -10,13 +10,11 @@
|
||||||
(ns app.tasks.delete-profile
|
(ns app.tasks.delete-profile
|
||||||
"Task for permanent deletion of profiles."
|
"Task for permanent deletion of profiles."
|
||||||
(:require
|
(:require
|
||||||
[clojure.spec.alpha :as s]
|
|
||||||
[clojure.tools.logging :as log]
|
|
||||||
[app.common.exceptions :as ex]
|
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.db :as db]
|
[app.db :as db]
|
||||||
[app.metrics :as mtx]
|
[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-profile-data)
|
||||||
(declare delete-teams)
|
(declare delete-teams)
|
||||||
|
@ -51,11 +49,6 @@
|
||||||
(delete-files conn profile-id)
|
(delete-files conn profile-id)
|
||||||
(delete-profile 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
|
(def ^:private sql:remove-owned-teams
|
||||||
"with teams as (
|
"with teams as (
|
||||||
select distinct
|
select distinct
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
(ns app.tasks.maintenance
|
(ns app.tasks.maintenance
|
||||||
(:require
|
(:require
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.common.exceptions :as ex]
|
|
||||||
[app.config :as cfg]
|
|
||||||
[app.db :as db]
|
[app.db :as db]
|
||||||
[app.metrics :as mtx]
|
[app.metrics :as mtx]
|
||||||
[app.util.time :as dt]
|
[app.util.time :as dt]
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
returning *")
|
returning *")
|
||||||
|
|
||||||
(defn trim-media-storage
|
(defn trim-media-storage
|
||||||
[{:keys [props] :as task}]
|
[_task]
|
||||||
(letfn [(decode-row [{:keys [data] :as row}]
|
(letfn [(decode-row [{:keys [data] :as row}]
|
||||||
(cond-> row
|
(cond-> row
|
||||||
(db/pgobject? data) (assoc :data (db/decode-pgobject data))))
|
(db/pgobject? data) (assoc :data (db/decode-pgobject data))))
|
||||||
|
|
|
@ -9,12 +9,10 @@
|
||||||
|
|
||||||
(ns app.tasks.sendmail
|
(ns app.tasks.sendmail
|
||||||
(:require
|
(: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.config :as cfg]
|
||||||
[app.metrics :as mtx]))
|
[app.metrics :as mtx]
|
||||||
|
[app.util.emails :as emails]
|
||||||
|
[clojure.tools.logging :as log]))
|
||||||
|
|
||||||
(defn- send-console!
|
(defn- send-console!
|
||||||
[config email]
|
[config email]
|
||||||
|
|
|
@ -9,15 +9,12 @@
|
||||||
|
|
||||||
(ns app.tasks.trim-file
|
(ns app.tasks.trim-file
|
||||||
(:require
|
(: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.config :as cfg]
|
||||||
[app.db :as db]
|
[app.db :as db]
|
||||||
[app.tasks :as tasks]
|
[app.tasks :as tasks]
|
||||||
[app.util.blob :as blob]
|
[app.util.blob :as blob]
|
||||||
[app.util.time :as dt]))
|
[app.util.time :as dt]
|
||||||
|
[clojure.tools.logging :as log]))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Task: Trim File
|
;; Task: Trim File
|
||||||
|
@ -27,7 +24,7 @@
|
||||||
;; associated with file but not used by any page.
|
;; associated with file but not used by any page.
|
||||||
|
|
||||||
(defn decode-row
|
(defn decode-row
|
||||||
[{:keys [data metadata changes] :as row}]
|
[{:keys [data] :as row}]
|
||||||
(cond-> row
|
(cond-> row
|
||||||
(bytes? data) (assoc :data (blob/decode data))))
|
(bytes? data) (assoc :data (blob/decode data))))
|
||||||
|
|
||||||
|
@ -90,7 +87,7 @@
|
||||||
nil)))
|
nil)))
|
||||||
|
|
||||||
(defn handler
|
(defn handler
|
||||||
[{:keys [props] :as task}]
|
[_task]
|
||||||
(log/debug "Running 'trim-file' task.")
|
(log/debug "Running 'trim-file' task.")
|
||||||
(loop []
|
(loop []
|
||||||
(let [files (retrieve-candidates db/pool)]
|
(let [files (retrieve-candidates db/pool)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue