|
|
@ -4869,7 +4869,9 @@ class BaseModelSqlv2 { |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
NcError.unprocessableEntity( |
|
|
|
NcError.unprocessableEntity( |
|
|
|
`Child record with id [${missingIds.join(', ')}] not found`, |
|
|
|
`Child record with id [${extractIdsString( |
|
|
|
|
|
|
|
missingIds, |
|
|
|
|
|
|
|
)}] not found`,
|
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -4878,8 +4880,11 @@ class BaseModelSqlv2 { |
|
|
|
.filter((childRow) => !childRow[vChildCol.column_name]) |
|
|
|
.filter((childRow) => !childRow[vChildCol.column_name]) |
|
|
|
// generate insert data for new links
|
|
|
|
// generate insert data for new links
|
|
|
|
.map((childRow) => ({ |
|
|
|
.map((childRow) => ({ |
|
|
|
[vParentCol.column_name]: childRow[parentColumn.column_name], |
|
|
|
[vParentCol.column_name]: |
|
|
|
[vChildCol.column_name]: row[childColumn.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
|
|
|
|
// if no new links, return true
|
|
|
@ -4930,7 +4935,9 @@ class BaseModelSqlv2 { |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
NcError.unprocessableEntity( |
|
|
|
NcError.unprocessableEntity( |
|
|
|
`Child record with id [${missingIds.join(', ')}] not found`, |
|
|
|
`Child record with id [${extractIdsString( |
|
|
|
|
|
|
|
missingIds, |
|
|
|
|
|
|
|
)}] not found`,
|
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -4980,7 +4987,10 @@ class BaseModelSqlv2 { |
|
|
|
|
|
|
|
|
|
|
|
if (!childRow) { |
|
|
|
if (!childRow) { |
|
|
|
NcError.unprocessableEntity( |
|
|
|
NcError.unprocessableEntity( |
|
|
|
`Child record with id [${childIds[0]}] not found`, |
|
|
|
`Child record with id [${extractIdsString( |
|
|
|
|
|
|
|
childIds, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
)}] not found`,
|
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -5106,7 +5116,9 @@ class BaseModelSqlv2 { |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
NcError.unprocessableEntity( |
|
|
|
NcError.unprocessableEntity( |
|
|
|
`Child record with id [${missingIds.join(', ')}] not found`, |
|
|
|
`Child record with id [${extractIdsString( |
|
|
|
|
|
|
|
missingIds, |
|
|
|
|
|
|
|
)}] not found`,
|
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -5154,7 +5166,9 @@ class BaseModelSqlv2 { |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
NcError.unprocessableEntity( |
|
|
|
NcError.unprocessableEntity( |
|
|
|
`Child record with id [${missingIds.join(', ')}] not found`, |
|
|
|
`Child record with id [${extractIdsString( |
|
|
|
|
|
|
|
missingIds, |
|
|
|
|
|
|
|
)}] not found`,
|
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -5208,7 +5222,10 @@ class BaseModelSqlv2 { |
|
|
|
|
|
|
|
|
|
|
|
if (!childRow) { |
|
|
|
if (!childRow) { |
|
|
|
NcError.unprocessableEntity( |
|
|
|
NcError.unprocessableEntity( |
|
|
|
`Child record with id [${childIds[0]}] not found`, |
|
|
|
`Child record with id [${extractIdsString( |
|
|
|
|
|
|
|
childIds, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
)}] not found`,
|
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -5674,4 +5691,13 @@ export function getListArgs( |
|
|
|
return obj; |
|
|
|
return obj; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function extractIdsString( |
|
|
|
|
|
|
|
childIds: (string | number | Record<string, any>)[], |
|
|
|
|
|
|
|
isBt = false, |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
return (isBt ? childIds.slice(0, 1) : childIds) |
|
|
|
|
|
|
|
.map((r) => (typeof r === 'object' ? JSON.stringify(r) : r)) |
|
|
|
|
|
|
|
.join(', '); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export { BaseModelSqlv2 }; |
|
|
|
export { BaseModelSqlv2 }; |
|
|
|