Metadata + data transformation for production board. Breaking changes. BOD-71

This commit is contained in:
Patrick Fic
2020-06-16 17:29:56 -07:00
parent 9cce792d72
commit 053e69a624
25 changed files with 1943 additions and 75 deletions

View File

@@ -105,6 +105,7 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
labhrs
larhrs
partcount
kanbanparent
}
}
`;
@@ -856,3 +857,57 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
}
}
`;
export const generate_UPDATE_JOB_KANBAN = (
oldChildId,
oldChildNewParent,
movedId,
movedNewParent,
movedNewStatus,
newChildId,
newChildParent
) => {
console.log("oldChildId", oldChildId, "oldChildNewParent", oldChildNewParent);
console.log("Moved", movedId, movedNewParent, movedNewStatus);
console.log("new", newChildId, newChildParent);
const oldChildQuery = `
updateOldChild: update_jobs(where: { id: { _eq: "${oldChildId}" } },
_set: {kanbanparent: ${
oldChildNewParent ? `"${oldChildNewParent}"` : null
}}) {
returning {
id
kanbanparent
}
}`;
const movedQuery = `
updateMovedChild: update_jobs(where: { id: { _eq: "${movedId}" } },
_set: {kanbanparent: ${
movedNewParent ? `"${movedNewParent}"` : null
} , status: "${movedNewStatus}"}) {
returning {
id
status
kanbanparent
}
}`;
const newChildQuery = `
updateNewChild: update_jobs(where: { id: { _eq: "${newChildId}" } },
_set: {kanbanparent: ${newChildParent ? `"${newChildParent}"` : null}}) {
returning {
id
kanbanparent
}
}`;
return gql`
mutation UPDATE_JOB_KANBAN {
${oldChildId ? oldChildQuery : ""}
${movedId ? movedQuery : ""}
${newChildId ? newChildQuery : ""}
}
`;
};