|
|
@ -1,4 +1,11 @@ |
|
|
|
import { Injectable } from '@nestjs/common'; |
|
|
|
import { Injectable } from '@nestjs/common'; |
|
|
|
|
|
|
|
import type { |
|
|
|
|
|
|
|
ColumnReqType, |
|
|
|
|
|
|
|
LinkToAnotherColumnReqType, |
|
|
|
|
|
|
|
LinkToAnotherRecordType, |
|
|
|
|
|
|
|
RelationTypes, |
|
|
|
|
|
|
|
UserType, |
|
|
|
|
|
|
|
} from 'nocodb-sdk'; |
|
|
|
import { |
|
|
|
import { |
|
|
|
AppEvents, |
|
|
|
AppEvents, |
|
|
|
isLinksOrLTAR, |
|
|
|
isLinksOrLTAR, |
|
|
@ -56,6 +63,7 @@ import Noco from '~/Noco'; |
|
|
|
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2'; |
|
|
|
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2'; |
|
|
|
import { MetaTable } from '~/utils/globals'; |
|
|
|
import { MetaTable } from '~/utils/globals'; |
|
|
|
import { MetaService } from '~/meta/meta.service'; |
|
|
|
import { MetaService } from '~/meta/meta.service'; |
|
|
|
|
|
|
|
import {isCreatedTimeOrUpdatedTimeCol} from "nocodb-sdk/build/main/lib/UITypes"; |
|
|
|
|
|
|
|
|
|
|
|
// todo: move
|
|
|
|
// todo: move
|
|
|
|
export enum Altered { |
|
|
|
export enum Altered { |
|
|
@ -171,6 +179,7 @@ export class ColumnsService { |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
!isVirtualCol(param.column) && |
|
|
|
!isVirtualCol(param.column) && |
|
|
|
|
|
|
|
!isCreatedTimeOrUpdatedTimeCol(param.column) && |
|
|
|
!(await Column.checkTitleAvailable({ |
|
|
|
!(await Column.checkTitleAvailable({ |
|
|
|
column_name: param.column.column_name, |
|
|
|
column_name: param.column.column_name, |
|
|
|
fk_model_id: column.fk_model_id, |
|
|
|
fk_model_id: column.fk_model_id, |
|
|
@ -195,6 +204,7 @@ export class ColumnsService { |
|
|
|
parsed_tree?: any; |
|
|
|
parsed_tree?: any; |
|
|
|
}; |
|
|
|
}; |
|
|
|
if ( |
|
|
|
if ( |
|
|
|
|
|
|
|
isCreatedTimeOrUpdatedTimeCol(column) || |
|
|
|
[ |
|
|
|
[ |
|
|
|
UITypes.Lookup, |
|
|
|
UITypes.Lookup, |
|
|
|
UITypes.Rollup, |
|
|
|
UITypes.Rollup, |
|
|
@ -295,9 +305,10 @@ export class ColumnsService { |
|
|
|
} else if ( |
|
|
|
} else if ( |
|
|
|
[UITypes.CreateTime, UITypes.LastModifiedTime].includes(colBody.uidt) |
|
|
|
[UITypes.CreateTime, UITypes.LastModifiedTime].includes(colBody.uidt) |
|
|
|
) { |
|
|
|
) { |
|
|
|
// todo: correct this
|
|
|
|
// allow updating of title only
|
|
|
|
const existingColumn = await table.getColumns().then((col) => { |
|
|
|
await Column.update(param.columnId, { |
|
|
|
return col.find((c) => c.uidt === colBody.uidt); |
|
|
|
...column, |
|
|
|
|
|
|
|
title: colBody.title, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (!existingColumn) { |
|
|
|
if (!existingColumn) { |
|
|
|