|
|
@ -1385,6 +1385,7 @@ class BaseModelSqlv2 { |
|
|
|
(c) => c.uidt === UITypes.LinkToAnotherRecord |
|
|
|
(c) => c.uidt === UITypes.LinkToAnotherRecord |
|
|
|
); |
|
|
|
); |
|
|
|
const res = []; |
|
|
|
const res = []; |
|
|
|
|
|
|
|
let i = 0; |
|
|
|
for (const column of LTARColumns) { |
|
|
|
for (const column of LTARColumns) { |
|
|
|
const colOptions = |
|
|
|
const colOptions = |
|
|
|
(await column.getColOptions()) as LinkToAnotherRecordColumn; |
|
|
|
(await column.getColOptions()) as LinkToAnotherRecordColumn; |
|
|
@ -1394,10 +1395,18 @@ class BaseModelSqlv2 { |
|
|
|
await childModel.getColumns(); |
|
|
|
await childModel.getColumns(); |
|
|
|
const parentModel = await parentColumn.getModel(); |
|
|
|
const parentModel = await parentColumn.getModel(); |
|
|
|
await parentModel.getColumns(); |
|
|
|
await parentModel.getColumns(); |
|
|
|
let i = 0; |
|
|
|
|
|
|
|
if (colOptions.type === RelationTypes.HAS_MANY) { |
|
|
|
if (colOptions.type === RelationTypes.HAS_MANY) { |
|
|
|
// TODO:
|
|
|
|
const selectHmCount = await this.dbDriver(childModel.table_name) |
|
|
|
continue; |
|
|
|
.count(childColumn.column_name, { as: 'cnt' }) |
|
|
|
|
|
|
|
.where(childColumn.column_name, rowId); |
|
|
|
|
|
|
|
const cnt = (await selectHmCount)[0].cnt; |
|
|
|
|
|
|
|
if (cnt) { |
|
|
|
|
|
|
|
res.push( |
|
|
|
|
|
|
|
`${i++ + 1}. ${model.title}.${ |
|
|
|
|
|
|
|
column.title |
|
|
|
|
|
|
|
} is a LinkToAnotherRecord of ${childModel.title}` |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} else if (colOptions.type === RelationTypes.BELONGS_TO) { |
|
|
|
} else if (colOptions.type === RelationTypes.BELONGS_TO) { |
|
|
|
// TODO:
|
|
|
|
// TODO:
|
|
|
|
continue; |
|
|
|
continue; |
|
|
|