Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit e8aaa61

Browse files
author
sachin-maheshwari
authored
Merge pull request #6 from topcoder-platform/develop
some validation changes
2 parents f383982 + 61a1461 commit e8aaa61

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/app.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ const dataHandler = (messageSet, topic, partition) => Promise.each(messageSet, a
4444
return
4545
}
4646

47+
// Currently only process payments for challenges with `legacy.pureV5Task: true`
48+
if (!_.get(messageJSON.payload, 'legacy.pureV5Task', false)) {
49+
logger.info(`Challenge Legacy Object ${JSON.stringify(_.get(messageJSON.payload, 'legacy'))} does not have legacy.pureV5Task: true`)
50+
await consumer.commitOffset({ topic, partition, offset: m.offset })
51+
return
52+
}
53+
4754
if (_.toUpper(_.get(messageJSON.payload, 'type')) !== 'TASK' || _.toUpper(_.get(messageJSON.payload, 'status')) !== 'COMPLETED') {
4855
logger.info(`The message type ${_.get(messageJSON.payload, 'type')}, status ${_.get(messageJSON.payload, 'status')} doesn't match {type: 'Task', status: 'Completed'}.`)
4956

src/services/processorService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ processUpdate.schema = {
103103
}).unknown(true))
104104
}).unknown(true)).min(1),
105105
winners: Joi.array().items(Joi.object({
106-
userId: Joi.string().required(),
106+
userId: Joi.number().integer().positive().required(),
107107
handle: Joi.string(),
108108
placement: Joi.number().integer().positive().required()
109109
}).unknown(true)),

0 commit comments

Comments
 (0)