fix(): fix for caritas project (removes _rel)
This commit is contained in:
		
							parent
							
								
									5a787ddb5f
								
							
						
					
					
						commit
						be9caf1fa6
					
				| @ -180,22 +180,11 @@ export function fixColumnAlias( | ||||
| ): string { | ||||
|     if (isRelation) { | ||||
|         if (isVirtualProperty && query) { | ||||
|             return `(${query(`${alias}_${properties.propertyPath}_rel`)})` // () is needed to avoid parameter conflict
 | ||||
|             return `(${query(`${alias}_${properties.propertyPath}`)})` // () is needed to avoid parameter conflict
 | ||||
|         } else if ((isVirtualProperty && !query) || properties.isNested) { | ||||
|             if (properties.propertyName.includes('.')) { | ||||
|                 const propertyPath = properties.propertyName.split('.') | ||||
|                 const nestedRelations = propertyPath | ||||
|                     .slice(0, -1) | ||||
|                     .map((v) => `${v}_rel`) | ||||
|                     .join('_') | ||||
|                 const nestedCol = propertyPath[propertyPath.length - 1] | ||||
| 
 | ||||
|                 return `${alias}_${properties.propertyPath}_rel_${nestedRelations}.${nestedCol}` | ||||
|             return `${alias}_${properties.propertyPath}_${properties.propertyName}` | ||||
|         } else { | ||||
|                 return `${alias}_${properties.propertyPath}_rel_${properties.propertyName}` | ||||
|             } | ||||
|         } else { | ||||
|             return `${alias}_${properties.propertyPath}_rel.${properties.propertyName}` | ||||
|             return `${alias}_${properties.propertyPath}.${properties.propertyName}` | ||||
|         } | ||||
|     } else if (isVirtualProperty) { | ||||
|         return query ? `(${query(`${alias}`)})` : `${alias}_${properties.propertyName}` | ||||
|  | ||||
| @ -155,11 +155,11 @@ function flattenWhereAndTransform<T>( | ||||
|                             ? '' | ||||
|                             : `_${pathSplit | ||||
|                                   .slice(0, -1) | ||||
|                                   .map((p) => p + '_rel') | ||||
|                                   .map((p) => p) | ||||
|                                   .join('_')}` | ||||
|                     const tableName = pathSplit[pathSplit.length - 1] | ||||
|                     const tableAliasWithProperty = `${queryBuilder.alias}${fullPath}.${tableName}` | ||||
|                     const joinTableAlias = `${queryBuilder.alias}${fullPath}_${tableName}_rel` | ||||
|                     const joinTableAlias = `${queryBuilder.alias}${fullPath}_${tableName}` | ||||
| 
 | ||||
|                     const baseTableAlias = allJoinedTables[joinTableAlias] | ||||
| 
 | ||||
| @ -229,11 +229,11 @@ export async function paginate<T extends ObjectLiteral>( | ||||
| 
 | ||||
|                 queryBuilder.leftJoinAndSelect( | ||||
|                     `${alias ?? prefix}.${relationName}`, | ||||
|                     `${alias ?? prefix}_${relationName}_rel` | ||||
|                     `${alias ?? prefix}_${relationName}` | ||||
|                 ) | ||||
| 
 | ||||
|                 if (typeof relationSchema === 'object') { | ||||
|                     createQueryBuilderRelations(relationName, relationSchema, `${alias ?? prefix}_${relationName}_rel`) | ||||
|                     createQueryBuilderRelations(relationName, relationSchema, `${alias ?? prefix}_${relationName}`) | ||||
|                 } | ||||
|             }) | ||||
|         } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user