@elsikora/nestjs-crud-automator
Version:
A library for automating the creation of CRUD operations in NestJS.
20 lines (19 loc) • 1.7 kB
TypeScript
import { IApiBaseEntity } from '../../../interface/api-base-entity.interface';
import { IApiControllerProperties, IApiControllerPropertiesRouteBaseRelationsRequest } from '../../../interface/decorator/api';
import { TApiControllerMethod } from '../../../type/class';
import { TApiControllerGetListQuery } from '../../../type/decorator/api/controller';
import { DeepPartial } from 'typeorm';
/**
* Manages loading related entities when processing API requests.
* Determines which relations to load based on request load include,
* 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 {IApiControllerPropertiesRouteBaseRelationsRequest<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 the request relation reference shape is invalid
* @throws {Error} When service configuration is invalid or services are not found
* @template E - The entity type
*/
export declare function ApiControllerHandleRequestRelations<E extends IApiBaseEntity>(controllerMethod: TApiControllerMethod<E>, properties: IApiControllerProperties<E>, relationConfig: IApiControllerPropertiesRouteBaseRelationsRequest<E> | undefined, parameters: DeepPartial<E> | Partial<E> | TApiControllerGetListQuery<E>): Promise<void>;