Skip to content

Commit ddc6aca

Browse files
committed
wip
1 parent 0254555 commit ddc6aca

File tree

7 files changed

+24
-6
lines changed

7 files changed

+24
-6
lines changed

libs/wire-api/src/Wire/API/Routes/Internal/Brig.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

289289
type UpdateGroupInternal =

libs/wire-subsystems/src/Wire/BrigAPIAccess/Rpc.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import Wire.API.UserGroup.Pagination
6363
import Wire.BrigAPIAccess (BrigAPIAccess (..), DeleteGroupManagedError (..), OpaqueAuthToken (..))
6464
import Wire.ParseException
6565
import Wire.Rpc
66+
import Debug.Trace
6667

6768
interpretBrigAccess ::
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

619621
updateGroup ::
620622
(Member Rpc r, Member (Input Endpoint) r) =>

libs/wire-subsystems/src/Wire/UserGroupStore.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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 ())

libs/wire-subsystems/src/Wire/UserGroupStore/Postgres.hs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
223238
getUserGroups ::
224239
forall r.
225240
( UserGroupStorePostgresEffectConstraints r,

libs/wire-subsystems/src/Wire/UserGroupSubsystem.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

8181
makeSem ''UserGroupSubsystem

libs/wire-subsystems/src/Wire/UserGroupSubsystem/Interpreter.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ getUserGroupsInternal ::
282282
) =>
283283
TeamId ->
284284
Maybe Text ->
285-
Sem r UserGroupPage
285+
Sem r UserGroupPageWithMembers
286286
getUserGroupsInternal 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

302302
updateGroup ::
303303
( Member UserSubsystem r,

services/brig/src/Brig/API/Internal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ getGroupsInternalH ::
10301030
) =>
10311031
TeamId ->
10321032
Maybe T.Text ->
1033-
Handler r UserGroupPage
1033+
Handler r UserGroupPageWithMembers
10341034
getGroupsInternalH tid nameContains =
10351035
lift . liftSem $ getGroupsInternal tid nameContains
10361036

0 commit comments

Comments
 (0)