feature/IO-3182-Phone-Number-Consent - Checkpoint
This commit is contained in:
@@ -142,6 +142,7 @@ export const QUERY_BODYSHOP = gql`
|
||||
intellipay_config
|
||||
md_ro_guard
|
||||
notification_followers
|
||||
enforce_sms_consent
|
||||
employee_teams(order_by: { name: asc }, where: { active: { _eq: true } }) {
|
||||
id
|
||||
name
|
||||
@@ -363,3 +364,12 @@ export const GET_ACTIVE_EMPLOYEES_IN_SHOP = gql`
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_BODYSHOP_ENFORCE_CONSENT = gql`
|
||||
mutation UPDATE_BODYSHOP_ENFORCE_CONSENT($id: uuid!, $enforce_sms_consent: Boolean!) {
|
||||
update_bodyshops_by_pk(pk_columns: { id: $id }, _set: { enforce_sms_consent: $enforce_sms_consent }) {
|
||||
id
|
||||
enforce_sms_consent
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
90
client/src/graphql/consent.queries.js
Normal file
90
client/src/graphql/consent.queries.js
Normal file
@@ -0,0 +1,90 @@
|
||||
import { gql } from "@apollo/client";
|
||||
|
||||
export const GET_PHONE_NUMBER_CONSENT = gql`
|
||||
query GET_PHONE_NUMBER_CONSENT($bodyshopid: uuid!, $phone_number: String!) {
|
||||
phone_number_consent(where: { bodyshopid: { _eq: $bodyshopid }, phone_number: { _eq: $phone_number } }) {
|
||||
id
|
||||
bodyshopid
|
||||
phone_number
|
||||
consent_status
|
||||
created_at
|
||||
updated_at
|
||||
consent_updated_at
|
||||
history(order_by: { changed_at: desc }, limit: 1) {
|
||||
reason
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_PHONE_NUMBER_CONSENTS = gql`
|
||||
query GET_PHONE_NUMBER_CONSENTS($bodyshopid: uuid!, $phone_numbers: [String!]) {
|
||||
phone_number_consent(
|
||||
where: { bodyshopid: { _eq: $bodyshopid }, phone_number: { _in: $phone_numbers } }
|
||||
order_by: { consent_updated_at: desc }
|
||||
) {
|
||||
id
|
||||
bodyshopid
|
||||
phone_number
|
||||
consent_status
|
||||
created_at
|
||||
updated_at
|
||||
consent_updated_at
|
||||
history(order_by: { changed_at: desc }, limit: 1) {
|
||||
reason
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SET_PHONE_NUMBER_CONSENT = gql`
|
||||
mutation SET_PHONE_NUMBER_CONSENT(
|
||||
$bodyshopid: uuid!
|
||||
$phone_number: String!
|
||||
$consent_status: Boolean!
|
||||
$reason: String!
|
||||
$changed_by: String!
|
||||
) {
|
||||
insert_phone_number_consent_one(
|
||||
object: {
|
||||
bodyshopid: $bodyshopid
|
||||
phone_number: $phone_number
|
||||
consent_status: $consent_status
|
||||
consent_updated_at: "now()"
|
||||
}
|
||||
on_conflict: {
|
||||
constraint: phone_number_consent_bodyshopid_phone_number_key
|
||||
update_columns: [consent_status, consent_updated_at]
|
||||
}
|
||||
) {
|
||||
id
|
||||
bodyshopid
|
||||
phone_number
|
||||
consent_status
|
||||
created_at
|
||||
updated_at
|
||||
consent_updated_at
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const BULK_SET_PHONE_NUMBER_CONSENT = gql`
|
||||
mutation BULK_SET_PHONE_NUMBER_CONSENT($objects: [phone_number_consent_insert_input!]!) {
|
||||
insert_phone_number_consent(
|
||||
objects: $objects
|
||||
on_conflict: {
|
||||
constraint: phone_number_consent_bodyshopid_phone_number_key
|
||||
update_columns: [consent_status, consent_updated_at]
|
||||
}
|
||||
) {
|
||||
affected_rows
|
||||
returning {
|
||||
id
|
||||
bodyshopid
|
||||
phone_number
|
||||
consent_status
|
||||
consent_updated_at
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
Reference in New Issue
Block a user