UNPKG

@elsikora/nestjs-crud-automator

Version:

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

19 lines (18 loc) 1.55 kB
import { EApiRouteType } from '../../../../enum/decorator/api'; import { IApiBaseEntity } from '../../../../interface/api-base-entity.interface'; import { IApiControllerProperties } from '../../../../interface/decorator/api'; import { IApiEntity } from '../../../../interface/entity'; /** * Creates controller methods dynamically. * Gets the method name, checks if it's already defined, and either * calls the implementation or throws an error if not implemented. * @param {Record<string, (method: EApiRouteType, methodName: string, properties: IApiControllerProperties<E>, entityMetadata: IApiEntity<E>) => void>} thisTarget - The object containing method implementations * @param {Record<string, unknown>} target - The target controller class to add methods to * @param {EApiRouteType} method - The type of route (CREATE, DELETE, GET, etc.) * @param {IApiControllerProperties<E>} properties - Controller configuration properties * @param {IApiEntity<E>} entityMetadata - The entity metadata containing column information * @returns {void} * @throws {Error} When the reserved method is already defined or method implementation is missing * @template E - The entity type */ export declare function ApiControllerWriteMethod<E extends IApiBaseEntity>(thisTarget: Record<string, (method: EApiRouteType, methodName: string, properties: IApiControllerProperties<E>, entityMetadata: IApiEntity<E>) => void>, target: Record<string, unknown>, method: EApiRouteType, properties: IApiControllerProperties<E>, entityMetadata: IApiEntity<E>): void;