diff --git a/internal/store/postgres/approval_repository.go b/internal/store/postgres/approval_repository.go index 0c17d3271..5cba91de4 100644 --- a/internal/store/postgres/approval_repository.go +++ b/internal/store/postgres/approval_repository.go @@ -65,7 +65,10 @@ func (r *ApprovalRepository) ListApprovals(ctx context.Context, filter *domain.L func (r *ApprovalRepository) GetApprovalsTotalCount(ctx context.Context, filter *domain.ListApprovalsFilter) (int64, error) { db := r.db.WithContext(ctx) - db = applyFilter(db, filter) + f := filter + f.Size = 0 + f.Offset = 0 + db = applyFilter(db, f) var count int64 if err := db.Model(&model.Approval{}).Count(&count).Error; err != nil { diff --git a/internal/store/postgres/resource_repository.go b/internal/store/postgres/resource_repository.go index dc36a08fe..cd9cb203e 100644 --- a/internal/store/postgres/resource_repository.go +++ b/internal/store/postgres/resource_repository.go @@ -57,7 +57,11 @@ func (r *ResourceRepository) Find(ctx context.Context, filter domain.ListResourc func (r *ResourceRepository) GetResourcesTotalCount(ctx context.Context, filter domain.ListResourcesFilter) (int64, error) { db := r.db.WithContext(ctx) - db = applyResourceFilter(db, filter) + + f := filter + f.Size = 0 + f.Offset = 0 + db = applyResourceFilter(db, f) var count int64 err := db.Model(&model.Resource{}).Count(&count).Error