feat: use customer Autocomplete on discount creation

This commit is contained in:
Sérgio Salgado 2021-07-28 02:04:21 +01:00 committed by Josh Harvey
parent 43ff04b2af
commit 847b87ecb0
8 changed files with 94 additions and 189 deletions

View file

@ -8,7 +8,7 @@ const resolvers = {
Mutation: {
createPromoCode: (...[, { code, discount }]) => loyalty.createPromoCode(code, discount),
deletePromoCode: (...[, { codeId }]) => loyalty.deletePromoCode(codeId),
createIndividualDiscount: (...[, { idType, value, discount }]) => loyalty.createIndividualDiscount(idType, value, discount),
createIndividualDiscount: (...[, { customerId, discount }]) => loyalty.createIndividualDiscount(customerId, discount),
deleteIndividualDiscount: (...[, { discountId }]) => loyalty.deleteIndividualDiscount(discountId)
}
}

View file

@ -3,23 +3,10 @@ const { gql } = require('apollo-server-express')
const typeDef = gql`
type IndividualDiscount {
id: ID!
idType: DiscountIdentificationType
value: String!
customerId: ID!
discount: Int
}
input IndividualDiscountInput {
id: ID
idType: DiscountIdentificationType
value: String
discount: Int
}
enum DiscountIdentificationType {
phone
idNumber
}
type PromoCode {
id: ID!
code: String!
@ -34,7 +21,7 @@ const typeDef = gql`
type Mutation {
createPromoCode(code: String!, discount: Int!): PromoCode @auth
deletePromoCode(codeId: ID!): PromoCode @auth
createIndividualDiscount(idType: DiscountIdentificationType!, value: String!, discount: Int!): IndividualDiscount @auth
createIndividualDiscount(customerId: ID!, discount: Int!): IndividualDiscount @auth
deleteIndividualDiscount(discountId: ID!): IndividualDiscount @auth
}
`