Files
bodyshop/client/src/graphql/phonebook.queries.js
2021-04-23 09:11:48 -07:00

93 lines
1.6 KiB
JavaScript

import { gql } from "@apollo/client";
export const QUERY_PHONEBOOK_PAGINATED = gql`
query QUERY_PHONEBOOK_PAGINATED(
$search: String
$offset: Int
$limit: Int
$order: [phonebook_order_by!]
) {
search_phonebook(
offset: $offset
limit: $limit
order_by: $order
args: { search: $search }
) {
id
created_at
firstname
lastname
phone1
phone2
state
zip
fax
email
country
company
city
category
address2
address1
}
search_phonebook_aggregate(args: { search: $search }) {
aggregate {
count(distinct: true)
}
}
}
`;
export const QUERY_PHONEBOOK_BY_ID = gql`
query QUERY_PHONEBOOK_BY_ID($id: uuid!) {
phonebook_by_pk(id: $id) {
id
created_at
firstname
lastname
phone1
phone2
state
zip
fax
email
country
company
city
category
address2
address1
}
}
`;
export const UPDATE_PHONEBOOK = gql`
mutation UPDATE_VENDOR($id: uuid!, $phonebook: phonebook_set_input!) {
update_phonebook(where: { id: { _eq: $id } }, _set: $phonebook) {
returning {
id
}
}
}
`;
export const INSERT_NEW_PHONEBOOK = gql`
mutation INSERT_NEW_PHONEBOOK($phonebook_entry: [phonebook_insert_input!]!) {
insert_phonebook(objects: $phonebook_entry) {
returning {
id
}
}
}
`;
export const DELETE_PHONEBOOK = gql`
mutation DELETE_PHONEBOOK($id: uuid!) {
delete_phonebook(where: { id: { _eq: $id } }) {
returning {
id
}
}
}
`;