Add organization member list

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-14 09:38:01 +01:00
parent b3751636b2
commit 87f7654b10
17 changed files with 1401 additions and 344 deletions

View File

@@ -25,6 +25,7 @@ import (
"github.com/getprobo/probo/pkg/coredata"
"github.com/getprobo/probo/pkg/crypto/passwdhash"
"github.com/getprobo/probo/pkg/gid"
"github.com/getprobo/probo/pkg/page"
"github.com/getprobo/probo/pkg/statelesstoken"
"go.gearno.de/kit/pg"
)
@@ -491,3 +492,24 @@ func (s Service) ConfirmEmail(ctx context.Context, tokenString string) error {
},
)
}
func (s Service) ListUsersForTenant(
ctx context.Context,
organizationID gid.GID,
cursor *page.Cursor,
) (*page.Page[*coredata.User], error) {
users := coredata.Users{}
err := s.pg.WithConn(
ctx,
func(tx pg.Conn) error {
return users.LoadByOrganizationID(ctx, tx, organizationID, cursor)
},
)
if err != nil {
return nil, err
}
return page.NewPage(users, cursor), nil
}