File tree Expand file tree Collapse file tree 7 files changed +24
-6
lines changed
wire-api/src/Wire/API/Routes/Internal
services/brig/src/Brig/API Expand file tree Collapse file tree 7 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -283,7 +283,7 @@ type GetGroupsInternal =
283283 :> " user-groups"
284284 :> Capture " tid" TeamId
285285 :> QueryParam' [Optional , Strict ] " nameContains" Text. Text
286- :> Get '[Servant. JSON ] UserGroupPage
286+ :> Get '[Servant. JSON ] UserGroupPageWithMembers
287287 )
288288
289289type UpdateGroupInternal =
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ import Wire.API.UserGroup.Pagination
6363import Wire.BrigAPIAccess (BrigAPIAccess (.. ), DeleteGroupManagedError (.. ), OpaqueAuthToken (.. ))
6464import Wire.ParseException
6565import Wire.Rpc
66+ import Debug.Trace
6667
6768interpretBrigAccess ::
6869 ( Member TinyLog r ,
@@ -614,7 +615,8 @@ getGroupsInternal tid mbFilter = do
614615 . paths [" i" , " user-groups" , toByteString' tid]
615616 . maybe id (queryItem " nameContains" . Text. encodeUtf8) maybeDisplayName
616617 . expect2xx
617- decodeBodyOrThrow " brig" r
618+
619+ traceShow r $ decodeBodyOrThrow " brig" r
618620
619621updateGroup ::
620622 (Member Rpc r , Member (Input Endpoint ) r ) =>
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ data UserGroupStore m a where
5353 CreateUserGroup :: TeamId -> NewUserGroup -> ManagedBy -> UserGroupStore m UserGroup
5454 GetUserGroup :: TeamId -> UserGroupId -> Bool -> UserGroupStore m (Maybe UserGroup )
5555 GetUserGroups :: UserGroupPageRequest -> UserGroupStore m UserGroupPage
56+ GetUserGroupsWithMembers :: UserGroupPageRequest -> UserGroupStore m UserGroupPageWithMembers
5657 GetUserGroupsForConv :: ConvId -> UserGroupStore m (Vector UserGroup )
5758 UpdateUserGroup :: TeamId -> UserGroupId -> UserGroupUpdate -> UserGroupStore m (Maybe () )
5859 DeleteUserGroup :: TeamId -> UserGroupId -> UserGroupStore m (Maybe () )
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ interpretUserGroupStoreToPostgres =
6565 CreateUserGroup team newUserGroup managedBy -> createUserGroup team newUserGroup managedBy
6666 GetUserGroup team userGroupId includeChannels -> getUserGroup team userGroupId includeChannels
6767 GetUserGroups req -> getUserGroups req
68+ GetUserGroupsWithMembers req -> getUserGroupsWithMembers req
6869 GetUserGroupsForConv convId -> getUserGroupsForConv convId
6970 UpdateUserGroup tid gid gup -> updateGroup tid gid gup
7071 DeleteUserGroup tid gid -> deleteGroup tid gid
@@ -220,6 +221,20 @@ getUserGroup team id_ includeChannels = do
220221 where ug.id = ($1 :: uuid) and ug.team_id = ($2 :: uuid)
221222 |]
222223
224+ getUserGroupsWithMembers ::
225+ forall r .
226+ ( UserGroupStorePostgresEffectConstraints r ,
227+ Member (Input (Local () )) r
228+ ) =>
229+ UserGroupPageRequest ->
230+ Sem r UserGroupPageWithMembers
231+ getUserGroupsWithMembers req = do
232+ undefined -- userGroupFromMeta <$> getUserGroups req
233+ where
234+ userGroupFromMeta :: UserGroupMeta -> UserGroup
235+ userGroupFromMeta UserGroup_ {.. } = UserGroup_ {members = pure mempty , .. }
236+
237+
223238getUserGroups ::
224239 forall r .
225240 ( UserGroupStorePostgresEffectConstraints r ,
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ data UserGroupSubsystem m a where
7575 -- Internal API handlers
7676 CreateGroupInternal :: ManagedBy -> TeamId -> Maybe UserId -> NewUserGroup -> UserGroupSubsystem r UserGroup
7777 GetGroupInternal :: TeamId -> UserGroupId -> Bool -> UserGroupSubsystem m (Maybe UserGroup )
78- GetGroupsInternal :: TeamId -> Maybe Text -> UserGroupSubsystem m UserGroupPage
78+ GetGroupsInternal :: TeamId -> Maybe Text -> UserGroupSubsystem m UserGroupPageWithMembers
7979 ResetUserGroupInternal :: UpdateGroupInternalRequest -> UserGroupSubsystem m ()
8080
8181makeSem ''UserGroupSubsystem
Original file line number Diff line number Diff line change @@ -282,7 +282,7 @@ getUserGroupsInternal ::
282282 ) =>
283283 TeamId ->
284284 Maybe Text ->
285- Sem r UserGroupPage
285+ Sem r UserGroupPageWithMembers
286286getUserGroupsInternal team displayNameSubstring = do
287287 let -- hscim doesn't support pagination at the time of writing this,
288288 -- so we better fit all groups into one page!
@@ -297,7 +297,7 @@ getUserGroupsInternal team displayNameSubstring = do
297297 includeMemberCount = True ,
298298 includeChannels = False
299299 }
300- Store. getUserGroups pageReq
300+ Store. getUserGroupsWithMembers pageReq
301301
302302updateGroup ::
303303 ( Member UserSubsystem r ,
Original file line number Diff line number Diff line change @@ -1030,7 +1030,7 @@ getGroupsInternalH ::
10301030 ) =>
10311031 TeamId ->
10321032 Maybe T. Text ->
1033- Handler r UserGroupPage
1033+ Handler r UserGroupPageWithMembers
10341034getGroupsInternalH tid nameContains =
10351035 lift . liftSem $ getGroupsInternal tid nameContains
10361036
You can’t perform that action at this time.
0 commit comments