Browse Source

fix: for belongs to only include first item from array in error message

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/7121/head
Pranav C 1 year ago
parent
commit
4e39326c5c
  1. 9
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -4989,6 +4989,7 @@ class BaseModelSqlv2 {
NcError.unprocessableEntity( NcError.unprocessableEntity(
`Child record with id [${extractIdsString( `Child record with id [${extractIdsString(
childIds, childIds,
true,
)}] not found`, )}] not found`,
); );
} }
@ -5223,6 +5224,7 @@ class BaseModelSqlv2 {
NcError.unprocessableEntity( NcError.unprocessableEntity(
`Child record with id [${extractIdsString( `Child record with id [${extractIdsString(
childIds, childIds,
true,
)}] not found`, )}] not found`,
); );
} }
@ -5689,8 +5691,11 @@ export function getListArgs(
return obj; return obj;
} }
function extractIdsString(childIds: (string | number | Record<string, any>)[]) { function extractIdsString(
return childIds childIds: (string | number | Record<string, any>)[],
isBt = false,
) {
return (isBt ? childIds.slice(0, 1) : childIds)
.map((r) => (typeof r === 'object' ? JSON.stringify(r) : r)) .map((r) => (typeof r === 'object' ? JSON.stringify(r) : r))
.join(', '); .join(', ');
} }

Loading…
Cancel
Save