Skip to content

Commit

Permalink
Add validation for default showing table to prevent selection and exc…
Browse files Browse the repository at this point in the history
…lusion in connection properties setup
  • Loading branch information
Artuomka committed Feb 26, 2025
1 parent 53b7f84 commit 57f1190
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 2 additions & 0 deletions backend/src/exceptions/text/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down

0 comments on commit 57f1190

Please sign in to comment.