diff --git a/backend/src/entities/connection-properties/utils/validate-create-connection-properties-ds.ts b/backend/src/entities/connection-properties/utils/validate-create-connection-properties-ds.ts index 4705997e6..74ec54000 100644 --- a/backend/src/entities/connection-properties/utils/validate-create-connection-properties-ds.ts +++ b/backend/src/entities/connection-properties/utils/validate-create-connection-properties-ds.ts @@ -23,6 +23,9 @@ export async function validateCreateConnectionPropertiesDs( errors.push(Messages.TABLE_WITH_NAME_NOT_EXISTS(hiddenTable)); } } + if (hidden_tables.includes(default_showing_table)) { + errors.push(Messages.CANT_SHOW_TABLE_AND_EXCLUDE(default_showing_table)); + } } if (default_showing_table && !tablesInConnection.includes(default_showing_table)) { diff --git a/backend/src/exceptions/text/messages.ts b/backend/src/exceptions/text/messages.ts index 0b5a097fc..9abe8a1b8 100644 --- a/backend/src/exceptions/text/messages.ts +++ b/backend/src/exceptions/text/messages.ts @@ -51,6 +51,8 @@ export const Messages = { 'It seems like the value you entered for the unique field already exists in database. Please check your input and try again with a different value', CANT_LIST_AND_EXCLUDE: (fieldName: string) => `You cannot select the same field ${fieldName ? fieldName : 'names'} to list and exclude`, + CANT_SHOW_TABLE_AND_EXCLUDE: (tableName: string) => + `You cannot select the same table "${tableName}" to show by default and exclude`, CANT_VIEW_AND_EXCLUDE: (fieldName: string) => `You cannot select the same field ${fieldName ? fieldName : 'names'} to view and exclude`, CANT_ORDER_AND_EXCLUDE: `You cannot select the same field names to order and exclude`,