Fix more types
This commit is contained in:
parent
21e2d7ddbe
commit
40226c5c3a
|
@ -4,6 +4,8 @@ import { context } from "@budibase/backend-core"
|
||||||
import {
|
import {
|
||||||
Ctx,
|
Ctx,
|
||||||
FieldType,
|
FieldType,
|
||||||
|
ManyToOneRelationshipFieldMetadata,
|
||||||
|
OneToManyRelationshipFieldMetadata,
|
||||||
Row,
|
Row,
|
||||||
SearchFilters,
|
SearchFilters,
|
||||||
Table,
|
Table,
|
||||||
|
@ -19,7 +21,14 @@ function isForeignKey(key: string, table: Table) {
|
||||||
const relationships = Object.values(table.schema).filter(
|
const relationships = Object.values(table.schema).filter(
|
||||||
column => column.type === FieldType.LINK
|
column => column.type === FieldType.LINK
|
||||||
)
|
)
|
||||||
return relationships.some(relationship => relationship.foreignKey === key)
|
return relationships.some(
|
||||||
|
relationship =>
|
||||||
|
(
|
||||||
|
relationship as
|
||||||
|
| OneToManyRelationshipFieldMetadata
|
||||||
|
| ManyToOneRelationshipFieldMetadata
|
||||||
|
).foreignKey === key
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
validateJs.extend(validateJs.validators.datetime, {
|
validateJs.extend(validateJs.validators.datetime, {
|
||||||
|
|
|
@ -584,7 +584,7 @@ class TestConfiguration {
|
||||||
tableConfig.schema[link] = {
|
tableConfig.schema[link] = {
|
||||||
type: FieldType.LINK,
|
type: FieldType.LINK,
|
||||||
fieldName: link,
|
fieldName: link,
|
||||||
tableId: this.table._id,
|
tableId: this.table._id!,
|
||||||
name: link,
|
name: link,
|
||||||
relationshipType,
|
relationshipType,
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ interface NumberForeignKeyMetadata {
|
||||||
|
|
||||||
export type NumberFieldMetadata = BaseFieldSchema & {
|
export type NumberFieldMetadata = BaseFieldSchema & {
|
||||||
type: FieldType.NUMBER
|
type: FieldType.NUMBER
|
||||||
autocolumn: boolean
|
autocolumn?: boolean
|
||||||
} & (NumberForeignKeyMetadata | {})
|
} & (NumberForeignKeyMetadata | {})
|
||||||
|
|
||||||
export interface DateFieldMetadata extends BaseFieldSchema {
|
export interface DateFieldMetadata extends BaseFieldSchema {
|
||||||
|
|
Loading…
Reference in New Issue