You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 6, 2023. It is now read-only.
import BaseModel from '../baseModel';
import Table from '../common/enums/table.enum';
/**
* User Model
*/
class User extends BaseModel {
public static table: string = Table.USERS;
}
export default User;
Dao layer method call
export function fetchPaginatedUser(): Promise<any> {
const params = {
maxRows: 10,
currentPage: 1,
totalCountQuery: 'SELECT count(*) as count from users'
}
return User.paginate('SELECT * from users', params);
}
Expectation:
To get 10 rows of records.
Error message
knex:client acquired connection from pool: __knexUid2 +2s
knex:query SELECT count(*) as count from users undefined +2s
knex:bindings [] undefined +2s
knex:client releasing connection to pool: __knexUid2 +2ms
[ 2020-07-02T11:55:54.273Z ] - [ error ] Error: TypeError: Cannot read property 'count' of undefined
The error seems to have originated from totalCount = totalRecords[0].count; line in paginator.ts
the output of totalRecords is in the following format for postgres: