- Changed the terminology from "masters" to "invited" and "invitedBy" across the codebase for clarity and consistency. - Updated the `addContact` function to reflect the new naming convention. - Refactored API actions and server methods to support the new invited structure. - Adjusted components and hooks to utilize the updated invited data, 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 GetInvitedBy($phone: String, $telegramId: Long, $documentId: ID) {
|
|
customers(
|
|
filters: {
|
|
or: [
|
|
{ phone: { eq: $phone } }
|
|
{ telegramId: { eq: $telegramId } }
|
|
{ documentId: { eq: $documentId } }
|
|
]
|
|
# and: [{ active: { eq: true } }]
|
|
}
|
|
) {
|
|
documentId
|
|
invitedBy {
|
|
...CustomerFields
|
|
}
|
|
}
|
|
}
|
|
|
|
query GetInvited($phone: String, $telegramId: Long) {
|
|
customers(
|
|
filters: {
|
|
or: [{ phone: { eq: $phone } }, { telegramId: { eq: $telegramId } }]
|
|
# and: [{ active: { eq: true } }]
|
|
}
|
|
) {
|
|
documentId
|
|
invited {
|
|
...CustomerFields
|
|
}
|
|
}
|
|
}
|
|
|
|
mutation UpdateCustomer($documentId: ID!, $data: CustomerInput!) {
|
|
updateCustomer(documentId: $documentId, data: $data) {
|
|
...CustomerFields
|
|
}
|
|
}
|