Browse Source

fix: extract id using title

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/7120/head
Pranav C 11 months ago
parent
commit
932644d0e4
  1. 8
      packages/nocodb/src/controllers/data-table.controller.ts
  2. 7
      packages/nocodb/src/db/BaseModelSqlv2.ts
  3. 8
      packages/nocodb/src/services/data-table.service.ts

8
packages/nocodb/src/controllers/data-table.controller.ts

@ -153,7 +153,13 @@ export class DataTableController {
@Param('columnId') columnId: string,
@Param('rowId') rowId: string,
@Body()
refRowIds: string | string[] | number | number[] | Record<string, any>,
refRowIds:
| string
| string[]
| number
| number[]
| Record<string, any>
| Record<string, any>[],
) {
return await this.dataTableService.nestedLink({
modelId,

7
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -4878,8 +4878,11 @@ class BaseModelSqlv2 {
.filter((childRow) => !childRow[vChildCol.column_name])
// generate insert data for new links
.map((childRow) => ({
[vParentCol.column_name]: childRow[parentColumn.column_name],
[vChildCol.column_name]: row[childColumn.column_name],
[vParentCol.column_name]:
childRow[parentColumn.title] ??
childRow[parentColumn.column_name],
[vChildCol.column_name]:
row[childColumn.title] ?? row[childColumn.column_name],
}));
// if no new links, return true

8
packages/nocodb/src/services/data-table.service.ts

@ -371,7 +371,13 @@ export class DataTableService {
modelId: string;
columnId: string;
query: any;
refRowIds: string | string[] | number | number[] | Record<string, any>;
refRowIds:
| string
| string[]
| number
| number[]
| Record<string, any>
| Record<string, any>[];
rowId: string;
}) {
this.validateIds(param.refRowIds);

Loading…
Cancel
Save