Use knex instance property in MetaService class

This commit is contained in:
Nicola Krumschmidt
2020-11-03 18:12:40 +01:00
parent 220bdf3c4d
commit 20a02f05bd

View File

@@ -32,12 +32,12 @@ export class MetaService {
}
async totalCount(collection: string) {
const records = await database(collection).count('*', { as: 'count' });
const records = await this.knex(collection).count('*', { as: 'count' });
return Number(records[0].count);
}
async filterCount(collection: string, query: Query) {
const dbQuery = database(collection).count('*', { as: 'count' });
const dbQuery = this.knex(collection).count('*', { as: 'count' });
if (query.filter) {
await applyFilter(this.knex, dbQuery, query.filter, collection);