File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -166,10 +166,11 @@ export class KnexAdapter<
166
166
async _find ( params ?: ServiceParams ) : Promise < Paginated < Result > | Result [ ] >
167
167
async _find ( params : ServiceParams = { } as ServiceParams ) : Promise < Paginated < Result > | Result [ ] > {
168
168
const { filters, paginate } = this . filterQuery ( params )
169
- const { name, id } = this . getOptions ( params )
169
+ const { Model , name, id } = this . getOptions ( params )
170
170
const builder = params . knex ? params . knex . clone ( ) : this . createQuery ( params )
171
- const countBuilder = builder . clone ( ) . clearSelect ( ) . clearOrder ( ) . count ( `${ name } .${ id } as total` )
172
-
171
+ const countBuilder = Model . count ( `* as total` )
172
+ . with ( 'subquery' , builder . clone ( ) . clearOrder ( ) )
173
+ . from ( 'subquery' )
173
174
// Handle $limit
174
175
if ( filters . $limit ) {
175
176
builder . limit ( filters . $limit )
You can’t perform that action at this time.
0 commit comments