Browse Source

feat: created/modified time - column creation - WIP

pull/7304/head
Pranav C 10 months ago
parent
commit
fc72995190
  1. 6
      packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts
  2. 12
      packages/nocodb/src/services/columns.service.ts

6
packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts

@ -23,6 +23,12 @@ export default async function getColumnPropsFromUIDT(
...colProp,
};
if (newColumn.uidt === UITypes.CreateTime) {
newColumn.column_name = 'created_at';
} else if (newColumn.uidt === UITypes.LastModifiedTime) {
newColumn.column_name = 'updated_at';
}
newColumn.dtxp = sqlUi.getDefaultLengthForDatatype(newColumn.dt);
newColumn.dtxs = sqlUi.getDefaultScaleForDatatype(newColumn.dt);

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

@ -17,8 +17,16 @@ import {
} from 'nocodb-sdk';
import { pluralize, singularize } from 'inflection';
import hash from 'object-hash';
import { isCreatedTimeOrUpdatedTimeCol } from 'nocodb-sdk/build/main/lib/UITypes';
import type {
ColumnReqType,
LinkToAnotherColumnReqType,
LinkToAnotherRecordType,
RelationTypes,
UserType,
} from 'nocodb-sdk';
import type SqlMgrv2 from '~/db/sql-mgr/v2/SqlMgrv2';
import type {Base, LinkToAnotherRecordColumn} from '~/models';
import type { Base, LinkToAnotherRecordColumn } from '~/models';
import type {
ColumnReqType,
LinkToAnotherColumnReqType,
@ -30,6 +38,7 @@ import type CustomKnex from '~/db/CustomKnex';
import type SqlClient from '~/db/sql-client/lib/SqlClient';
import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2';
import type { NcRequest } from '~/interface/config';
import { Column, FormulaColumn, KanbanView, Model, Source } from '~/models';
import { AppHooksService } from '~/services/app-hooks/app-hooks.service';
import formulaQueryBuilderv2 from '~/db/formulav2/formulaQueryBuilderv2';
import ProjectMgrv2 from '~/db/sql-mgr/v2/ProjectMgrv2';
@ -63,7 +72,6 @@ import Noco from '~/Noco';
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2';
import { MetaTable } from '~/utils/globals';
import { MetaService } from '~/meta/meta.service';
import {isCreatedTimeOrUpdatedTimeCol} from "nocodb-sdk/build/main/lib/UITypes";
// todo: move
export enum Altered {

Loading…
Cancel
Save