@elsikora/nestjs-crud-automator
Version:
A library for automating the creation of CRUD operations in NestJS.
18 lines (17 loc) • 1.47 kB
TypeScript
import type { EApiRouteType } from '../../../enum/decorator/api/index';
import type { IApiControllerProperties } from '../../../interface/decorator/api/index';
import type { IApiEntity } from '../../../interface/entity/index';
/**
* 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>(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;