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