mirror of
https://github.com/penpot/penpot.git
synced 2025-05-14 01:27:50 +02: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
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
- Fix problem with `close-path` command [#917](https://github.com/penpot/penpot/issues/917)
|
- 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
|
## 1.5.1-alpha
|
||||||
|
|
||||||
|
|
|
@ -41,29 +41,27 @@
|
||||||
{:id uuid/zero
|
{:id uuid/zero
|
||||||
:fullname "Anonymous User"}))
|
:fullname "Anonymous User"}))
|
||||||
|
|
||||||
;; NOTE: this query make the assumption that union all preserves the
|
(def ^:private sql:default-profile-team
|
||||||
;; order so the first id will always be the team id and the second the
|
"select t.id, name
|
||||||
;; project_id; this is a postgresql behavior because UNION ALL works
|
|
||||||
;; like APPEND operation.
|
|
||||||
|
|
||||||
(def ^:private sql:default-team-and-project
|
|
||||||
"select t.id
|
|
||||||
from team as t
|
from team as t
|
||||||
inner join team_profile_rel as tp on (tp.team_id = t.id)
|
inner join team_profile_rel as tp on (tp.team_id = t.id)
|
||||||
where tp.profile_id = ?
|
where tp.profile_id = ?
|
||||||
and tp.is_owner is true
|
and tp.is_owner is true
|
||||||
and t.is_default is true
|
and t.is_default is true")
|
||||||
union all
|
|
||||||
select p.id
|
(def ^:private sql:default-profile-project
|
||||||
|
"select p.id, name
|
||||||
from project as p
|
from project as p
|
||||||
inner join project_profile_rel as tp on (tp.project_id = p.id)
|
inner join project_profile_rel as tp on (tp.project_id = p.id)
|
||||||
where tp.profile_id = ?
|
where tp.profile_id = ?
|
||||||
and tp.is_owner is true
|
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
|
(defn retrieve-additional-data
|
||||||
[conn id]
|
[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-team-id (:id team)
|
||||||
:default-project-id (:id project)}))
|
:default-project-id (:id project)}))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue