mirror of
https://github.com/penpot/penpot.git
synced 2025-06-08 20:51:38 +02:00
♻️ Add API consistency fixes for task calling
Also adds a helper for calling tasks synchronously
This commit is contained in:
parent
aa1cf3e03a
commit
ec4260830c
19 changed files with 145 additions and 152 deletions
|
@ -927,11 +927,11 @@
|
|||
{:id file-id}
|
||||
{::db/return-keys [:id :name :is-shared :deleted-at
|
||||
:project-id :created-at :modified-at]})]
|
||||
(wrk/submit! {::wrk/task :delete-object
|
||||
::wrk/conn conn
|
||||
:object :file
|
||||
:deleted-at (:deleted-at file)
|
||||
:id file-id})
|
||||
(wrk/submit! {::db/conn conn
|
||||
::wrk/task :delete-object
|
||||
::wrk/params {:object :file
|
||||
:deleted-at (:deleted-at file)
|
||||
:id file-id}})
|
||||
file))
|
||||
|
||||
(def ^:private
|
||||
|
|
|
@ -258,11 +258,11 @@
|
|||
:code :non-deletable-project
|
||||
:hint "impossible to delete default project"))
|
||||
|
||||
(wrk/submit! {::wrk/task :delete-object
|
||||
::wrk/conn conn
|
||||
:object :project
|
||||
:deleted-at (:deleted-at project)
|
||||
:id project-id})
|
||||
(wrk/submit! {::db/conn conn
|
||||
::wrk/task :delete-object
|
||||
::wrk/params {:object :project
|
||||
:deleted-at (:deleted-at project)
|
||||
:id project-id}})
|
||||
|
||||
project))
|
||||
|
||||
|
|
|
@ -527,11 +527,11 @@
|
|||
:code :non-deletable-team
|
||||
:hint "impossible to delete default team"))
|
||||
|
||||
(wrk/submit! {::wrk/task :delete-object
|
||||
::wrk/conn conn
|
||||
:object :team
|
||||
:deleted-at deleted-at
|
||||
:id team-id})
|
||||
(wrk/submit! {::db/conn conn
|
||||
::wrk/task :delete-object
|
||||
::wrk/params {:object :team
|
||||
:deleted-at deleted-at
|
||||
:id team-id}})
|
||||
team))
|
||||
|
||||
(def ^:private schema:delete-team
|
||||
|
|
|
@ -83,17 +83,17 @@
|
|||
"- Quote ID: '~(::target params)'\n"
|
||||
"- Max: ~(::quote params)\n"
|
||||
"- Total: ~(::total params) (INCR ~(::incr params 1))\n")]
|
||||
(wrk/submit! {::wrk/task :sendmail
|
||||
(wrk/submit! {::db/conn conn
|
||||
::wrk/task :sendmail
|
||||
::wrk/delay (dt/duration "30s")
|
||||
::wrk/max-retries 4
|
||||
::wrk/priority 200
|
||||
::wrk/conn conn
|
||||
::wrk/dedupe true
|
||||
::wrk/label "quotes-notification"
|
||||
:to (vec admins)
|
||||
:subject subject
|
||||
:body [{:type "text/plain"
|
||||
:content content}]}))))
|
||||
::wrk/params {:to (vec admins)
|
||||
:subject subject
|
||||
:body [{:type "text/plain"
|
||||
:content content}]}}))))
|
||||
|
||||
(defn- generic-check!
|
||||
[{:keys [::db/conn ::incr ::quote-sql ::count-sql ::default ::target] :or {incr 1} :as params}]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue