0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

🎉 Add a query impl for retrieve a single page by id.

This commit is contained in:
Andrey Antukh 2019-11-27 15:32:29 +01:00
parent 3fcbb204cf
commit 69e9247fb6

View file

@ -53,6 +53,24 @@
(-> (db/query db/pool [sql project-id user])
(p/then #(mapv decode-row %)))))
;; --- Query: Page by Id
(s/def ::page
(s/keys :req-un [::user ::id]))
(sv/defquery :page
{:doc "Retrieve page by id."
:spec ::page}
[{:keys [user id] :as params}]
(let [sql "select pg.*,
pg.data,
pg.metadata
from pages as pg
where pg.user_id = $2
and pg.id = $1
and pg.deleted_at is null"]
(-> (db/query-one db/pool [sql id user])
(p/then' decode-row))))
;; --- Query: Page History