mirror of
https://github.com/penpot/penpot.git
synced 2025-06-02 11:31:39 +02:00
✨ Improve snapshot related internal API
This commit also adds the ability to take snapshot of all files of the team in a single run/transaction.
This commit is contained in:
parent
aaf457a792
commit
6d35cb2eb4
7 changed files with 433 additions and 286 deletions
|
@ -1497,7 +1497,7 @@
|
|||
(-> (db/get system :team {:id team-id}
|
||||
{::db/remove-deleted false
|
||||
::db/check-deleted false})
|
||||
(decode-row)))
|
||||
(update :features db/decode-pgarray #{})))
|
||||
|
||||
(defn- validate-file!
|
||||
[file libs]
|
||||
|
@ -1546,19 +1546,21 @@
|
|||
AND f.deleted_at IS NULL
|
||||
FOR UPDATE")
|
||||
|
||||
(defn get-and-lock-files
|
||||
(defn get-and-lock-team-files
|
||||
[conn team-id]
|
||||
(->> (db/cursor conn [sql:get-and-lock-team-files team-id])
|
||||
(map :id)))
|
||||
|
||||
(defn update-team!
|
||||
[conn team]
|
||||
(let [params (-> team
|
||||
[system {:keys [id] :as team}]
|
||||
(let [conn (db/get-connection system)
|
||||
params (-> team
|
||||
(update :features db/encode-pgarray conn "text")
|
||||
(dissoc :id))]
|
||||
(db/update! conn :team
|
||||
params
|
||||
{:id (:id team)})))
|
||||
{:id id})
|
||||
team))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; PUBLIC API
|
||||
|
@ -1657,7 +1659,7 @@
|
|||
:id id})
|
||||
|
||||
(run! (partial migrate-file system)
|
||||
(get-and-lock-files conn id))
|
||||
(get-and-lock-team-files conn id))
|
||||
|
||||
(->> (assoc team :features features)
|
||||
(update-team! conn))))))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue