More types

This commit is contained in:
Adria Navarro 2023-10-11 13:53:14 +02:00
parent 514f2b0cef
commit fcaf657e53
1 changed files with 5 additions and 4 deletions

View File

@ -560,10 +560,7 @@ export class ExternalRequest<T extends Operation> {
if (!table.primary || !linkTable.primary) { if (!table.primary || !linkTable.primary) {
continue continue
} }
const definition: any = { const definition: RelationshipsJson = {
// if no foreign key specified then use the name of the field in other table
from: (field as any).foreignKey || table.primary[0],
to: field.fieldName,
tableName: linkTableName, tableName: linkTableName,
// need to specify where to put this back into // need to specify where to put this back into
column: fieldName, column: fieldName,
@ -578,6 +575,10 @@ export class ExternalRequest<T extends Operation> {
definition.to = field.throughFrom || linkTable.primary[0] definition.to = field.throughFrom || linkTable.primary[0]
definition.fromPrimary = table.primary[0] definition.fromPrimary = table.primary[0]
definition.toPrimary = linkTable.primary[0] definition.toPrimary = linkTable.primary[0]
} else {
// if no foreign key specified then use the name of the field in other table
definition.from = (field as any).foreignKey || table.primary[0]
definition.to = field.fieldName
} }
relationships.push(definition) relationships.push(definition)
} }