@elsikora/nestjs-crud-automator
Version:
A library for automating the creation of CRUD operations in NestJS.
19 lines (18 loc) • 1.25 kB
TypeScript
import { IApiControllerGetListQueryPlan } from '../../../interface/class/api/controller/get-list/query';
import { Type } from '@nestjs/common';
import { ObjectLiteral } from 'typeorm';
import { EApiDtoType, EApiRouteType } from '../../../enum/decorator/api';
import { IApiEntity } from '../../../interface/entity';
/**
* Creates a base class for list query DTOs with pagination and sorting properties.
* Includes limit, orderBy, orderDirection, and page fields with appropriate validation rules
* to ensure consistent pagination behavior.
* @param {ObjectLiteral} entity - The entity class or prototype
* @param {IApiEntity<E>} entityMetadata - The entity metadata containing column information
* @param {EApiRouteType} method - The API route type (GET_LIST)
* @param {EApiDtoType} dtoType - The type of DTO (QUERY)
* @param {IApiControllerGetListQueryPlan} [queryPlan] - Optional normalized plan that narrows sortable fields.
* @returns {Type<unknown>} A base class for list query DTOs
* @template E - The entity type
*/
export declare function DtoGetGetListQueryBaseClass<E>(entity: ObjectLiteral, entityMetadata: IApiEntity<E>, method: EApiRouteType, dtoType: EApiDtoType, queryPlan?: IApiControllerGetListQueryPlan): Type<unknown>;