mirror of
https://github.com/penpot/penpot.git
synced 2025-07-16 21:45:15 +02:00
✨ Add editors count to get-owned-teams rpc method response
This commit is contained in:
parent
f02dd9f8dc
commit
71f5806e23
2 changed files with 8 additions and 4 deletions
|
@ -192,7 +192,8 @@
|
|||
|
||||
(def ^:private sql:get-owned-teams
|
||||
"SELECT t.id, t.name,
|
||||
(SELECT count(*) FROM team_profile_rel WHERE team_id=t.id) AS total_members
|
||||
(SELECT count(*) FROM team_profile_rel WHERE team_id=t.id) AS total_members,
|
||||
(SELECT count(*) FROM team_profile_rel WHERE team_id=t.id AND can_edit=true) AS total_editors
|
||||
FROM team AS t
|
||||
JOIN team_profile_rel AS tpr ON (tpr.team_id = t.id)
|
||||
WHERE t.is_default IS false
|
||||
|
|
|
@ -460,11 +460,14 @@
|
|||
::rpc/profile-id (:id profile1)}
|
||||
out (th/command! params)]
|
||||
|
||||
;; (th/print-result! out)
|
||||
(t/is (th/success? out))
|
||||
(let [result (:result out)]
|
||||
(let [[item1 :as result] (:result out)]
|
||||
(t/is (= 1 (count result)))
|
||||
(t/is (= (:id team1) (-> result first :id)))
|
||||
(t/is (not= (:default-team-id profile1) (-> result first :id))))))
|
||||
(t/is (= (:id team1) (:id item1)))
|
||||
(t/is (= 1 (:total-members item1)))
|
||||
(t/is (= 1 (:total-editors item1)))
|
||||
(t/is (not= (:default-team-id profile1) (:id item1))))))
|
||||
|
||||
|
||||
(t/deftest team-deletion-1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue