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

Commit 27fe7b5

Browse files
secure /sync endpoint
1 parent e220aa9 commit 27fe7b5

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/controllers/apiController.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,18 @@ async function queueSync (req, res) {
9494
// Target a single challenge based on the provided legacyId if provided
9595
await syncController.queueChallenges({ legacyId: req.query.legacyId, force })
9696
} else {
97-
const startDate = req.query.startDate
98-
const endDate = req.query.endDate ? moment(req.query.endDate).utc() : moment().utc()
99-
100-
if (startDate !== null && (!moment(startDate) || !moment(startDate).isValid())) {
101-
return res.status(400).json({ message: `Invalid startDate: ${startDate}` })
102-
}
103-
if (endDate !== null && (!moment(endDate) || !moment(endDate).isValid())) {
104-
return res.status(400).json({ message: `Invalid endDate: ${endDate}` })
105-
}
106-
await syncController.queueChallenges({ startDate, endDate, force })
97+
return res.status(400).json({ message: `Missing property 'legacyId'` })
98+
99+
// const startDate = req.query.startDate
100+
// const endDate = req.query.endDate ? moment(req.query.endDate).utc() : moment().utc()
101+
102+
// if (startDate !== null && (!moment(startDate) || !moment(startDate).isValid())) {
103+
// return res.status(400).json({ message: `Invalid startDate: ${startDate}` })
104+
// }
105+
// if (endDate !== null && (!moment(endDate) || !moment(endDate).isValid())) {
106+
// return res.status(400).json({ message: `Invalid endDate: ${endDate}` })
107+
// }
108+
// await syncController.queueChallenges({ startDate, endDate, force })
107109
}
108110

109111
return res.json({ success: true })

0 commit comments

Comments
 (0)