Removed autogeneration logic.

This commit is contained in:
devanshu052000 2025-01-07 18:04:32 +05:30
parent 8304a72458
commit 1207c5cdf1

View file

@ -50,7 +50,6 @@ export default function autogenerateColumns(
const currentKey = parentKey ? `${parentKey}.${key}` : key;
if (isValueIsPlainObject(value)) {
// if value is object particularly, then we only want nested keys till one level of nesting
accumulator.push(currentKey);
accumulator.push(...limitToOneLevelNestingHelperFunc(value, currentKey));
} else if (isValueIsPremitiveOrArray(value)) {
// check if value is premitive or array then simply push current key in the accumulator.
@ -99,7 +98,7 @@ export default function autogenerateColumns(
id: uuidv4(),
name: key,
key: key,
columnType: convertDataTypeToColumnType(dataType, firstRow[key]),
columnType: convertDataTypeToColumnType(dataType),
autogenerated: true,
}));
@ -124,8 +123,7 @@ const dataTypeToColumnTypeMapping = {
boolean: 'boolean',
};
const convertDataTypeToColumnType = (dataType, value) => {
const convertDataTypeToColumnType = (dataType) => {
if (Object.keys(dataTypeToColumnTypeMapping).includes(dataType)) return dataTypeToColumnTypeMapping[dataType];
if (dataType === 'object' && !Array.isArray(value)) return 'json';
else return 'string';
};