2025-05-17 12:36:45 +03:00

60 lines
1.2 KiB
GraphQL

fragment CustomerFields on Customer {
active
documentId
name
phone
photoUrl
role
telegramId
}
mutation CreateCustomer($name: String!, $telegramId: Long, $phone: String) {
createCustomer(data: { name: $name, telegramId: $telegramId, phone: $phone, role: client }) {
documentId
}
}
query GetCustomer($phone: String, $telegramId: Long) {
customers(filters: { or: [{ phone: { eq: $phone } }, { telegramId: { eq: $telegramId } }] }) {
...CustomerFields
}
}
query GetMasters($phone: String, $telegramId: Long, $documentId: ID) {
customers(
filters: {
or: [
{ phone: { eq: $phone } }
{ telegramId: { eq: $telegramId } }
{ documentId: { eq: $documentId } }
]
# and: [{ active: { eq: true } }]
}
) {
documentId
masters {
...CustomerFields
}
}
}
query GetClients($phone: String, $telegramId: Long) {
customers(
filters: {
or: [{ phone: { eq: $phone } }, { telegramId: { eq: $telegramId } }]
# and: [{ active: { eq: true } }]
}
) {
documentId
clients {
...CustomerFields
}
}
}
mutation UpdateCustomer($documentId: ID!, $data: CustomerInput!) {
updateCustomer(documentId: $documentId, data: $data) {
...CustomerFields
}
}