From fcaf657e539761557f3d80df5fa0888dbf4afcbc Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 11 Oct 2023 13:53:14 +0200 Subject: [PATCH] More types --- .../server/src/api/controllers/row/ExternalRequest.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/server/src/api/controllers/row/ExternalRequest.ts b/packages/server/src/api/controllers/row/ExternalRequest.ts index cf8f7b5be4..220e0cf2b9 100644 --- a/packages/server/src/api/controllers/row/ExternalRequest.ts +++ b/packages/server/src/api/controllers/row/ExternalRequest.ts @@ -560,10 +560,7 @@ export class ExternalRequest { if (!table.primary || !linkTable.primary) { continue } - const definition: any = { - // 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, + const definition: RelationshipsJson = { tableName: linkTableName, // need to specify where to put this back into column: fieldName, @@ -578,6 +575,10 @@ export class ExternalRequest { definition.to = field.throughFrom || linkTable.primary[0] definition.fromPrimary = table.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) }