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:
parent
3fcbb204cf
commit
69e9247fb6
1 changed files with 18 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue