Refactor breakRowIdField

This commit is contained in:
Adria Navarro 2024-07-08 13:27:30 +02:00
parent f26a8d410a
commit 85827bbf93
2 changed files with 4 additions and 2 deletions

View File

@ -217,8 +217,7 @@ class InternalBuilder {
if (!opts.relationship && !isRelationshipField) { if (!opts.relationship && !isRelationshipField) {
const alias = getTableAlias(tableName) const alias = getTableAlias(tableName)
fn(alias ? `${alias}.${updatedKey}` : updatedKey, value) fn(alias ? `${alias}.${updatedKey}` : updatedKey, value)
} } else if (opts.relationship && isRelationshipField) {
if (opts.relationship && isRelationshipField) {
const [filterTableName, property] = updatedKey.split(".") const [filterTableName, property] = updatedKey.split(".")
const alias = getTableAlias(filterTableName) const alias = getTableAlias(filterTableName)
fn(alias ? `${alias}.${property}` : property, value) fn(alias ? `${alias}.${property}` : property, value)

View File

@ -116,6 +116,9 @@ export function breakRowIdField(_id: string | { _id: string }): any[] {
return Array.isArray(parsed) ? parsed : [parsed] return Array.isArray(parsed) ? parsed : [parsed]
} catch (err) { } catch (err) {
// wasn't json - likely was handlebars for a many to many // wasn't json - likely was handlebars for a many to many
if (Array.isArray(_id)) {
return _id
}
return [_id] return [_id]
} }
} }