feat: individual discounts creation form

feat: individual discounts deletion
fix: discounts mapping from db
This commit is contained in:
Sérgio Salgado 2021-07-22 17:19:45 +01:00 committed by Josh Harvey
parent 07f15db851
commit 768b5a30e1
8 changed files with 435 additions and 19 deletions

View file

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

View file

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