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 has been 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:
We are using a node backend application with Postgres as database.
The paginate is failing method is failing in @leapfrogtechnology/db-model@1.0.0-beta.2
The model
Dao layer method call
Expectation:
To get 10 rows of records.
Error message
The error seems to have originated from
totalCount = totalRecords[0].count;
line in paginator.tsthe output of totalRecords is in the following format for postgres:
@kabirbaidhya @mesaugat @cham11ng Any suggestion on how to get it working?
The text was updated successfully, but these errors were encountered: