Schema design for modifying a pathway - megabit-labs/pathways GitHub Wiki
There are two operations for Pathways CRUD,
-
createUpdatePathway
: Create new pathway, steps or update them. The query updates all the fields of the path and steps. It also deletes previous relationships between step and content before updating it with a new content relationship. -
deletePathway
: Delete steps or whole pathway. Passingtrue
forwhole
argument deletes all the steps and then the path. Note that withoutwhole: true
, the Pathway is not deleted even if it has no steps.
After Seeding the database you can try out the following queries. Remember to change the PATHWAY_ID
and STEP_ID
.
mutation {
createUpdatePathway(
id: "",
name: "NoMoreHoho",
steps: [{
id: "",
time: 5,
name: "Santa",
index: 0,
isPathway: true,
typeId: "<PATHWAY_ID>",
}],
) {
status,
message
}
}
Query the db to get the id for the newly created pathway and step and then use it in the following query.
mutation {
deletePathway(
id: "<PATHWAY_ID>",
steps: [{
id: "<STEP_ID>",
time: 5,
name: "Santa",
index: 0,
isPathway: true,
typeId: "",
}],
whole: false
) {
status,
message
}
}