feat: 新增群组成员数量统计功能并在接口中返回

实现了群组成员数量统计的接口,包含数据库层统计逻辑,在群组详情、设置等接口中返回实时成员数,同时修复了测试用例中参数空格问题。
This commit is contained in:
Austin
2026-10-13 17:58:05 +08:00
parent 43808c36d1
commit e8804883fc
7 changed files with 120 additions and 14 deletions
+9 -1
View File
@@ -273,6 +273,7 @@ type testGroupBusinessStore struct {
listMembers []types.GroupMember
listMembersOpts types.GroupMemberListOptions
listMembersNext string
membersCounts map[string]int64
updatedSettings types.GroupSettingsPatch
updatedMembers []types.GroupMemberPatch
updatedRoleMode types.AccessMode
@@ -354,6 +355,13 @@ func (s *testGroupBusinessStore) ListMembers(_ types.TenantID, _ string, opts ty
return s.listMembers, s.listMembersNext, nil
}
func (s *testGroupBusinessStore) MembersCount(_ types.TenantID, _ []string) (map[string]int64, error) {
if s.membersCounts == nil {
return map[string]int64{}, nil
}
return s.membersCounts, nil
}
func (s *testGroupBusinessStore) UpdateMember(_ types.TenantID, topic string, uid types.Uid, patch types.GroupMemberPatch) (*types.GroupMember, error) {
if s.updateMemberErr != nil {
return nil, s.updateMemberErr
@@ -730,7 +738,7 @@ func (s *testProfilesStore) UpdatePrivacy(_ types.TenantID, uid types.Uid, patch
return privacy, nil
}
func (s *testAppReleaseStore) Latest(platform, channel string) (*types.AppRelease, error) {
func (s *testAppReleaseStore) Latest(_, platform, channel string) (*types.AppRelease, error) {
if s.err != nil {
return nil, s.err
}