UNPKG

@solid-nestjs/rest-api

Version:

solid-nestjs Rest-API utilities

25 lines 1.72 kB
import { Type } from '@nestjs/common'; import { FindArgs, OrderBy, Where } from '@solid-nestjs/common'; import { FindArgsStructure } from '../interfaces'; export declare const WHERE_CLASS_KEY = "WhereClass"; export declare const ORDER_BY_CLASS_KEY = "OrderByClass"; /** * Generates a dynamic argument class for querying entities with optional pagination, filtering (where), and sorting (order by) capabilities. * * This mixin function creates a class based on the provided structure, supporting: * - Pagination via a `pagination` property. * - Filtering via a `where` property, supporting logical `_and` and `_or` operators. * - Sorting via an `orderBy` property. * * The generated class is decorated for use with NestJS, class-validator, and Swagger/OpenAPI. * * @typeParam EntityType - The entity type being queried. * @typeParam WhereType - The type used for filtering (where clause). Defaults to `Where<EntityType>`. * @typeParam OrderByType - The type used for sorting (order by clause). Defaults to `OrderBy<EntityType>`. * @param findArgsStructure - Optional structure specifying the types for where and orderBy clauses. * @returns A dynamically generated class implementing `FindArgs<EntityType>`, decorated for validation and API documentation. */ export declare function FindArgsFrom<EntityType, WhereType extends Where<EntityType> = Where<EntityType>, OrderByType extends OrderBy<EntityType> = OrderBy<EntityType>>(findArgsStructure?: FindArgsStructure<EntityType, WhereType, OrderByType>): Type<FindArgs<EntityType>>; export declare function getWhereClass(findArgsType: any): any; export declare function getOrderByClass(findArgsType: any): any; //# sourceMappingURL=find-args.mixin.d.ts.map