From 1ea35f1f6daf9e59e528d10cbf470c7ecd9ded40 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 16 Oct 2024 10:30:45 +0000 Subject: [PATCH] refactor: make title mandatory instead of table_name --- .../nocodb/src/services/tables.service.ts | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/nocodb/src/services/tables.service.ts b/packages/nocodb/src/services/tables.service.ts index 184a1c95da..090d9f5e89 100644 --- a/packages/nocodb/src/services/tables.service.ts +++ b/packages/nocodb/src/services/tables.service.ts @@ -558,15 +558,30 @@ export class TablesService { } } + + if ( - !tableCreatePayLoad.table_name || - (base.prefix && base.prefix === tableCreatePayLoad.table_name) + !tableCreatePayLoad.title ) { NcError.badRequest( - 'Missing table name `table_name` property in request body', + 'Missing table `title` property in request body', ); } + if(!tableCreatePayLoad.table_name) { + + } + + if ( + !(await Model.checkAliasAvailable(context, { + title: tableCreatePayLoad.title, + base_id: base.id, + source_id: source.id, + })) + ) { + NcError.badRequest('Duplicate table alias'); + } + if (source.type === 'databricks') { tableCreatePayLoad.table_name = tableCreatePayLoad.table_name .replace(/\s/g, '_') @@ -608,15 +623,7 @@ export class TablesService { ); } - if ( - !(await Model.checkAliasAvailable(context, { - title: tableCreatePayLoad.title, - base_id: base.id, - source_id: source.id, - })) - ) { - NcError.badRequest('Duplicate table alias'); - } + const sqlMgr = await ProjectMgrv2.getSqlMgr(context, base);