feat: add shared GraphQL note queries module
This commit is contained in:
parent
67134d4a7c
commit
8b2189a6ca
69
app/graphql/noteQueries.js
Normal file
69
app/graphql/noteQueries.js
Normal file
@ -0,0 +1,69 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
Loading…
x
Reference in New Issue
Block a user