feat: implement GetSpecifiedUserGroupRequestInfo interface. (#2661)

* feat: implement GetSpecifiedUserGroupRequestInfo interface.

* update mongo config.
This commit is contained in:
Monet Lee
2024-09-25 18:59:44 +08:00
committed by GitHub
parent d279a5f458
commit 3472952683
11 changed files with 125 additions and 17 deletions
+6
View File
@@ -71,6 +71,8 @@ type GroupDatabase interface {
PageGroupRequest(ctx context.Context, groupIDs []string, pagination pagination.Pagination) (int64, []*model.GroupRequest, error)
// GetGroupRoleLevelMemberIDs retrieves user IDs of group members with a specific role level.
GetGroupRoleLevelMemberIDs(ctx context.Context, groupID string, roleLevel int32) ([]string, error)
// GetGroupAdminLevelMemberIDs retrieves user IDs of group members with an admin role level.
GetGroupAdminLevelMemberIDs(ctx context.Context, groupID string) ([]string, error)
// PageGetJoinGroup paginates through groups that a user has joined.
PageGetJoinGroup(ctx context.Context, userID string, pagination pagination.Pagination) (total int64, totalGroupMembers []*model.GroupMember, err error)
@@ -180,6 +182,10 @@ func (g *groupDatabase) GetGroupRoleLevelMemberIDs(ctx context.Context, groupID
return g.cache.GetGroupRoleLevelMemberIDs(ctx, groupID, roleLevel)
}
func (g *groupDatabase) GetGroupAdminLevelMemberIDs(ctx context.Context, groupID string) ([]string, error) {
return g.cache.GetGroupAdminLevelMemberIDs(ctx, groupID)
}
func (g *groupDatabase) CreateGroup(ctx context.Context, groups []*model.Group, groupMembers []*model.GroupMember) error {
if len(groups)+len(groupMembers) == 0 {
return nil