Comparing version 0.2.8 to 0.2.9
{ | ||
"name": "rapiq", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"description": "A tiny library which provides utility types/functions for request and response query handling.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -241,4 +241,3 @@ # rapiq 🌈 | ||
import { | ||
applyQueryParseOutput, | ||
parseQuery, | ||
applyQuery, | ||
useDataSource | ||
@@ -256,5 +255,10 @@ } from 'typeorm-extension'; | ||
export async function getUsers(req: Request, res: Response) { | ||
// const {fields, filter, include, page, sort} = req.query; | ||
const dataSource = await useDataSource(); | ||
const repository = dataSource.getRepository(User); | ||
const query = repository.createQueryBuilder('user'); | ||
const output = parseQuery<User>(req.query, { | ||
// ----------------------------------------------------- | ||
// parse and apply data on the db query. | ||
const { pagination } = applyQuery(query, req.query, { | ||
defaultPath: 'user', | ||
@@ -278,13 +282,4 @@ fields: { | ||
const dataSource = await useDataSource(); | ||
const repository = dataSource.getRepository(User); | ||
const query = repository.createQueryBuilder('user'); | ||
// ----------------------------------------------------- | ||
// apply parsed data on the db query. | ||
const parsed = applyQueryParseOutput(query, output); | ||
// ----------------------------------------------------- | ||
const [entities, total] = await query.getManyAndCount(); | ||
@@ -297,3 +292,3 @@ | ||
total, | ||
...output.pagination | ||
...pagination | ||
} | ||
@@ -300,0 +295,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170672
301