mirror of
https://github.com/penpot/penpot.git
synced 2025-05-15 23:36:37 +02:00
Merge remote-tracking branch 'origin/main' into develop
This commit is contained in:
commit
6d5276c0c6
10 changed files with 100 additions and 83 deletions
|
@ -65,9 +65,7 @@
|
|||
"- detail: " (cfg/get :public-uri) "/dbg/error-by-id/" id "\n"
|
||||
"- profile-id: `" (:profile-id cdata) "`\n"
|
||||
"- host: `" host "`\n"
|
||||
"- version: `" version "`\n"
|
||||
(when error
|
||||
(str "```\n" (:trace error) "\n```")))
|
||||
"- version: `" version "`\n")
|
||||
rsp (http/send! {:uri uri
|
||||
:method :post
|
||||
:headers {"content-type" "application/json"}
|
||||
|
|
|
@ -41,29 +41,27 @@
|
|||
{:id uuid/zero
|
||||
:fullname "Anonymous User"}))
|
||||
|
||||
;; NOTE: this query make the assumption that union all preserves the
|
||||
;; order so the first id will always be the team id and the second the
|
||||
;; project_id; this is a postgresql behavior because UNION ALL works
|
||||
;; like APPEND operation.
|
||||
|
||||
(def ^:private sql:default-team-and-project
|
||||
"select t.id
|
||||
(def ^:private sql:default-profile-team
|
||||
"select t.id, name
|
||||
from team as t
|
||||
inner join team_profile_rel as tp on (tp.team_id = t.id)
|
||||
where tp.profile_id = ?
|
||||
and tp.is_owner is true
|
||||
and t.is_default is true
|
||||
union all
|
||||
select p.id
|
||||
and t.is_default is true")
|
||||
|
||||
(def ^:private sql:default-profile-project
|
||||
"select p.id, name
|
||||
from project as p
|
||||
inner join project_profile_rel as tp on (tp.project_id = p.id)
|
||||
where tp.profile_id = ?
|
||||
and tp.is_owner is true
|
||||
and p.is_default is true")
|
||||
and p.is_default is true
|
||||
and p.team_id = ?")
|
||||
|
||||
(defn retrieve-additional-data
|
||||
[conn id]
|
||||
(let [[team project] (db/exec! conn [sql:default-team-and-project id id])]
|
||||
(let [team (db/exec-one! conn [sql:default-profile-team id])
|
||||
project (db/exec-one! conn [sql:default-profile-project id (:id team)])]
|
||||
{:default-team-id (:id team)
|
||||
:default-project-id (:id project)}))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue