- Introduced getCustomers action and corresponding server method to fetch customer data with pagination and sorting. - Updated hooks to support infinite querying of customers, improving data handling in components. - Refactored ContactsList and related components to utilize the new customer fetching logic, enhancing user experience. - Adjusted filter labels in dropdowns for better clarity and user understanding.
79 lines
1.6 KiB
GraphQL
79 lines
1.6 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
|
|
}
|
|
}
|
|
|
|
mutation UpdateCustomer($documentId: ID!, $data: CustomerInput!) {
|
|
updateCustomer(documentId: $documentId, data: $data) {
|
|
...CustomerFields
|
|
}
|
|
}
|
|
|
|
query GetCustomers($filters: CustomerFiltersInput, $pagination: PaginationArg, $sort: [String!]) {
|
|
customers(filters: $filters, pagination: $pagination, sort: $sort) {
|
|
...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
|
|
}
|
|
}
|
|
}
|