Files
bodyshop/client/src/graphql/user.queries.js
2021-02-24 08:48:55 -08:00

72 lines
1.4 KiB
JavaScript

import { gql } from "@apollo/client";
export const QUERY_SHOP_ASSOCIATIONS = gql`
query QUERY_SHOP_ASSOCIATIONS {
associations {
id
authlevel
shopid
user {
email
}
}
}
`;
export const UPDATE_ASSOCIATION = gql`
mutation UPDATE_ASSOCIATION(
$assocId: uuid!
$assoc: associations_set_input!
) {
update_associations(where: { id: { _eq: $assocId } }, _set: $assoc) {
returning {
id
authlevel
shopid
user {
email
}
}
}
}
`;
export const UPSERT_USER = gql`
mutation UPSERT_USER($authEmail: String!, $authToken: String!) {
insert_users(
objects: [{ email: $authEmail, authid: $authToken }]
on_conflict: { constraint: users_pkey, update_columns: [authid] }
) {
returning {
authid
}
}
}
`;
export const UPDATE_DASHBOARD_LAYOUT = gql`
mutation UPDATE_DASHBOARD_LAYOUT($email: String!, $layout: jsonb!) {
update_users_by_pk(
pk_columns: { email: $email }
_set: { dashboardlayout: $layout }
) {
email
dashboardlayout
}
}
`;
export const UPDATE_FCM_TOKEN = gql`
mutation UPDATE_FCM_TOKEN($authEmail: String!, $token: jsonb!) {
update_users(
where: { email: { _eq: $authEmail } }
_append: { fcmtokens: $token }
) {
affected_rows
returning {
fcmtokens
}
}
}
`;