mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
🐛 Fix wrong query for obtain profile default project-id.
This commit is contained in:
parent
9fcddc37f6
commit
2c96ecac87
2 changed files with 11 additions and 12 deletions
|
@ -13,6 +13,7 @@
|
|||
### :bug: Bugs fixed
|
||||
|
||||
- Fix problem with `close-path` command [#917](https://github.com/penpot/penpot/issues/917)
|
||||
- Fix wrong query for obtain the profile default project-id
|
||||
|
||||
## 1.5.1-alpha
|
||||
|
||||
|
|
|
@ -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
Reference in a new issue