- Updated the `addContact` function to allow all users to add contacts, removing the previous restriction that only masters could do so. - Deleted the `become-master` feature and related utility functions, streamlining the codebase. - Adjusted command settings to reflect the removal of the master role functionality. - Refactored components and hooks to eliminate dependencies on the master role, enhancing user experience and simplifying logic.
73 lines
1.4 KiB
GraphQL
73 lines
1.4 KiB
GraphQL
fragment CustomerFields on Customer {
|
|
active
|
|
bannedUntil
|
|
documentId
|
|
name
|
|
phone
|
|
photoUrl
|
|
role
|
|
telegramId
|
|
services(filters: { active: { eq: true } }) {
|
|
documentId
|
|
name
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|