From cb7b97b0e2788815b1c3fa2e5dd228f807941a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Fri, 18 Feb 2022 18:34:51 +0000 Subject: [PATCH] chore: rename functions to more appropriate names --- lib/loyalty.js | 4 ++-- lib/routes/phoneCodeRoutes.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/loyalty.js b/lib/loyalty.js index d4f9480d..9ac9e0b6 100644 --- a/lib/loyalty.js +++ b/lib/loyalty.js @@ -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 } diff --git a/lib/routes/phoneCodeRoutes.js b/lib/routes/phoneCodeRoutes.js index 4a4905bc..25fa3795 100644 --- a/lib/routes/phoneCodeRoutes.js +++ b/lib/routes/phoneCodeRoutes.js @@ -48,7 +48,7 @@ function addOrUpdateCustomer (req) { }) }) .then(customer => { - return loyalty.getCustomerIndividualDiscounts(customer.id) + return loyalty.getCustomerActiveIndividualDiscount(customer.id) .then(discount => ({ ...customer, discount })) }) }