changed redeem response

This commit is contained in:
John Yeo
2025-04-16 11:35:47 +01:00
parent 946947b086
commit c4e8f4e7b1
5 changed files with 13 additions and 19 deletions

View File

@@ -212,8 +212,8 @@ referralRouter.post("/redeem", (req, res) =>
res.status(200).json({
id: redemption.id,
customer_id: customer.id,
triggered: redemption?.applied,
applied: redemption?.applied,
// triggered: redemption?.applied,
// applied: redemption?.applied,
reward_id: reward_program.reward.id,
});
},

View File

@@ -267,7 +267,7 @@ export class CusProductService {
.select(
`*, product:products(*), customer:customers!inner(*)${
withCusEnts
? ", customer_entitlements:customer_entitlements!inner(*, entitlement:entitlements!inner(*, feature:features!inner(*)))"
? ", customer_entitlements:customer_entitlements(*, entitlement:entitlements!inner(*, feature:features!inner(*)))"
: ""
}` as "*"
)

View File

@@ -5,11 +5,11 @@ MOCHA_CMD="npx mocha --parallel --timeout 10000000 --ignore tests/00_setup.ts"
# TEST PARALLEL
if [ "$1" == "basic-parallel" ]; then
MOCHA_PARALLEL=true $MOCHA_SETUP && $MOCHA_CMD \
tests/basic/*.ts \
tests/basic/multi-feature/*.ts \
tests/basic/entities/*.ts \
# tests/basic/referrals/*.ts \
# tests/attach/**/*.ts \
tests/basic/referrals/*.ts \
tests/attach/**/*.ts \
# tests/basic/*.ts \
# tests/basic/multi-feature/*.ts \
# tests/basic/entities/*.ts \
elif [ "$1" == "advanced-parallel" ]; then
MOCHA_PARALLEL=true \

View File

@@ -133,8 +133,8 @@ describe(`${chalk.yellowBright(
redemptions.push(redemption);
assert.equal(redemption.triggered, false);
assert.equal(redemption.applied, false);
// assert.equal(redemption.triggered, false);
// assert.equal(redemption.applied, false);
}
// Try redeem for redeemer1 again

View File

@@ -11,15 +11,9 @@ import {
} from "@autumn/shared";
import { timeout } from "tests/utils/genUtils.js";
import { initCustomerWithTestClock } from "tests/utils/testInitUtils.js";
import { advanceTestClock } from "tests/utils/stripeUtils.js";
import { addDays, addHours, addMonths } from "date-fns";
import { Stripe } from "stripe";
import { initCustomer } from "tests/utils/init.js";
import {
checkFeatureHasCorrectBalance,
compareMainProduct,
compareProductEntitlements,
} from "tests/utils/compare.js";
import { compareProductEntitlements } from "tests/utils/compare.js";
// UNCOMMENT FROM HERE
describe(`${chalk.yellowBright(
@@ -90,8 +84,8 @@ describe(`${chalk.yellowBright(
redemptions.push(redemption);
assert.equal(redemption.triggered, false);
assert.equal(redemption.applied, false);
// assert.equal(redemption.triggered, false);
// assert.equal(redemption.applied, false);
}
// Try redeem for redeemer1 again