Skip to content

Commit

Permalink
Use parent filters for the redirect and signer counts
Browse files Browse the repository at this point in the history
  • Loading branch information
elffjs committed Nov 1, 2024
1 parent f740b55 commit e09f9cd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/repositories/developerlicense/developerlicense.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ func (r *Repository) GetSignersForLicense(ctx context.Context, obj *gmodel.Devel
return nil, err
}

totalCount, err := models.Signers().Count(ctx, r.PDB.DBS().Reader)
if err != nil {
return nil, err
}

queryMods := []qm.QueryMod{
models.SignerWhere.DeveloperLicenseID.EQ(obj.TokenID),
}

totalCount, err := models.Signers(queryMods...).Count(ctx, r.PDB.DBS().Reader)
if err != nil {
return nil, err
}

if after != nil {
afterCursor, err := pHelp.DecodeCursor(*after)
if err != nil {
Expand Down Expand Up @@ -299,15 +299,15 @@ func (r *Repository) GetRedirectURIsForLicense(ctx context.Context, obj *gmodel.
return nil, err
}

totalCount, err := models.RedirectUris().Count(ctx, r.PDB.DBS().Reader)
if err != nil {
return nil, err
}

queryMods := []qm.QueryMod{
models.RedirectURIWhere.DeveloperLicenseID.EQ(obj.TokenID),
}

totalCount, err := models.RedirectUris(queryMods...).Count(ctx, r.PDB.DBS().Reader)
if err != nil {
return nil, err
}

if after != nil {
afterCursor, err := pHelp.DecodeCursor(*after)
if err != nil {
Expand Down

0 comments on commit e09f9cd

Please sign in to comment.