From 8f7889d1a9b78639d42782c2e8730cd83fad15d1 Mon Sep 17 00:00:00 2001 From: ppetzold Date: Tue, 14 Mar 2023 19:31:38 +0100 Subject: [PATCH] fix naming --- src/helper.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/helper.ts b/src/helper.ts index 8abbf0c..ae19f81 100644 --- a/src/helper.ts +++ b/src/helper.ts @@ -37,17 +37,17 @@ export type SortBy = Order[] export const positiveNumberOrDefault = (value: number | undefined, defaultValue: number, minValue: 0 | 1 = 0) => value === undefined || value < minValue ? defaultValue : value -export type ColumnProperties = { propertyPath?: string; propertyName: string; isEmbedded: boolean; column: string } +export type ColumnProperties = { propertyPath?: string; propertyName: string; isNested: boolean; column: string } export function getPropertiesByColumnName(column: string): ColumnProperties { const propertyPath = column.split('.') if (propertyPath.length > 1) { const propertyNamePath = propertyPath.slice(1) - let isEmbedded = false, + let isNested = false, propertyName = propertyNamePath.join('.') if (!propertyName.startsWith('(') && propertyNamePath.length > 1) { - isEmbedded = true + isNested = true } propertyName = propertyName.replace('(', '').replace(')', '') @@ -55,11 +55,11 @@ export function getPropertiesByColumnName(column: string): ColumnProperties { return { propertyPath: propertyPath[0], propertyName, // the join is in case of an embedded entity - isEmbedded, + isNested, column: `${propertyPath[0]}.${propertyName}`, } } else { - return { propertyName: propertyPath[0], isEmbedded: false, column: propertyPath[0] } + return { propertyName: propertyPath[0], isNested: false, column: propertyPath[0] } } } @@ -124,7 +124,7 @@ export function fixColumnAlias( if (isRelation) { if (isVirtualProperty && query) { return `(${query(`${alias}_${properties.propertyPath}`)})` // () is needed to avoid parameter conflict - } else if ((isVirtualProperty && !query) || properties.isEmbedded) { + } else if ((isVirtualProperty && !query) || properties.isNested) { return `${alias}_${properties.propertyPath}_${properties.propertyName}` } else { return `${alias}_${properties.propertyPath}.${properties.propertyName}`