File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -330,6 +330,5 @@ enum winnings_category {
330330enum winnings_type {
331331 PAYMENT
332332 REWARD
333- ENGAGEMENT
334333 POINTS
335334}
Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ export class WinningsRepository {
6363 externalIds ?: string [ ] ,
6464 date ?: DateFilterType ,
6565 ) : Prisma . winningsFindManyArgs [ 'where' ] {
66+ const typeFilter = type
67+ ? {
68+ equals : type as winnings_type ,
69+ }
70+ : undefined ;
71+
6672 return {
6773 winner_id : winnerIds
6874 ? {
@@ -79,11 +85,7 @@ export class WinningsRepository {
7985 equals : category as winnings_category ,
8086 }
8187 : undefined ,
82- type : type
83- ? {
84- equals : type as winnings_type ,
85- }
86- : undefined ,
88+ type : typeFilter ,
8789 payment : status
8890 ? {
8991 some : {
Original file line number Diff line number Diff line change @@ -212,9 +212,26 @@ export class WinningsService {
212212 return result ;
213213 }
214214
215+ const isEngagementPayment =
216+ body . category === WinningsCategory . ENGAGEMENT_PAYMENT ;
217+ const resolvedType = isEngagementPayment
218+ ? WinningsType . PAYMENT
219+ : body . type ;
220+
221+ if ( isEngagementPayment && body . type !== WinningsType . PAYMENT ) {
222+ this . logger . warn (
223+ 'Engagement payment type overridden to PAYMENT.' ,
224+ {
225+ winnerId : body . winnerId ,
226+ externalId : body . externalId ,
227+ requestedType : body . type ,
228+ } ,
229+ ) ;
230+ }
231+
215232 const winningModel = {
216233 winner_id : body . winnerId ,
217- type : winnings_type [ body . type ] ,
234+ type : winnings_type [ resolvedType ] ,
218235 origin_id : originId ,
219236 category : winnings_category [ body . category ] ,
220237 title : body . title ,
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ import {
2020
2121export enum WinningsType {
2222 PAYMENT = 'PAYMENT' ,
23- ENGAGEMENT = 'ENGAGEMENT' ,
2423 POINTS = 'POINTS' ,
2524}
2625
You can’t perform that action at this time.
0 commit comments