feature/IO-3182-Phone-Number-Consent - Checkpoint
This commit is contained in:
@@ -2970,7 +2970,7 @@ exports.GET_JOB_WATCHERS_MINIMAL = `
|
||||
}
|
||||
`;
|
||||
|
||||
// Query to get consent status for a phone number
|
||||
// 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 } }) {
|
||||
@@ -2981,7 +2981,7 @@ exports.GET_PHONE_NUMBER_CONSENT = `
|
||||
created_at
|
||||
updated_at
|
||||
consent_updated_at
|
||||
history(order_by: { changed_at: desc }) {
|
||||
phone_number_consent_history(order_by: { changed_at: desc }) {
|
||||
id
|
||||
old_value
|
||||
new_value
|
||||
@@ -2993,24 +2993,45 @@ exports.GET_PHONE_NUMBER_CONSENT = `
|
||||
}
|
||||
`;
|
||||
|
||||
// Query to get consent history
|
||||
exports.GET_PHONE_NUMBER_CONSENT_HISTORY = `
|
||||
query GET_PHONE_NUMBER_CONSENT_HISTORY($phone_number_consent_id: uuid!) {
|
||||
phone_number_consent_history(where: { phone_number_consent_id: { _eq: $phone_number_consent_id } }, order_by: { changed_at: desc }) {
|
||||
// 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
|
||||
phone_number_consent_id
|
||||
old_value
|
||||
new_value
|
||||
reason
|
||||
changed_at
|
||||
changed_by
|
||||
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 set consent status
|
||||
// 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!, $reason: String!) {
|
||||
mutation SET_PHONE_NUMBER_CONSENT($bodyshopid: uuid!, $phone_number: String!, $consent_status: Boolean!) {
|
||||
insert_phone_number_consent_one(
|
||||
object: {
|
||||
bodyshopid: $bodyshopid
|
||||
@@ -3031,24 +3052,10 @@ exports.SET_PHONE_NUMBER_CONSENT = `
|
||||
updated_at
|
||||
consent_updated_at
|
||||
}
|
||||
insert_phone_number_consent_history_one(
|
||||
object: {
|
||||
phone_number_consent_id: $id
|
||||
old_value: $old_value
|
||||
new_value: $consent_status
|
||||
reason: $reason
|
||||
changed_by: $changed_by
|
||||
}
|
||||
) {
|
||||
id
|
||||
reason
|
||||
changed_at
|
||||
changed_by
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
// Mutation for bulk consent updates
|
||||
// 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(
|
||||
@@ -3064,8 +3071,30 @@ exports.BULK_SET_PHONE_NUMBER_CONSENT = `
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user