Improve team deletion process.

This commit is contained in:
Andrey Antukh 2021-11-25 12:36:09 +01:00 committed by Andrés Moya
parent e7a1833c44
commit 0dd805da7f
8 changed files with 57 additions and 30 deletions

View file

@ -104,6 +104,8 @@
;; --- Mutation: Leave Team
(declare role->params)
(s/def ::reassign-to ::us/uuid)
(s/def ::leave-team
(s/keys :req-un [::profile-id ::id]
@ -120,7 +122,7 @@
;; besides the current profile
(<= (count members) 1)
(ex/raise :type :validation
:code :cant-leave-team
:code :no-enough-members-for-leave
:context {:members (count members)})
;; if the `reassign-to` is filled and has a different value
@ -183,7 +185,6 @@
;; --- Mutation: Team Update Role
(declare retrieve-team-member)
(declare role->params)
(s/def ::team-id ::us/uuid)
(s/def ::member-id ::us/uuid)

View file

@ -21,8 +21,10 @@
tpr.is_admin,
tpr.can_edit
from team_profile_rel as tpr
join team as t on (t.id = tpr.team_id)
where tpr.profile_id = ?
and tpr.team_id = ?")
and tpr.team_id = ?
and t.deleted_at is null")
(defn get-permissions
[conn profile-id team-id]