// below 2 are from CRUIDEngineA // both methods are workingbut not sure where exactly need to use so added here async _getJoinColumns(entity: any) { const metadata = getMetadataArgsStorage(); // Get all relation metadata of the entity const relations = metadata.relations.filter((relation) => relation.target === entity); // Object to hold field and type info const result: { [key: string]: any } = {}; // Loop through all relations and find those that have @JoinColumn relations.forEach((relation) => { const joinColumnMetadata = metadata.joinColumns.find( (joinColumn) => joinColumn.target === entity && joinColumn.propertyName === relation.propertyName ); if (joinColumnMetadata) { // Store the field and its type result[relation.propertyName] = relation.type; } }); return result; } // not working properly async _getJoinColumns(entity: any) { const metadata = getMetadataArgsStorage(); // Initialize result object const result: { [key: string]: string } = {}; // Retrieve all join columns for the entity const joinColumns = metadata.joinColumns.filter( (joinColumn: JoinColumnMetadataArgs) => joinColumn.target === entity ); console.log(joinColumns); // Loop through all join columns and extract metadata joinColumns.forEach(async (joinColumn: JoinColumnMetadataArgs) => { const columnPropertyName = joinColumn.propertyName; // Use Reflect to get metadata about the type const type = await Reflect.getOwnMetadata('design:type', entity, columnPropertyName); result[columnPropertyName] = type ? type?.name : 'Unknown'; }); return result; }