Browse Source

refactor: make title mandatory instead of table_name

pull/9660/head
Pranav C 2 months ago
parent
commit
1ea35f1f6d
  1. 31
      packages/nocodb/src/services/tables.service.ts

31
packages/nocodb/src/services/tables.service.ts

@ -558,15 +558,30 @@ export class TablesService {
} }
} }
if ( if (
!tableCreatePayLoad.table_name || !tableCreatePayLoad.title
(base.prefix && base.prefix === tableCreatePayLoad.table_name)
) { ) {
NcError.badRequest( 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') { if (source.type === 'databricks') {
tableCreatePayLoad.table_name = tableCreatePayLoad.table_name tableCreatePayLoad.table_name = tableCreatePayLoad.table_name
.replace(/\s/g, '_') .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); const sqlMgr = await ProjectMgrv2.getSqlMgr(context, base);

Loading…
Cancel
Save