mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 09:46:37 +02:00
✨ Make file to library link idempotent.
And remove unused api calls.
This commit is contained in:
parent
b2957c5f35
commit
fca48e39ee
4 changed files with 16 additions and 47 deletions
|
@ -162,11 +162,14 @@
|
|||
(files/check-edition-permissions! conn profile-id file-id)
|
||||
(link-file-to-library conn params)))
|
||||
|
||||
(def sql:link-file-to-library
|
||||
"insert into file_library_rel (file_id, library_file_id)
|
||||
values (?, ?)
|
||||
on conflict do nothing;")
|
||||
|
||||
(defn- link-file-to-library
|
||||
[conn {:keys [file-id library-id] :as params}]
|
||||
(db/insert! conn :file-library-rel
|
||||
{:file-id file-id
|
||||
:library-file-id library-id}))
|
||||
(db/exec-one! conn [sql:link-file-to-library file-id library-id]))
|
||||
|
||||
|
||||
;; --- Mutation: Unlink file from library
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
(s/def ::team-id ::us/uuid)
|
||||
(s/def ::url ::us/url)
|
||||
|
||||
|
||||
;; --- Create Media object (Upload and create from url)
|
||||
|
||||
(declare create-media-object)
|
||||
|
|
|
@ -55,13 +55,3 @@
|
|||
[conn {:keys [id] :as props}]
|
||||
(let [sql "delete from media_object where id=? and deleted_at is not null"]
|
||||
(db/exec-one! conn [sql id])))
|
||||
|
||||
(defmethod handle-deletion :color
|
||||
[conn {:keys [id] :as props}]
|
||||
(let [sql "delete from color where id=? and deleted_at is not null"]
|
||||
(db/exec-one! conn [sql id])))
|
||||
|
||||
(defmethod handle-deletion :page
|
||||
[conn {:keys [id] :as props}]
|
||||
(let [sql "delete from page where id=? and deleted_at is not null"]
|
||||
(db/exec-one! conn [sql id])))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue