import { FilterQuery, PopulateOptions, } from 'mongoose'; export type ApiSortQuery = Record; export type ApiSelectQuery = Record; export interface IApiQuery { deleted?: string | boolean; filter?: string | null; limit?: string | number; offset?: string | number; populate?: PopulateOptions[] | [] | null; q?: string | null; select?: string | null; sort?: string | null; } export interface IApiParsedQuery { [ key: string ]: undefined | null | string | number | boolean | Partial>; _q?: string; limit: number; offset: number; q: FilterQuery; select: ApiSelectQuery; sort: ApiSortQuery | null; // should not be null total: FilterQuery; filter?: Record; populate?: PopulateOptions[]; deleted?: boolean; } export type ParseQueryFunction = (query: IApiParsedQuery) => IApiParsedQuery;