Fixes fixes

This commit is contained in:
Adria Navarro 2023-10-06 09:32:28 +02:00
parent 1f1ebc82e5
commit a8c814e714
3 changed files with 13 additions and 7 deletions

View File

@ -1,5 +1,11 @@
import _ from "lodash" import _ from "lodash"
import { FieldType, Table, TableSchema, ViewV2 } from "@budibase/types" import {
FieldSchema,
FieldType,
Table,
TableSchema,
ViewV2,
} from "@budibase/types"
import { generator } from "@budibase/backend-core/tests" import { generator } from "@budibase/backend-core/tests"
import { enrichSchema, syncSchema } from ".." import { enrichSchema, syncSchema } from ".."
@ -316,7 +322,7 @@ describe("table sdk", () => {
...basicView, ...basicView,
} }
const newTableSchema = { const newTableSchema: TableSchema = {
...basicTable.schema, ...basicTable.schema,
newField1: { newField1: {
type: FieldType.STRING, type: FieldType.STRING,
@ -403,7 +409,7 @@ describe("table sdk", () => {
}, },
} }
const newTableSchema = { const newTableSchema: TableSchema = {
...basicTable.schema, ...basicTable.schema,
newField1: { newField1: {
type: FieldType.STRING, type: FieldType.STRING,
@ -531,7 +537,7 @@ describe("table sdk", () => {
id: { id: {
...basicTable.schema.id, ...basicTable.schema.id,
type: FieldType.NUMBER, type: FieldType.NUMBER,
}, } as FieldSchema,
}, },
undefined undefined
) )

View File

@ -5,13 +5,13 @@ import {
FormulaTypes, FormulaTypes,
} from "../../constants" } from "../../constants"
import { processStringSync } from "@budibase/string-templates" import { processStringSync } from "@budibase/string-templates"
import { AutoColumnFieldMetadata, Row, Table } from "@budibase/types" import { FieldSchema, Row, Table } from "@budibase/types"
/** /**
* If the subtype has been lost for any reason this works out what * If the subtype has been lost for any reason this works out what
* subtype the auto column should be. * subtype the auto column should be.
*/ */
export function fixAutoColumnSubType(column: AutoColumnFieldMetadata) { export function fixAutoColumnSubType(column: FieldSchema) {
if (!column.autocolumn || !column.name || column.subtype) { if (!column.autocolumn || !column.name || column.subtype) {
return column return column
} }

View File

@ -121,7 +121,7 @@ interface BaseFieldSchema extends UIFieldMetadata {
subtype?: string subtype?: string
} }
export interface OtherFieldMetadata extends BaseFieldSchema { interface OtherFieldMetadata extends BaseFieldSchema {
type: Exclude< type: Exclude<
FieldType, FieldType,
| FieldType.DATETIME | FieldType.DATETIME