1
0
Fork 0
mirror of synced 2024-10-03 19:43:32 +13:00

Fix more types

This commit is contained in:
Adria Navarro 2023-10-05 16:14:30 +02:00
parent 21e2d7ddbe
commit 40226c5c3a
3 changed files with 12 additions and 3 deletions

View file

@ -4,6 +4,8 @@ import { context } from "@budibase/backend-core"
import {
Ctx,
FieldType,
ManyToOneRelationshipFieldMetadata,
OneToManyRelationshipFieldMetadata,
Row,
SearchFilters,
Table,
@ -19,7 +21,14 @@ function isForeignKey(key: string, table: Table) {
const relationships = Object.values(table.schema).filter(
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, {

View file

@ -584,7 +584,7 @@ class TestConfiguration {
tableConfig.schema[link] = {
type: FieldType.LINK,
fieldName: link,
tableId: this.table._id,
tableId: this.table._id!,
name: link,
relationshipType,
}

View file

@ -66,7 +66,7 @@ interface NumberForeignKeyMetadata {
export type NumberFieldMetadata = BaseFieldSchema & {
type: FieldType.NUMBER
autocolumn: boolean
autocolumn?: boolean
} & (NumberForeignKeyMetadata | {})
export interface DateFieldMetadata extends BaseFieldSchema {