This commit is contained in:
Alexey 2020-04-29 21:08:48 +03:00
parent 11fcf8e1e0
commit 7766c70137

View File

@ -84,8 +84,6 @@ router.post('/response', upload.single('response'), async (req, res) => {
token = crypto.randomBytes(32).toString('hex') token = crypto.randomBytes(32).toString('hex')
} }
await Contribution.create({ name, company, handle, socialType, token })
console.log('Contribution is correct, uploading to storage') console.log('Contribution is correct, uploading to storage')
if (process.env.DISABLE_S3 !== 'true') { if (process.env.DISABLE_S3 !== 'true') {
await uploadToS3({ filename: req.file.filename, contributionIndex }) await uploadToS3({ filename: req.file.filename, contributionIndex })
@ -98,6 +96,8 @@ router.post('/response', upload.single('response'), async (req, res) => {
`./server/snark_files/response_${contributionIndex}` `./server/snark_files/response_${contributionIndex}`
) )
await Contribution.create({ name, company, handle, socialType, token })
console.log('Contribution finished.') console.log('Contribution finished.')
res.json({ contributionIndex, token }) res.json({ contributionIndex, token })
} catch (e) { } catch (e) {