Files
klz-cables.com/.pnpm-store/v10/files/56/176ae202a7037c102cfa2c72b2005e088cd6486eebc6152c7d31c469e675aace37a8c5f54539e6ac5a167733b59fad9f23bd21ef519e6bcfc10d4a472150a1
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

27 lines
985 B
Plaintext

import { valueIsValueWithRelation } from 'payload/shared';
export const transformRelationship = ({ baseRow, data, field, relationships })=>{
const relations = Array.isArray(data) ? data : [
data
];
relations.forEach((relation, i)=>{
if (relation) {
const relationRow = {
...baseRow
};
if ('hasMany' in field && field.hasMany) {
relationRow.order = i + 1;
}
if (Array.isArray(field.relationTo) && valueIsValueWithRelation(relation)) {
relationRow[`${relation.relationTo}ID`] = relation.value;
relationships.push(relationRow);
} else if (typeof field.relationTo === 'string') {
relationRow[`${field.relationTo}ID`] = relation;
if (relation) {
relationships.push(relationRow);
}
}
}
});
};
//# sourceMappingURL=relationships.js.map