From 79ef97387bccde2ce5bba15ccfa521650444496a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 11 Oct 2023 13:06:18 +0200 Subject: [PATCH] Subtype on datetime --- .../src/db/defaultData/datasource_bb_default.ts | 12 ++++++------ packages/types/src/documents/app/table/schema.ts | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/server/src/db/defaultData/datasource_bb_default.ts b/packages/server/src/db/defaultData/datasource_bb_default.ts index 7eb3bfd26c..48d4876de1 100644 --- a/packages/server/src/db/defaultData/datasource_bb_default.ts +++ b/packages/server/src/db/defaultData/datasource_bb_default.ts @@ -11,8 +11,8 @@ import { Table, Row, RelationshipType, - AutoColumnFieldMetadata, FieldType, + TableSchema, } from "@budibase/types" export const DEFAULT_JOBS_TABLE_ID = "ta_bb_jobs" @@ -52,7 +52,7 @@ async function tableImport(table: Table, data: Row[]) { } // AUTO COLUMNS -const AUTO_COLUMNS = { +const AUTO_COLUMNS: TableSchema = { "Created At": { name: "Created At", type: FieldTypes.DATETIME, @@ -194,7 +194,7 @@ export const DEFAULT_INVENTORY_TABLE_SCHEMA: Table = { }, ...AUTO_COLUMNS, }, -} as any +} export const DEFAULT_EMPLOYEE_TABLE_SCHEMA: Table = { _id: DEFAULT_EMPLOYEE_TABLE_ID, @@ -342,7 +342,7 @@ export const DEFAULT_EMPLOYEE_TABLE_SCHEMA: Table = { }, ...AUTO_COLUMNS, }, -} as any +} export const DEFAULT_JOBS_TABLE_SCHEMA: Table = { _id: DEFAULT_JOBS_TABLE_ID, @@ -499,7 +499,7 @@ export const DEFAULT_JOBS_TABLE_SCHEMA: Table = { }, ...AUTO_COLUMNS, }, -} as any +} export const DEFAULT_EXPENSES_TABLE_SCHEMA: Table = { _id: DEFAULT_EXPENSES_TABLE_ID, @@ -609,7 +609,7 @@ export const DEFAULT_EXPENSES_TABLE_SCHEMA: Table = { }, ...AUTO_COLUMNS, }, -} as any +} export async function buildDefaultDocs() { const inventoryData = await tableImport( diff --git a/packages/types/src/documents/app/table/schema.ts b/packages/types/src/documents/app/table/schema.ts index ca8fbf7cba..4106254fc4 100644 --- a/packages/types/src/documents/app/table/schema.ts +++ b/packages/types/src/documents/app/table/schema.ts @@ -21,7 +21,7 @@ interface BaseRelationshipFieldMetadata main?: boolean fieldName: string tableId: string - subtype?: Omit + subtype?: AutoFieldSubTypes.CREATED_BY | AutoFieldSubTypes.UPDATED_BY } // External tables use junction tables, internal tables don't require them @@ -80,10 +80,11 @@ export interface NumberFieldMetadata extends Omit { } } -export interface DateFieldMetadata extends BaseFieldSchema { +export interface DateFieldMetadata extends Omit { type: FieldType.DATETIME ignoreTimezones?: boolean timeOnly?: boolean + subtype?: AutoFieldSubTypes.CREATED_AT | AutoFieldSubTypes.UPDATED_AT } export interface LongFormFieldMetadata extends BaseFieldSchema {