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
19 lines
689 B
Plaintext
19 lines
689 B
Plaintext
// Helper function to extract value or relationship ID for database queries
|
|
export const extractValueOrRelationshipID = relationship => {
|
|
if (!relationship || typeof relationship !== 'object') {
|
|
return relationship;
|
|
}
|
|
// For polymorphic relationships, preserve structure but ensure IDs are strings
|
|
if (relationship?.relationTo && relationship?.value) {
|
|
return {
|
|
relationTo: relationship.relationTo,
|
|
value: String(relationship.value?.id || relationship.value)
|
|
};
|
|
}
|
|
// For regular relationships, extract ID
|
|
if (relationship?.id) {
|
|
return String(relationship.id);
|
|
}
|
|
return relationship;
|
|
};
|
|
//# sourceMappingURL=extractValueOrRelationshipID.js.map |