feature/IO-3182-Phone-Number-Consent - Checkpoint

This commit is contained in:
Dave Richer
2025-05-21 14:32:35 -04:00
parent 7bd5190bf2
commit 8ee52598e8
31 changed files with 128 additions and 991 deletions

View File

@@ -2805,7 +2805,6 @@ exports.GET_BODYSHOP_BY_ID = `
intellipay_config
state
notification_followers
enforce_sms_consent
}
}
`;
@@ -2969,132 +2968,3 @@ exports.GET_JOB_WATCHERS_MINIMAL = `
}
}
`;
// Query to get consent status for a single phone number
exports.GET_PHONE_NUMBER_CONSENT = `
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
phone_number_consent_history(order_by: { changed_at: desc }) {
id
old_value
new_value
reason
changed_at
changed_by
}
}
}
`;
// Query to get consent statuses for multiple phone numbers
exports.GET_PHONE_NUMBER_CONSENTS = `
query GET_PHONE_NUMBER_CONSENTS($bodyshopid: uuid!, $phone_numbers: [String!]) {
phone_number_consent(where: { bodyshopid: { _eq: $bodyshopid }, phone_number: { _in: $phone_numbers } }) {
id
bodyshopid
phone_number
consent_status
created_at
updated_at
consent_updated_at
phone_number_consent_history(order_by: { changed_at: desc }) {
id
old_value
new_value
reason
changed_at
changed_by
}
}
}
`;
// Mutation to update enforce_sms_consent
exports.UPDATE_BODYSHOP_ENFORCE_CONSENT = `
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
}
}
`;
// Mutation to set consent status for a single phone number
exports.SET_PHONE_NUMBER_CONSENT = `
mutation SET_PHONE_NUMBER_CONSENT($bodyshopid: uuid!, $phone_number: String!, $consent_status: Boolean!) {
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
}
}
`;
// Mutation to set consent status for multiple phone numbers
exports.BULK_SET_PHONE_NUMBER_CONSENT = `
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
created_at
updated_at
consent_updated_at
}
}
}
`;
// Mutation to insert multiple consent history records
exports.INSERT_PHONE_NUMBER_CONSENT_HISTORY = `
mutation INSERT_PHONE_NUMBER_CONSENT_HISTORY($objects: [phone_number_consent_history_insert_input!]!) {
insert_phone_number_consent_history(
objects: $objects
) {
affected_rows
returning {
id
phone_number_consent_id
old_value
new_value
reason
changed_at
changed_by
}
}
}
`;