UNPKG

@elsikora/nestjs-crud-automator

Version:

A library for automating the creation of CRUD operations in NestJS.

20 lines (19 loc) 1.68 kB
import type { IApiControllerProperties } from '../../../interface/decorator/api/index'; import type { TApiControllerMethod } from '../../../type/class/index'; import type { TApiControllerGetListQuery, TApiControllerPropertiesRouteBaseRequestRelations } from '../../../type/decorator/api/controller/index'; import type { DeepPartial } from "typeorm"; /** * Manages loading related entities when processing API requests. * Determines which relations to load based on configuration strategy (MANUAL or AUTO), * finds the appropriate service for each relation, and loads the related entities. * @param {TApiControllerMethod<E>} controllerMethod - The controller method with access to service instances * @param {IApiControllerProperties<E>} properties - Controller configuration properties * @param {TApiControllerPropertiesRouteBaseRequestRelations<E> | undefined} relationConfig - Configuration for relation loading * @param {DeepPartial<E> | Partial<E> | TApiControllerGetListQuery<E>} parameters - The request parameters containing relation IDs * @returns {Promise<void>} A promise that resolves when all relations are loaded * @throws {BadRequestException} When an invalid relation ID is provided * @throws {Error} When service configuration is invalid or services are not found * @template E - The entity type * @template R - The route type */ export declare function ApiControllerHandleRequestRelations<E>(controllerMethod: TApiControllerMethod<E>, properties: IApiControllerProperties<E>, relationConfig: TApiControllerPropertiesRouteBaseRequestRelations<E> | undefined, parameters: DeepPartial<E> | Partial<E> | TApiControllerGetListQuery<E>): Promise<void>;