Browse Source

refactor: instead of column_name make title mandatory for column create

pull/9660/head
Pranav C 1 month ago
parent
commit
cda0408ce1
  1. 2
      packages/nocodb/src/schema/swagger.json
  2. 7
      packages/nocodb/src/services/columns.service.ts

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

@ -23698,7 +23698,7 @@
"title": "Normal Column Request Model",
"type": "object",
"required": [
"column_name"
"title"
],
"x-stoplight": {
"id": "fn3gqmojvswv2"

7
packages/nocodb/src/services/columns.service.ts

@ -16,6 +16,7 @@ import {
} from 'nocodb-sdk';
import { pluralize, singularize } from 'inflection';
import hash from 'object-hash';
import { parseMetaProp } from 'src/utils/modelUtils';
import type {
ColumnReqType,
LinkToAnotherColumnReqType,
@ -65,7 +66,6 @@ import Noco from '~/Noco';
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2';
import { MetaTable } from '~/utils/globals';
import { MetaService } from '~/meta/meta.service';
import { parseMetaProp } from 'src/utils/modelUtils';
// todo: move
export enum Altered {
@ -1674,6 +1674,11 @@ export class ColumnsService {
param.column.title = param.column.title.trim();
}
// if column_name missing then generate it from title
if (!param.column.column_name) {
param.column.column_name = param.column.title;
}
if (param.column.column_name) {
// - 5 is a buffer for suffix
let colName = param.column.column_name.slice(0, mxColumnLength - 5);

Loading…
Cancel
Save