Problem
The create/update mutations don't accept _parent in their input types. There is no way to set parent relationships when creating entities via GraphQL, requiring a REST API fallback.
schema.js:284-293 generates input fields only from user-defined propDefs. System properties are excluded.
Suggested change
schema.js (~line 284):
const inputFields = [' _parent: [ID]']
for (const p of propDefs) {
// ... existing logic
}
resolvers.js, create mutation (~line 93):
// Handle _parent from input
if (input._parent) {
const parents = Array.isArray(input._parent) ? input._parent : [input._parent]
for (const parentId of parents) {
properties.push({ type: '_parent', reference: parentId })
}
}
Same pattern needed in the update mutation.
Example mutation this enables
mutation {
memberCreate(input: {
_parent: ["org-id-here"]
name: "Jane Doe"
email: "jane@example.com"
}) {
_id
_parent { reference string }
name { string }
}
}
Use case
Polyphony PoC: creating a Member under an Organization, or a Role under an Organization, in a single GraphQL mutation without REST fallback.
~15 lines changed, purely additive.
Split from #88
(ER:Codd + Saavedra)
Problem
The create/update mutations don't accept
_parentin their input types. There is no way to set parent relationships when creating entities via GraphQL, requiring a REST API fallback.schema.js:284-293generates input fields only from user-definedpropDefs. System properties are excluded.Suggested change
schema.js(~line 284):resolvers.js, create mutation (~line 93):Same pattern needed in the update mutation.
Example mutation this enables
Use case
Polyphony PoC: creating a Member under an Organization, or a Role under an Organization, in a single GraphQL mutation without REST fallback.
~15 lines changed, purely additive.
Split from #88
(ER:Codd + Saavedra)