Test-app/app/graphql/noteQueries.js

70 lines
1.4 KiB
JavaScript

export const CREATE_NOTE = `#graphql
mutation CreateNote($ownerId: ID!, $value: String!) {
metafieldsSet(
metafields: [{
ownerId: $ownerId,
namespace: "custom",
key: "note",
type: "single_line_text_field",
value: $value
}]
) {
metafields {
id
key
value
}
}
}
`;
export const UPDATE_NOTE = `#graphql
mutation UpdateNote($ownerId: ID!, $value: String!) {
metafieldsSet(
metafields: [{
ownerId: $ownerId,
namespace: "custom",
key: "note",
type: "single_line_text_field",
value: $value
}]
) {
metafields {
id
value
}
}
}
`;
export const DELETE_NOTE = `#graphql
mutation DeleteNote($id: ID!) {
metafieldsDelete(metafields: [{ id: $id }]) {
deletedMetafields {
id
}
userErrors {
field
message
}
}
}
`;
export const READ_NOTES = `#graphql
query ReadNotes {
products(first: 20) {
edges {
node {
id
title
metafield(namespace: "custom", key: "note") {
id
value
}
}
}
}
}
`;