Browse Source

refactor: make only title as required

pull/9660/head
Pranav C 1 month ago
parent
commit
9ec0baec9a
  1. 2
      packages/nc-gui/utils/columnUtils.ts
  2. 3
      packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.controller.ts
  3. 8
      packages/nocodb/src/schema/swagger-v2.json
  4. 9
      packages/nocodb/src/schema/swagger.json
  5. 16
      packages/nocodb/src/services/tables.service.ts

2
packages/nc-gui/utils/columnUtils.ts

@ -289,7 +289,7 @@ const checkboxIconList = [
}, },
] ]
export const ratingIconList = [ const ratingIconList = [
{ {
full: 'mdi-star', full: 'mdi-star',
empty: 'mdi-star-outline', empty: 'mdi-star-outline',

3
packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.controller.ts

@ -194,6 +194,7 @@ export class DuplicateController {
@Param('modelId') modelId?: string, @Param('modelId') modelId?: string,
@Body() @Body()
body?: { body?: {
title?: string;
options?: { options?: {
excludeData?: boolean; excludeData?: boolean;
excludeViews?: boolean; excludeViews?: boolean;
@ -226,7 +227,7 @@ export class DuplicateController {
const models = await source.getModels(context); const models = await source.getModels(context);
const uniqueTitle = generateUniqueName( const uniqueTitle = generateUniqueName(
`${model.title} copy`, body.title || `${model.title} copy`,
models.map((p) => p.title), models.map((p) => p.title),
); );

8
packages/nocodb/src/schema/swagger-v2.json

@ -3883,6 +3883,11 @@
"excludeHooks": { "excludeHooks": {
"type": "boolean", "type": "boolean",
"required": false "required": false
},
"title": {
"type": "string",
"required": false,
"description": "New table title"
} }
} }
} }
@ -20568,7 +20573,6 @@
} }
}, },
"required": [ "required": [
"table_name",
"title" "title"
], ],
"x-stoplight": { "x-stoplight": {
@ -20839,7 +20843,7 @@
}, },
"required": [ "required": [
"columns", "columns",
"table_name" "title"
], ],
"title": "Table Request Model", "title": "Table Request Model",
"type": "object", "type": "object",

9
packages/nocodb/src/schema/swagger.json

@ -4489,6 +4489,11 @@
"excludeHooks": { "excludeHooks": {
"type": "boolean", "type": "boolean",
"required": false "required": false
},
"title": {
"type": "string",
"required": false,
"description": "New table title"
} }
} }
} }
@ -25625,7 +25630,7 @@
} }
}, },
"required": [ "required": [
"table_name", "title",
"title" "title"
], ],
"x-stoplight": { "x-stoplight": {
@ -25905,7 +25910,7 @@
}, },
"required": [ "required": [
"columns", "columns",
"table_name" "title"
], ],
"title": "Table Request Model", "title": "Table Request Model",
"type": "object", "type": "object",

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

@ -558,18 +558,12 @@ export class TablesService {
} }
} }
if (!tableCreatePayLoad.title) {
NcError.badRequest('Missing table `title` property in request body');
if (
!tableCreatePayLoad.title
) {
NcError.badRequest(
'Missing table `title` property in request body',
);
} }
if(!tableCreatePayLoad.table_name) { if (!tableCreatePayLoad.table_name) {
tableCreatePayLoad.table_name = tableCreatePayLoad.title;
} }
if ( if (
@ -623,8 +617,6 @@ export class TablesService {
); );
} }
const sqlMgr = await ProjectMgrv2.getSqlMgr(context, base); const sqlMgr = await ProjectMgrv2.getSqlMgr(context, base);
const sqlClient = await NcConnectionMgrv2.getSqlClient(source); const sqlClient = await NcConnectionMgrv2.getSqlClient(source);

Loading…
Cancel
Save