@@ -12,7 +12,11 @@ import { BillingAccountsService } from 'src/shared/topcoder/billing-accounts.ser
1212import { TopcoderM2MService } from 'src/shared/topcoder/topcoder-m2m.service' ;
1313import { ChallengeStatuses } from 'src/dto/challenge.dto' ;
1414import { WinningsService } from '../winnings/winnings.service' ;
15- import { WinningsCategory , WinningsType } from 'src/dto/winning.dto' ;
15+ import {
16+ WinningRequestDto ,
17+ WinningsCategory ,
18+ WinningsType ,
19+ } from 'src/dto/winning.dto' ;
1620import { WinningsRepository } from '../repository/winnings.repo' ;
1721
1822const placeToOrdinal = ( place : number ) => {
@@ -23,7 +27,7 @@ const placeToOrdinal = (place: number) => {
2327 return `${ place } th` ;
2428} ;
2529
26- const { TOPCODER_API_V6_BASE_URL , TGBillingAccounts } = ENV_CONFIG ;
30+ const { TOPCODER_API_V6_BASE_URL : TC_API_BASE , TGBillingAccounts } = ENV_CONFIG ;
2731
2832@Injectable ( )
2933export class ChallengesService {
@@ -37,7 +41,7 @@ export class ChallengesService {
3741 ) { }
3842
3943 async getChallenge ( challengeId : string ) {
40- const requestUrl = `${ TOPCODER_API_V6_BASE_URL } /challenges/${ challengeId } ` ;
44+ const requestUrl = `${ TC_API_BASE } /challenges/${ challengeId } ` ;
4145
4246 try {
4347 const challenge = await this . m2MService . m2mFetch < Challenge > ( requestUrl ) ;
@@ -51,7 +55,7 @@ export class ChallengesService {
5155 }
5256
5357 async getChallengeSubmissionsCount ( challengeId : string ) {
54- const requestUrl = `${ TOPCODER_API_V6_BASE_URL } /submissions?challengeId=${ challengeId } &perPage=9999` ;
58+ const requestUrl = `${ TC_API_BASE } /submissions?challengeId=${ challengeId } &perPage=9999` ;
5559
5660 try {
5761 const submissions =
@@ -71,10 +75,10 @@ export class ChallengesService {
7175 async getChallengeResources ( challengeId : string ) {
7276 try {
7377 const resources = await this . m2MService . m2mFetch < ChallengeResource [ ] > (
74- `${ TOPCODER_API_V6_BASE_URL } /resources?challengeId=${ challengeId } ` ,
78+ `${ TC_API_BASE } /resources?challengeId=${ challengeId } ` ,
7579 ) ;
7680 const resourceRoles = await this . m2MService . m2mFetch < ResourceRole [ ] > (
77- `${ TOPCODER_API_V6_BASE_URL } /resource-roles` ,
81+ `${ TC_API_BASE } /resource-roles` ,
7882 ) ;
7983
8084 const rolesMap = resourceRoles . reduce (
@@ -217,7 +221,7 @@ export class ChallengesService {
217221 billingAccountId : challenge . billing . billingAccountId ,
218222 payroll : includes (
219223 TGBillingAccounts ,
220- + challenge . billing . billingAccountId ,
224+ parseInt ( challenge . billing . billingAccountId ) ,
221225 ) ,
222226 } ,
223227 } ) ) ;
@@ -240,7 +244,9 @@ export class ChallengesService {
240244 }
241245
242246 const existingPayments = (
243- await this . winningsRepo . searchWinnings ( { externalIds : [ challengeId ] } )
247+ await this . winningsRepo . searchWinnings ( {
248+ externalIds : [ challengeId ] ,
249+ } as WinningRequestDto )
244250 ) ?. data ?. winnings ;
245251 if ( existingPayments ?. length > 0 ) {
246252 this . logger . log (
0 commit comments