@@ -43,7 +43,7 @@ func (h *UserGroupHandler) CreateUserGroup(ctx context.Context, req *connect.Req
4343 // Check name uniqueness — distinguishing NotFound from a transient
4444 // DB error matters: silently treating any error as "name available"
4545 // would let a concurrent CreateUserGroup succeed twice on a flaky DB.
46- _ , err := h .store .Queries ().GetUserGroupByName (ctx , req .Msg .Name )
46+ _ , err := h .store .Repos ().UserGroup . GetByName (ctx , req .Msg .Name )
4747 if err == nil {
4848 return nil , apiErrorCtx (ctx , ErrUserGroupNameExists , connect .CodeAlreadyExists , "user group name already exists" )
4949 }
@@ -88,7 +88,7 @@ func (h *UserGroupHandler) CreateUserGroup(ctx context.Context, req *connect.Req
8888 return nil , err
8989 }
9090
91- group , err := h .store .Queries ().GetUserGroupByID (ctx , id )
91+ group , err := h .store .Repos ().UserGroup . Get (ctx , id )
9292 if err != nil {
9393 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to read user group" )
9494 }
@@ -104,7 +104,7 @@ func (h *UserGroupHandler) GetUserGroup(ctx context.Context, req *connect.Reques
104104 return nil , err
105105 }
106106
107- group , err := h .store .Queries ().GetUserGroupByID (ctx , req .Msg .Id )
107+ group , err := h .store .Repos ().UserGroup . Get (ctx , req .Msg .Id )
108108 if err != nil {
109109 return nil , handleGetError (ctx , err , ErrUserGroupNotFound , "user group not found" )
110110 }
@@ -114,7 +114,7 @@ func (h *UserGroupHandler) GetUserGroup(ctx context.Context, req *connect.Reques
114114 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to get group roles" )
115115 }
116116
117- members , err := h .store .Queries ().ListUserGroupMembers (ctx , req .Msg .Id )
117+ members , err := h .store .Repos ().UserGroup . ListMembers (ctx , req .Msg .Id )
118118 if err != nil {
119119 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to get group members" )
120120 }
@@ -143,15 +143,12 @@ func (h *UserGroupHandler) ListUserGroups(ctx context.Context, req *connect.Requ
143143 return nil , err
144144 }
145145
146- groups , err := h .store .Queries ().ListUserGroups (ctx , db.ListUserGroupsParams {
147- Limit : pageSize ,
148- Offset : offset ,
149- })
146+ groups , err := h .store .Repos ().UserGroup .List (ctx , store.ListUserGroupsFilter {Limit : pageSize , Offset : offset })
150147 if err != nil {
151148 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to list user groups" )
152149 }
153150
154- count , err := h .store .Queries ().CountUserGroups (ctx )
151+ count , err := h .store .Repos ().UserGroup . Count (ctx )
155152 if err != nil {
156153 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to count user groups" )
157154 }
@@ -178,7 +175,7 @@ func (h *UserGroupHandler) UpdateUserGroup(ctx context.Context, req *connect.Req
178175 return nil , err
179176 }
180177
181- _ , err := h .store .Queries ().GetUserGroupByID (ctx , req .Msg .GroupId )
178+ _ , err := h .store .Repos ().UserGroup . Get (ctx , req .Msg .GroupId )
182179 if err != nil {
183180 return nil , handleGetError (ctx , err , ErrUserGroupNotFound , "user group not found" )
184181 }
@@ -202,7 +199,7 @@ func (h *UserGroupHandler) UpdateUserGroup(ctx context.Context, req *connect.Req
202199 return nil , err
203200 }
204201
205- updated , err := h .store .Queries ().GetUserGroupByID (ctx , req .Msg .GroupId )
202+ updated , err := h .store .Repos ().UserGroup . Get (ctx , req .Msg .GroupId )
206203 if err != nil {
207204 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to read user group" )
208205 }
@@ -235,7 +232,7 @@ func (h *UserGroupHandler) SetUserGroupMaintenanceWindow(ctx context.Context, re
235232 return nil , apiErrorCtx (ctx , ErrValidationFailed , connect .CodeInvalidArgument , err .Error ())
236233 }
237234
238- if _ , err := h .store .Queries ().GetUserGroupByID (ctx , req .Msg .Id ); err != nil {
235+ if _ , err := h .store .Repos ().UserGroup . Get (ctx , req .Msg .Id ); err != nil {
239236 return nil , handleGetError (ctx , err , ErrUserGroupNotFound , "user group not found" )
240237 }
241238
@@ -252,7 +249,7 @@ func (h *UserGroupHandler) SetUserGroupMaintenanceWindow(ctx context.Context, re
252249 return nil , err
253250 }
254251
255- updated , err := h .store .Queries ().GetUserGroupByID (ctx , req .Msg .Id )
252+ updated , err := h .store .Repos ().UserGroup . Get (ctx , req .Msg .Id )
256253 if err != nil {
257254 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to read user group" )
258255 }
@@ -270,7 +267,7 @@ func (h *UserGroupHandler) DeleteUserGroup(ctx context.Context, req *connect.Req
270267 return nil , err
271268 }
272269
273- _ , err := h .store .Queries ().GetUserGroupByID (ctx , req .Msg .Id )
270+ _ , err := h .store .Repos ().UserGroup . Get (ctx , req .Msg .Id )
274271 if err != nil {
275272 return nil , handleGetError (ctx , err , ErrUserGroupNotFound , "user group not found" )
276273 }
@@ -399,7 +396,7 @@ func (h *UserGroupHandler) RemoveUserFromGroup(ctx context.Context, req *connect
399396 }
400397
401398 // Verify group exists and is not dynamic
402- group , err := h .store .Queries ().GetUserGroupByID (ctx , req .Msg .GroupId )
399+ group , err := h .store .Repos ().UserGroup . Get (ctx , req .Msg .GroupId )
403400 if err != nil {
404401 return nil , handleGetError (ctx , err , ErrUserGroupNotFound , "user group not found" )
405402 }
@@ -583,7 +580,7 @@ func (h *UserGroupHandler) ListUserGroupsForUser(ctx context.Context, req *conne
583580 return nil , handleGetError (ctx , err , ErrUserNotFound , "user not found" )
584581 }
585582
586- groups , err := h .store .Queries ().ListUserGroupsForUser (ctx , req .Msg .UserId )
583+ groups , err := h .store .Repos ().UserGroup . ListForUser (ctx , req .Msg .UserId )
587584 if err != nil {
588585 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to list user groups" )
589586 }
@@ -639,7 +636,7 @@ func (h *UserGroupHandler) UpdateUserGroupQuery(ctx context.Context, req *connec
639636 return nil , err
640637 }
641638
642- group , err := h .store .Queries ().GetUserGroupByID (ctx , req .Msg .Id )
639+ group , err := h .store .Repos ().UserGroup . Get (ctx , req .Msg .Id )
643640 if err != nil {
644641 return nil , handleGetError (ctx , err , ErrUserGroupNotFound , "user group not found" )
645642 }
@@ -700,7 +697,7 @@ func (h *UserGroupHandler) EvaluateDynamicUserGroup(ctx context.Context, req *co
700697 }
701698
702699 // Verify group exists and is dynamic
703- group , err := h .store .Queries ().GetUserGroupByID (ctx , req .Msg .Id )
700+ group , err := h .store .Repos ().UserGroup . Get (ctx , req .Msg .Id )
704701 if err != nil {
705702 return nil , handleGetError (ctx , err , ErrUserGroupNotFound , "user group not found" )
706703 }
@@ -719,7 +716,7 @@ func (h *UserGroupHandler) EvaluateDynamicUserGroup(ctx context.Context, req *co
719716 }
720717
721718 // Get updated group
722- group , err = h .store .Queries ().GetUserGroupByID (ctx , req .Msg .Id )
719+ group , err = h .store .Repos ().UserGroup . Get (ctx , req .Msg .Id )
723720 if err != nil {
724721 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to get user group" )
725722 }
@@ -786,7 +783,7 @@ func (h *UserGroupHandler) bumpUserSessionVersion(ctx context.Context, userID, a
786783// failing member does not prevent the remaining members from being
787784// invalidated. A partial bump is better than stopping early.
788785func (h * UserGroupHandler ) bumpSessionVersionForGroupMembers (ctx context.Context , groupID , actorID string ) error {
789- memberIDs , err := h .store .Queries ().ListUserGroupMemberIDs (ctx , groupID )
786+ memberIDs , err := h .store .Repos ().UserGroup . ListMemberIDs (ctx , groupID )
790787 if err != nil {
791788 return err
792789 }
@@ -802,7 +799,7 @@ func (h *UserGroupHandler) bumpSessionVersionForGroupMembers(ctx context.Context
802799}
803800
804801// userGroupToProto converts a database user group projection to a protobuf UserGroup.
805- func userGroupToProto (g db. UserGroupsProjection , roles []db.RolesProjection , isScimManaged bool ) * pm.UserGroup {
802+ func userGroupToProto (g store. UserGroup , roles []db.RolesProjection , isScimManaged bool ) * pm.UserGroup {
806803 group := & pm.UserGroup {
807804 Id : g .ID ,
808805 Name : g .Name ,
0 commit comments