More types

This commit is contained in:
Adria Navarro 2023-10-11 13:37:50 +02:00
parent 1e8aa9eb60
commit a3b3c176d3
1 changed files with 2 additions and 2 deletions

View File

@ -109,8 +109,8 @@ export async function getLinkedTable(id: string, tables: Table[]) {
export function getRelatedTableForField(table: Table, fieldName: string) { export function getRelatedTableForField(table: Table, fieldName: string) {
// look to see if its on the table, straight in the schema // look to see if its on the table, straight in the schema
const field = table.schema[fieldName] const field = table.schema[fieldName]
if (field != null) { if (field?.type === FieldTypes.LINK) {
return (field as any).tableId return field.tableId
} }
for (let column of Object.values(table.schema)) { for (let column of Object.values(table.schema)) {
if (column.type === FieldTypes.LINK && column.fieldName === fieldName) { if (column.type === FieldTypes.LINK && column.fieldName === fieldName) {