Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 change from { payment_type: 'PAYMENT' | 'REWARD'; total_owed: number }[] to { payment_type: 'PAYMENT'; total_owed: number }[] suggests that the query will no longer return rows with payment_type: 'REWARD'. Ensure that this change aligns with the business logic and that no other parts of the codebase rely on the presence of 'REWARD' entries. If this is intentional, verify that all dependent logic has been updated accordingly.

>`
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
1 change: 0 additions & 1 deletion src/dto/winning.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {

export enum WinningsType {
PAYMENT = 'PAYMENT',
REWARD = 'REWARD',
}

export enum WinningsCategory {
Expand Down