diff --git a/README.MD b/README.MD index dd7a4e3f..1e3854b5 100644 --- a/README.MD +++ b/README.MD @@ -259,7 +259,7 @@ import { export async function getUsers(req: Request, res: Response) { // const {fields, filter, include, page, sort} = req.query; - const output: ParseOutput = parseQuery(req.query, { + const output: ParseOutput = parseQuery(req.query, { defaultPath: 'user', fields: { allowed: ['id', 'name', 'realm.id', 'realm.name'], diff --git a/docs/guide/parse.md b/docs/guide/parse.md index 3a999eee..8d5dea60 100644 --- a/docs/guide/parse.md +++ b/docs/guide/parse.md @@ -95,7 +95,6 @@ import { parseQueryRelations, parseQueryPagination, parseQuerySort, - Parameter } from "rapiq"; import { @@ -143,7 +142,7 @@ export async function getUsers(req: Request, res: Response) { const parsed = applyQueryParseOutput(query, { defaultPath: 'user', - fields: parseQueryFields(fields, { + fields: parseQueryFields(fields, { defaultPath: 'user', // The fields id & name of the realm entity can only be used, // if the relation 'realm' is included. @@ -151,21 +150,21 @@ export async function getUsers(req: Request, res: Response) { relations: relationsParsed }), // only allow filtering users by id & name - filters: parseQueryFilters(filter, { + filters: parseQueryFilters(filter, { defaultPath: 'user', // realm.id can only be used as filter key, // if the relation 'realm' is included. allowed: ['id', 'name', 'realm.id'], relations: relationsParsed }), - relations: parseQueryRelations(include, { + relations: parseQueryRelations(include, { allowed: ['items', 'realm'] }), // only allow to select 20 items at maximum. pagination: parseQueryPagination(page, { maxLimit: 20 }), - sort: parseQuerySort(sort, { + sort: parseQuerySort(sort, { defaultPath: 'user', // profile.id can only be used as sorting key, // if the relation 'realm' is included. @@ -200,7 +199,6 @@ import { Request, Response } from 'express'; import { parseQuery, - Parameter, ParseOutput } from 'rapiq'; @@ -220,7 +218,7 @@ import { export async function getUsers(req: Request, res: Response) { // const {fields, filter, include, page, sort} = req.query; - const output: ParseOutput = parseQuery(req.query, { + const output: ParseOutput = parseQuery(req.query, { defaultPath: 'user', fields: { allowed: ['id', 'name', 'realm.id', 'realm.name'], diff --git a/src/parse/module.ts b/src/parse/module.ts index 5b5f5274..8d81fc49 100644 --- a/src/parse/module.ts +++ b/src/parse/module.ts @@ -19,7 +19,7 @@ import { ParseInput, ParseOptions, ParseOutput } from './type'; export function parseQuery( input: ParseInput, - options?: ParseOptions, + options?: ParseOptions, ) : ParseOutput { options ??= {}; diff --git a/src/parse/parameter/module.ts b/src/parse/parameter/module.ts index e22e4683..1b6dd479 100644 --- a/src/parse/parameter/module.ts +++ b/src/parse/parameter/module.ts @@ -20,7 +20,7 @@ export function parseQueryParameter< >( key: P, data: unknown, - options?: ParseParameterOptions, + options?: ParseParameterOptions, relations?: RelationsParseOutput, ): ParseParameterOutput

{ switch (key) {