68 lines
1.3 KiB
GraphQL
68 lines
1.3 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, $documentId: ID) {
|
|
customers(
|
|
filters: {
|
|
or: [
|
|
{ phone: { eq: $phone } }
|
|
{ telegramId: { eq: $telegramId } }
|
|
{ documentId: { eq: $documentId } }
|
|
]
|
|
}
|
|
) {
|
|
...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
|
|
}
|
|
}
|