feat: add loyalty panel screen and structure

feat: add coupons table

feat: add coupons to schema

fix: coupon schema

feat: coupon table

feat: add coupon top button

feat: add first coupon button

feat: delete coupon

feat: coupon modal

fix: clear discount on modal close

fix: modal input formatting

feat: add new coupons

fix: button positioning

fix: remove loyalty panel sidebar

fix: coupon screen matching specs

fix: coupon modal

feat: send coupon data to machine on poll

fix: available coupons bool

feat: coupon endpoint

feat: transaction discount migration

feat: post-discount rates

refactor: bills

feat: version string

fix: bill saving on db

feat: coupon soft-delete

fix: coupon soft delete

fix: bill receiving

feat: remove cryptoAtoms update during tx

fix: tx trading

fix: bills

feat: start trades rework

fix: remove code

fix: code review
This commit is contained in:
Sérgio Salgado 2020-10-28 11:15:20 +00:00 committed by Josh Harvey
parent 64315cfd80
commit 7fe8799edc
18 changed files with 622 additions and 13 deletions

View file

@ -13,6 +13,7 @@ const settingsLoader = require('../../new-settings-loader')
// const tokenManager = require('../../token-manager')
const blacklist = require('../../blacklist')
const machineEventsByIdBatch = require("../../postgresql_interface").machineEventsByIdBatch
const couponManager = require('../../coupon-manager')
const serverVersion = require('../../../package.json').version
@ -174,6 +175,13 @@ const typeDefs = gql`
ip_address: String
}
type Coupon {
id: ID!
code: String!
discount: Int!
soft_deleted: Boolean
}
type Transaction {
id: ID!
txClass: String!
@ -255,6 +263,13 @@ const typeDefs = gql`
config: JSONObject
blacklist: [Blacklist]
# userTokens: [UserToken]
coupons: [Coupon]
}
type SupportLogsResponse {
id: ID!
timestamp: Date!
deviceId: ID
}
enum MachineAction {
@ -279,6 +294,8 @@ const typeDefs = gql`
# revokeToken(token: String!): UserToken
deleteBlacklistRow(cryptoCode: String!, address: String!): Blacklist
insertBlacklistRow(cryptoCode: String!, address: String!): Blacklist
createCoupon(code: String!, discount: Int!): Coupon
softDeleteCoupon(couponId: ID!): Coupon
}
`
@ -329,6 +346,7 @@ const resolvers = {
accounts: () => settingsLoader.loadAccounts(),
blacklist: () => blacklist.getBlacklist(),
// userTokens: () => tokenManager.getTokenList()
coupons: () => couponManager.getAvailableCoupons()
},
Mutation: {
machineAction: (...[, { deviceId, action, cassette1, cassette2, newName }]) => machineAction({ deviceId, action, cassette1, cassette2, newName }),
@ -351,6 +369,8 @@ const resolvers = {
insertBlacklistRow: (...[, { cryptoCode, address }]) =>
blacklist.insertIntoBlacklist(cryptoCode, address),
// revokeToken: (...[, { token }]) => tokenManager.revokeToken(token)
createCoupon: (...[, { code, discount }]) => couponManager.createCoupon(code, discount),
softDeleteCoupon: (...[, { couponId }]) => couponManager.softDeleteCoupon(couponId)
}
}