@elsikora/nestjs-crud-automator
Version:
A library for automating the creation of CRUD operations in NestJS.
19 lines (18 loc) • 1.16 kB
TypeScript
import { IApiEntity } from '../../../interface/entity';
import { Type } from '@nestjs/common';
import { EApiDtoType, EApiRouteType } from '../../../enum/decorator/api';
/**
* Creates a simple relationship DTO containing only an ID field.
* Used for representing related entities in API responses with minimal information.
* @param {IApiEntity<E>} entity - The entity metadata
* @param {EApiRouteType} method - The API route type (CREATE, DELETE, GET, etc.)
* @param {EApiDtoType} dtoType - The type of DTO (REQUEST, RESPONSE, etc.)
* @param {string} propertyName - The name of the relation property
* @param {{ relationDescription?: string }} [options] - Optional relation metadata used for the nested identifier schema
* @param {string} [options.relationDescription] - Relation-aware description to use for the nested id field.
* @returns {Type<unknown>} A generated DTO class for relation representation
* @template E - The entity type
*/
export declare function DtoGenerateRelationResponse<E>(entity: IApiEntity<E>, method: EApiRouteType, dtoType: EApiDtoType, propertyName: string, options?: {
relationDescription?: string;
}): Type<unknown>;