diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9976aa1..5e5f36a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: npm ci - - run: npm run format -- --list-different + - run: npm run format:check - run: npm run lint - run: npm run build - run: npm run test:cov diff --git a/package.json b/package.json index 7d338fe..cc9e679 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "prebuild": "rimraf lib", "build": "tsc", "format": "prettier --write \"src/**/*.ts\"", + "format:check": "prettier --list-different \"src/**/*.ts\"", "lint": "eslint -c .eslintrc.json --ext .ts --max-warnings 0 src", "test": "jest", "test:watch": "jest --watch", diff --git a/src/paginate.ts b/src/paginate.ts index d4ad63c..eb12470 100644 --- a/src/paginate.ts +++ b/src/paginate.ts @@ -13,7 +13,7 @@ import { LessThanOrEqual, Not, ILike, - Brackets + Brackets, } from 'typeorm' import { PaginateQuery } from './decorator' import { ServiceUnavailableException } from '@nestjs/common' @@ -117,7 +117,7 @@ export async function paginate( } if (config.where) { - queryBuilder = queryBuilder.andWhere(new Brackets(queryBuilder => queryBuilder.andWhere(config.where))) // Postgres fix (https://github.com/ppetzold/nestjs-paginate/pull/97) + queryBuilder = queryBuilder.andWhere(new Brackets((queryBuilder) => queryBuilder.andWhere(config.where))) // Postgres fix (https://github.com/ppetzold/nestjs-paginate/pull/97) } if (query.search && config.searchableColumns) { @@ -205,12 +205,12 @@ export async function paginate( const searchQuery = query.search ? `&search=${query.search}` : '' const filterQuery = query.filter ? '&' + - stringify( - mapKeys(query.filter, (_param, name) => 'filter.' + name), - '&', - '=', - { encodeURIComponent: (str) => str } - ) + stringify( + mapKeys(query.filter, (_param, name) => 'filter.' + name), + '&', + '=', + { encodeURIComponent: (str) => str } + ) : '' const options = `&limit=${limit}${sortByQuery}${searchQuery}${filterQuery}`