Add frameworks totalCount support

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-06-09 20:14:47 -07:00
parent 35dcad829b
commit c7c889e5ca
7 changed files with 211 additions and 18 deletions

View File

@@ -104,6 +104,32 @@ func (s FrameworkService) Create(
return framework, nil
}
func (s FrameworkService) CountForOrganizationID(
ctx context.Context,
organizationID gid.GID,
) (int, error) {
var count int
err := s.svc.pg.WithConn(
ctx,
func(conn pg.Conn) (err error) {
frameworks := &coredata.Frameworks{}
count, err = frameworks.CountByOrganizationID(ctx, conn, s.svc.scope, organizationID)
if err != nil {
return fmt.Errorf("cannot count frameworks: %w", err)
}
return nil
},
)
if err != nil {
return 0, fmt.Errorf("cannot count frameworks: %w", err)
}
return count, nil
}
func (s FrameworkService) ListForOrganizationID(
ctx context.Context,
organizationID gid.GID,