feat: customer matching on individual discounts panel

This commit is contained in:
Sérgio Salgado 2021-07-23 04:02:27 +01:00 committed by Josh Harvey
parent eda6decae0
commit 03fd19e0cf
5 changed files with 101 additions and 8 deletions

View file

@ -1,6 +1,7 @@
const anonymous = require('../../../constants').anonymousCustomer
const customers = require('../../../customers')
const filters = require('../../filters')
const loyalty = require('../../../loyalty')
const resolvers = {
Customer: {
@ -9,7 +10,8 @@ const resolvers = {
Query: {
customers: (...[, { phone, name, address, id }]) => customers.getCustomersList(phone, name, address, id),
customer: (...[, { customerId }]) => customers.getCustomerById(customerId),
customerFilters: () => filters.customer()
customerFilters: () => filters.customer(),
getCustomersWithDiscounts: (...[, { discounts }]) => loyalty.getCustomersWithDiscounts(discounts)
},
Mutation: {
setCustomer: (root, { customerId, customerInput }, context, info) => {

View file

@ -59,6 +59,7 @@ const typeDef = gql`
customers(phone: String, name: String, address: String, id: String): [Customer] @auth
customer(customerId: ID!): Customer @auth
customerFilters: [Filter] @auth
getCustomersWithDiscounts(discounts: [IndividualDiscountInput]): [Customer] @auth
}
type Mutation {

View file

@ -8,6 +8,13 @@ const typeDef = gql`
discount: Int
}
input IndividualDiscountInput {
id: ID
idType: DiscountIdentificationType
value: String
discount: Int
}
enum DiscountIdentificationType {
phone
idNumber