Skip to content

Commit 67504e6

Browse files
add logging to debug
1 parent 1cff748 commit 67504e6

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/services/ChallengeService.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ async function searchChallenges (currentUser, criteria) {
500500
}
501501
}
502502

503-
// logger.debug(`es Query ${JSON.stringify(esQuery)}`)
503+
logger.debug(`es Query ${JSON.stringify(esQuery)}`)
504504

505505
// Search with constructed query
506506
let docs
@@ -1160,6 +1160,7 @@ async function update (currentUser, challengeId, data, userToken, isFull) {
11601160
// helper.ensureNoDuplicateOrNullElements(data.gitRepoURLs, 'gitRepoURLs')
11611161

11621162
const challenge = await helper.getById('Challenge', challengeId)
1163+
logger.debug(`Dynamo Object before update: ${JSON.stringify(challenge)}`)
11631164
// FIXME: Tech Debt
11641165
let billingAccountId
11651166
if (data.status) {
@@ -1521,7 +1522,9 @@ async function update (currentUser, challengeId, data, userToken, isFull) {
15211522
}
15221523
}
15231524

1524-
// logger.debug(`Challenge.update id: ${challengeId} Details: ${JSON.stringify(updateDetails)}`)
1525+
logger.debug(`Challenge.update id: ${challengeId} Details: ${JSON.stringify(updateDetails)}`)
1526+
logger.debug(`Dynamo Object before writing to dynamo: ${JSON.stringify(challenge)}`)
1527+
logger.debug(`Dynamo update operations: ${JSON.stringify(updateDetails)}`)
15251528
await models.Challenge.update({ id: challengeId }, updateDetails)
15261529

15271530
if (auditLogs.length > 0) {
@@ -1530,14 +1533,6 @@ async function update (currentUser, challengeId, data, userToken, isFull) {
15301533

15311534
delete data.attachmentIds
15321535
delete data.terms
1533-
if (data.phases) {
1534-
_.each(data.phases, p => {
1535-
delete p.name
1536-
if (p.description) {
1537-
delete p.description
1538-
}
1539-
})
1540-
}
15411536
_.assign(challenge, data)
15421537
if (!_.isUndefined(newAttachments)) {
15431538
challenge.attachments = newAttachments
@@ -1575,6 +1570,7 @@ async function update (currentUser, challengeId, data, userToken, isFull) {
15751570
if (billingAccountId) {
15761571
busEventPayload.billingAccountId = billingAccountId
15771572
}
1573+
logger.debug(`ES Object before posting to bus: ${JSON.stringify(busEventPayload)}`)
15781574
await helper.postBusEvent(constants.Topics.ChallengeUpdated, busEventPayload)
15791575

15801576
if (challenge.phases && challenge.phases.length > 0) {
@@ -1819,7 +1815,7 @@ partiallyUpdateChallenge.schema = {
18191815
type: Joi.string().required(),
18201816
value: Joi.number().min(0).required()
18211817
})).min(1).required()
1822-
}).unknown(true)),
1818+
}).unknown(true)).min(1),
18231819
tags: Joi.array().items(Joi.string().required()).min(1), // tag names
18241820
projectId: Joi.number().integer().positive(),
18251821
legacyId: Joi.number().integer().positive(),

0 commit comments

Comments
 (0)