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

130 lines
2.3 KiB
JavaScript

import { gql } from "@apollo/client";
export const QUERY_VENDOR_BY_ID = gql`
query QUERY_VENDOR_BY_ID($id: uuid!) {
vendors_by_pk(id: $id) {
zip
street2
state
name
id
favorite
email
due_date
discount
country
cost_center
city
street1
active
phone
dmsid
}
}
`;
export const CHECK_VENDOR_NAME = gql`
query CHECK_VENDOR_NAME($name: String!) {
vendors_aggregate(where: { name: { _ilike: $name } }) {
aggregate {
count
}
nodes {
id
}
}
}
`;
export const UPDATE_VENDOR = gql`
mutation UPDATE_VENDOR($id: uuid!, $vendor: vendors_set_input!) {
update_vendors(where: { id: { _eq: $id } }, _set: $vendor) {
returning {
id
}
}
}
`;
export const QUERY_ALL_VENDORS = gql`
query QUERY_ALL_VENDORS {
vendors(order_by: { name: asc }) {
name
id
cost_center
city
phone
active
}
}
`;
export const INSERT_NEW_VENDOR = gql`
mutation INSERT_NEW_VENDOR($vendorInput: [vendors_insert_input!]!) {
insert_vendors(objects: $vendorInput) {
returning {
id
}
}
}
`;
export const DELETE_VENDOR = gql`
mutation DELETE_VENDOR($id: uuid!) {
delete_vendors(where: { id: { _eq: $id } }) {
returning {
id
}
}
}
`;
export const QUERY_ALL_VENDORS_FOR_ORDER = gql`
query QUERY_ALL_VENDORS_FOR_ORDER($jobId: uuid) {
vendors(order_by: { name: asc }, where: { active: { _eq: true } }) {
name
cost_center
id
favorite
discount
email
active
phone
}
jobs(where: { id: { _eq: $jobId } }) {
v_make_desc
}
}
`;
export const SEARCH_VENDOR_AUTOCOMPLETE = gql`
query SEARCH_VENDOR_AUTOCOMPLETE {
vendors(order_by: { name: asc }, where: { active: { _eq: true } }) {
name
discount
id
cost_center
active
favorite
}
}
`;
export const SEARCH_VENDOR_AUTOCOMPLETE_WITH_ADDR = gql`
query SEARCH_VENDOR_AUTOCOMPLETE_WITH_ADDR {
vendors(order_by: { name: asc }, where: { active: { _eq: true } }) {
name
discount
id
cost_center
street1
street2
zip
country
city
email
state
active
}
}
`;