Skip to content

Commit 7143edf

Browse files
authored
Merge pull request #723 from topcoder-platform/PS-241-payload-fix
fix(ps-241): remove unnecessary wrapper from payload
2 parents 32d0dbc + 763c96f commit 7143edf

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

src/services/ChallengeService.js

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,14 +2171,7 @@ updateChallenge.schema = {
21712171
.unknown(true)
21722172
)
21732173
.optional(),
2174-
overview: Joi.any().forbidden(),
2175-
v5Payout: Joi.object().keys({
2176-
userId: Joi.number().integer().positive().required(),
2177-
amount: Joi.number().allow(null),
2178-
status: Joi.string().allow(null),
2179-
datePaid: Joi.string().allow(null),
2180-
releaseDate: Joi.string().allow(null),
2181-
}),
2174+
overview: Joi.any().forbidden()
21822175
})
21832176
.unknown(true)
21842177
.required(),
@@ -2505,9 +2498,9 @@ async function indexChallengeAndPostToKafka(updatedChallenge, track, type) {
25052498
});
25062499
}
25072500

2508-
async function updateLegacyPayout(currentUser, challengeId, data) {
2501+
async function updateLegacyPayout(currentUser, challengeId, v5Payout) {
2502+
console.log(`Update legacy payment data for challenge: ${challengeId} with data: `, v5Payout);
25092503
const challenge = await challengeDomain.lookup(getLookupCriteria("id", challengeId));
2510-
const { v5Payout } = data;
25112504

25122505
// SQL qurey to fetch the payment and payment_detail record
25132506
let sql = `SELECT * FROM informixoltp:payment p
@@ -2619,16 +2612,12 @@ updateLegacyPayout.schema = {
26192612
challengeId: Joi.id(),
26202613
data: Joi.object()
26212614
.keys({
2622-
v5Payout: Joi.object().keys({
2623-
userId: Joi.number().integer().positive().required(),
2624-
amount: Joi.number().allow(null),
2625-
status: Joi.string().allow(null),
2626-
datePaid: Joi.string().allow(null),
2627-
releaseDate: Joi.string().allow(null),
2628-
}),
2615+
userId: Joi.number().integer().positive().required(),
2616+
amount: Joi.number().allow(null),
2617+
status: Joi.string().allow(null),
2618+
datePaid: Joi.string().allow(null),
2619+
releaseDate: Joi.string().allow(null),
26292620
})
2630-
.unknown(true)
2631-
.required(),
26322621
};
26332622

26342623
/**

0 commit comments

Comments
 (0)