Fix relationship field metadata
This commit is contained in:
parent
5edc3d3de6
commit
248c44ac2a
|
@ -54,6 +54,7 @@ import {
|
||||||
FieldType,
|
FieldType,
|
||||||
RelationshipType,
|
RelationshipType,
|
||||||
CreateViewRequest,
|
CreateViewRequest,
|
||||||
|
RelationshipFieldMetadata,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
|
||||||
import API from "./api"
|
import API from "./api"
|
||||||
|
@ -587,7 +588,7 @@ class TestConfiguration {
|
||||||
tableId: this.table._id!,
|
tableId: this.table._id!,
|
||||||
name: link,
|
name: link,
|
||||||
relationshipType,
|
relationshipType,
|
||||||
}
|
} as RelationshipFieldMetadata
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.datasource && !tableConfig.sourceId) {
|
if (this.datasource && !tableConfig.sourceId) {
|
||||||
|
|
|
@ -19,17 +19,29 @@ interface BaseRelationshipFieldMetadata
|
||||||
extends Omit<BaseFieldSchema, "subtype"> {
|
extends Omit<BaseFieldSchema, "subtype"> {
|
||||||
type: FieldType.LINK
|
type: FieldType.LINK
|
||||||
main?: boolean
|
main?: boolean
|
||||||
fieldName?: string
|
fieldName: string
|
||||||
tableId: string
|
tableId: string
|
||||||
subtype?: Omit<AutoFieldSubTypes, AutoFieldSubTypes.AUTO_ID>
|
subtype?: Omit<AutoFieldSubTypes, AutoFieldSubTypes.AUTO_ID>
|
||||||
}
|
}
|
||||||
export interface ManyToManyRelationshipFieldMetadata
|
|
||||||
extends BaseRelationshipFieldMetadata {
|
// External tables use junction tables, internal tables don't require them
|
||||||
relationshipType: RelationshipType.MANY_TO_MANY
|
type ManyToManyJunctionTableMetadata =
|
||||||
through?: string
|
| {
|
||||||
throughFrom?: string
|
through: string
|
||||||
throughTo?: string
|
throughFrom: string
|
||||||
}
|
throughTo: string
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
through?: never
|
||||||
|
throughFrom?: never
|
||||||
|
throughTo?: never
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ManyToManyRelationshipFieldMetadata =
|
||||||
|
BaseRelationshipFieldMetadata & {
|
||||||
|
relationshipType: RelationshipType.MANY_TO_MANY
|
||||||
|
} & ManyToManyJunctionTableMetadata
|
||||||
|
|
||||||
export interface OneToManyRelationshipFieldMetadata
|
export interface OneToManyRelationshipFieldMetadata
|
||||||
extends BaseRelationshipFieldMetadata {
|
extends BaseRelationshipFieldMetadata {
|
||||||
relationshipType: RelationshipType.ONE_TO_MANY
|
relationshipType: RelationshipType.ONE_TO_MANY
|
||||||
|
|
Loading…
Reference in New Issue