Skip to content

fix(ps-241): remove unnecessary wrapper from payload #723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2024
Merged
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
27 changes: 8 additions & 19 deletions src/services/ChallengeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -2171,14 +2171,7 @@ updateChallenge.schema = {
.unknown(true)
)
.optional(),
overview: Joi.any().forbidden(),
v5Payout: Joi.object().keys({
userId: Joi.number().integer().positive().required(),
amount: Joi.number().allow(null),
status: Joi.string().allow(null),
datePaid: Joi.string().allow(null),
releaseDate: Joi.string().allow(null),
}),
overview: Joi.any().forbidden()
})
.unknown(true)
.required(),
Expand Down Expand Up @@ -2505,9 +2498,9 @@ async function indexChallengeAndPostToKafka(updatedChallenge, track, type) {
});
}

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

// SQL qurey to fetch the payment and payment_detail record
let sql = `SELECT * FROM informixoltp:payment p
Expand Down Expand Up @@ -2619,16 +2612,12 @@ updateLegacyPayout.schema = {
challengeId: Joi.id(),
data: Joi.object()
.keys({
v5Payout: Joi.object().keys({
userId: Joi.number().integer().positive().required(),
amount: Joi.number().allow(null),
status: Joi.string().allow(null),
datePaid: Joi.string().allow(null),
releaseDate: Joi.string().allow(null),
}),
userId: Joi.number().integer().positive().required(),
amount: Joi.number().allow(null),
status: Joi.string().allow(null),
datePaid: Joi.string().allow(null),
releaseDate: Joi.string().allow(null),
})
.unknown(true)
.required(),
};

/**
Expand Down