Fix profiles list + implement resolver methods

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-02-09 13:13:58 +04:00
parent f24c5e7590
commit f884c6bb05
3 changed files with 79 additions and 3 deletions

View File

@@ -1069,6 +1069,31 @@ func (s *OrganizationService) ListProfiles(
return page.NewPage(profiles, cursor), nil
}
func (s OrganizationService) CountProfiles(
ctx context.Context,
organizationID gid.GID,
) (int, error) {
var (
scope = coredata.NewScopeFromObjectID(organizationID)
count int
)
err := s.pg.WithConn(
ctx,
func(conn pg.Conn) (err error) {
profiles := coredata.MembershipProfiles{}
count, err = profiles.CountByOrganizationID(ctx, conn, scope, organizationID)
if err != nil {
return fmt.Errorf("cannot count profiles: %w", err)
}
return nil
},
)
return count, err
}
func (s *OrganizationService) GetOrganizationForMembership(ctx context.Context, membershipID gid.GID) (*coredata.Organization, error) {
var (
scope = coredata.NewScopeFromObjectID(membershipID)