Files
bodyshop/client/src/graphql/templates.queries.js

74 lines
1.5 KiB
JavaScript

import { gql } from "@apollo/client";
export const QUERY_TEMPLATES_BY_NAME = gql`
query QUERY_TEMPLATES_BY_NAME($name: String!) {
templates(where: { name: { _eq: $name } }) {
id
name
query
html
bodyshopid
}
}
`;
export const QUERY_TEMPLATES_BY_NAME_FOR_DUPE = gql`
query QUERY_TEMPLATES_BY_NAME_FOR_DUPE($name: String!) {
templates(where: { name: { _eq: $name } }) {
id
name
query
html
bodyshopid
jsontemplate
}
}
`;
export const QUERY_CUSTOM_TEMPLATES = gql`
query QUERY_CUSTOM_TEMPLATES {
templates(where: { bodyshopid: { _is_null: false } }) {
id
name
}
}
`;
export const QUERY_TEMPLATE_BY_PK = gql`
query QUERY_TEMPLATE_BY_PK($templateId: uuid!) {
templates_by_pk(id: $templateId) {
id
name
query
html
jsontemplate
}
}
`;
export const UPDATE_TEMPLATE = gql`
mutation UPDATE_TEMPLATE($templateId: uuid!, $template: templates_set_input!) {
update_templates(where: { id: { _eq: $templateId } }, _set: $template) {
returning {
id
}
}
}
`;
export const INSERT_TEMPLATE = gql`
mutation INSERT_TEMPLATE($template: templates_insert_input!) {
insert_templates(objects: [$template]) {
returning {
id
}
}
}
`;
export const DELETE_TEMPLATE = gql`
mutation DELETE_TEMPLATE($templateId: uuid!) {
delete_templates(where: { id: { _eq: $templateId } }) {
affected_rows
}
}
`;