Subtype on datetime

This commit is contained in:
Adria Navarro 2023-10-11 13:06:18 +02:00
parent 3f6d48da1f
commit 79ef97387b
2 changed files with 9 additions and 8 deletions

View File

@ -11,8 +11,8 @@ import {
Table, Table,
Row, Row,
RelationshipType, RelationshipType,
AutoColumnFieldMetadata,
FieldType, FieldType,
TableSchema,
} from "@budibase/types" } from "@budibase/types"
export const DEFAULT_JOBS_TABLE_ID = "ta_bb_jobs" export const DEFAULT_JOBS_TABLE_ID = "ta_bb_jobs"
@ -52,7 +52,7 @@ async function tableImport(table: Table, data: Row[]) {
} }
// AUTO COLUMNS // AUTO COLUMNS
const AUTO_COLUMNS = { const AUTO_COLUMNS: TableSchema = {
"Created At": { "Created At": {
name: "Created At", name: "Created At",
type: FieldTypes.DATETIME, type: FieldTypes.DATETIME,
@ -194,7 +194,7 @@ export const DEFAULT_INVENTORY_TABLE_SCHEMA: Table = {
}, },
...AUTO_COLUMNS, ...AUTO_COLUMNS,
}, },
} as any }
export const DEFAULT_EMPLOYEE_TABLE_SCHEMA: Table = { export const DEFAULT_EMPLOYEE_TABLE_SCHEMA: Table = {
_id: DEFAULT_EMPLOYEE_TABLE_ID, _id: DEFAULT_EMPLOYEE_TABLE_ID,
@ -342,7 +342,7 @@ export const DEFAULT_EMPLOYEE_TABLE_SCHEMA: Table = {
}, },
...AUTO_COLUMNS, ...AUTO_COLUMNS,
}, },
} as any }
export const DEFAULT_JOBS_TABLE_SCHEMA: Table = { export const DEFAULT_JOBS_TABLE_SCHEMA: Table = {
_id: DEFAULT_JOBS_TABLE_ID, _id: DEFAULT_JOBS_TABLE_ID,
@ -499,7 +499,7 @@ export const DEFAULT_JOBS_TABLE_SCHEMA: Table = {
}, },
...AUTO_COLUMNS, ...AUTO_COLUMNS,
}, },
} as any }
export const DEFAULT_EXPENSES_TABLE_SCHEMA: Table = { export const DEFAULT_EXPENSES_TABLE_SCHEMA: Table = {
_id: DEFAULT_EXPENSES_TABLE_ID, _id: DEFAULT_EXPENSES_TABLE_ID,
@ -609,7 +609,7 @@ export const DEFAULT_EXPENSES_TABLE_SCHEMA: Table = {
}, },
...AUTO_COLUMNS, ...AUTO_COLUMNS,
}, },
} as any }
export async function buildDefaultDocs() { export async function buildDefaultDocs() {
const inventoryData = await tableImport( const inventoryData = await tableImport(

View File

@ -21,7 +21,7 @@ interface BaseRelationshipFieldMetadata
main?: boolean main?: boolean
fieldName: string fieldName: string
tableId: string tableId: string
subtype?: Omit<AutoFieldSubTypes, AutoFieldSubTypes.AUTO_ID> subtype?: AutoFieldSubTypes.CREATED_BY | AutoFieldSubTypes.UPDATED_BY
} }
// External tables use junction tables, internal tables don't require them // External tables use junction tables, internal tables don't require them
@ -80,10 +80,11 @@ export interface NumberFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
} }
} }
export interface DateFieldMetadata extends BaseFieldSchema { export interface DateFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
type: FieldType.DATETIME type: FieldType.DATETIME
ignoreTimezones?: boolean ignoreTimezones?: boolean
timeOnly?: boolean timeOnly?: boolean
subtype?: AutoFieldSubTypes.CREATED_AT | AutoFieldSubTypes.UPDATED_AT
} }
export interface LongFormFieldMetadata extends BaseFieldSchema { export interface LongFormFieldMetadata extends BaseFieldSchema {