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

This commit is contained in:
Dave Richer
2025-05-20 18:19:39 -04:00
parent 83860152a9
commit 7bd5190bf2
17 changed files with 772 additions and 320 deletions

View File

@@ -10,18 +10,23 @@ export const GET_PHONE_NUMBER_CONSENT = gql`
created_at
updated_at
consent_updated_at
history(order_by: { changed_at: desc }, limit: 1) {
phone_number_consent_history(order_by: { changed_at: desc }, limit: 1) {
id
reason
changed_at
old_value
new_value
changed_by
}
}
}
`;
export const GET_PHONE_NUMBER_CONSENTS = gql`
query GET_PHONE_NUMBER_CONSENTS($bodyshopid: uuid!, $phone_numbers: [String!]) {
query GET_PHONE_NUMBER_CONSENTS($bodyshopid: uuid!, $search: String) {
phone_number_consent(
where: { bodyshopid: { _eq: $bodyshopid }, phone_number: { _in: $phone_numbers } }
order_by: { consent_updated_at: desc }
where: { bodyshopid: { _eq: $bodyshopid }, phone_number: { _ilike: $search } }
order_by: [{ phone_number: asc }, { consent_updated_at: desc }]
) {
id
bodyshopid
@@ -30,60 +35,13 @@ export const GET_PHONE_NUMBER_CONSENTS = gql`
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 {
phone_number_consent_history(order_by: { changed_at: desc }, limit: 1) {
id
bodyshopid
phone_number
consent_status
consent_updated_at
reason
changed_at
old_value
new_value
changed_by
}
}
}