Skip to content
Merged
11 changes: 1 addition & 10 deletions src/api/wallet/wallet.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ export class WalletService {
),
unit: 'currency',
},
// hide rewards for now
// {
// type: WinningsType.REWARD,
// amount: rewardTotal,
// unit: 'points',
// },
],
},
withdrawalMethod: {
Expand Down Expand Up @@ -118,7 +112,7 @@ export class WalletService {

getWinningsTotalsByWinnerID(winnerId: string) {
return this.prisma.$queryRaw<
{ payment_type: 'PAYMENT' | 'REWARD'; total_owed: number }[]
{ payment_type: 'PAYMENT'; total_owed: number }[]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The removal of 'REWARD' from the payment_type union may impact the correctness of the query results if REWARD payments are still relevant to the business logic. Ensure that this change aligns with the intended functionality and that REWARD payments are handled appropriately elsewhere if needed.

>`
WITH latest_payment_version AS (
SELECT
Expand All @@ -133,7 +127,6 @@ export class WalletService {
w.type AS payment_type,
CASE
WHEN w.type = 'PAYMENT' THEN SUM(p.total_amount)
WHEN w.type = 'REWARD' THEN SUM(r.points)
ELSE 0
END AS total_owed
FROM
Expand All @@ -144,8 +137,6 @@ export class WalletService {
AND p.installment_number = 1
INNER JOIN latest_payment_version lpv ON p.winnings_id = lpv.winnings_id
AND p.version = lpv.max_version
LEFT JOIN reward r ON w.winning_id = r.winnings_id
AND w.type = 'REWARD'
WHERE
w.winner_id = ${winnerId}
GROUP BY
Expand Down
Loading