chore: rename functions to more appropriate names
This commit is contained in:
parent
e080c3bcbf
commit
cb7b97b0e2
2 changed files with 3 additions and 3 deletions
|
|
@ -37,7 +37,7 @@ function getAvailableIndividualDiscounts () {
|
|||
}), res))
|
||||
}
|
||||
|
||||
function getCustomerIndividualDiscounts (customerId) {
|
||||
function getCustomerActiveIndividualDiscount (customerId) {
|
||||
const sql = `SELECT * FROM individual_discounts WHERE customer_id=$1 AND soft_deleted=false LIMIT 1`
|
||||
return db.oneOrNone(sql, [customerId]).then(res => {
|
||||
if (!_.isNil(res)) {
|
||||
|
|
@ -68,7 +68,7 @@ module.exports = {
|
|||
deletePromoCode,
|
||||
getNumberOfAvailablePromoCodes,
|
||||
getAvailableIndividualDiscounts,
|
||||
getCustomerIndividualDiscounts,
|
||||
getCustomerActiveIndividualDiscount,
|
||||
createIndividualDiscount,
|
||||
deleteIndividualDiscount
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function addOrUpdateCustomer (req) {
|
|||
})
|
||||
})
|
||||
.then(customer => {
|
||||
return loyalty.getCustomerIndividualDiscounts(customer.id)
|
||||
return loyalty.getCustomerActiveIndividualDiscount(customer.id)
|
||||
.then(discount => ({ ...customer, discount }))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue