feat: add search functionality to customer page
This commit is contained in:
parent
b99f98982b
commit
2b93f016ac
7 changed files with 151 additions and 24 deletions
|
|
@ -1,13 +1,15 @@
|
|||
const anonymous = require('../../../constants').anonymousCustomer
|
||||
const customers = require('../../../customers')
|
||||
const filters = require('../../filters')
|
||||
|
||||
const resolvers = {
|
||||
Customer: {
|
||||
isAnonymous: parent => (parent.customerId === anonymous.uuid)
|
||||
},
|
||||
Query: {
|
||||
customers: () => customers.getCustomersList(),
|
||||
customer: (...[, { customerId }]) => customers.getCustomerById(customerId)
|
||||
customers: (...[, { phone, name, address, id }]) => customers.getCustomersList(phone, name, address, id),
|
||||
customer: (...[, { customerId }]) => customers.getCustomerById(customerId),
|
||||
customerFilters: () => filters.customer()
|
||||
},
|
||||
Mutation: {
|
||||
setCustomer: (root, { customerId, customerInput }, context, info) => {
|
||||
|
|
|
|||
|
|
@ -56,8 +56,9 @@ const typeDef = gql`
|
|||
}
|
||||
|
||||
type Query {
|
||||
customers: [Customer] @auth
|
||||
customers(phone: String, name: String, address: String, id: String): [Customer] @auth
|
||||
customer(customerId: ID!): Customer @auth
|
||||
customerFilters: [Filter] @auth
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue