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<
166166 async _find ( params ?: ServiceParams ) : Promise < Paginated < Result > | Result [ ] >
167167 async _find ( params : ServiceParams = { } as ServiceParams ) : Promise < Paginated < Result > | Result [ ] > {
168168 const { filters, paginate } = this . filterQuery ( params )
169- const { name, id } = this . getOptions ( params )
169+ const { Model , name, id } = this . getOptions ( params )
170170 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' )
173174 // Handle $limit
174175 if ( filters . $limit ) {
175176 builder . limit ( filters . $limit )
You can’t perform that action at this time.
0 commit comments