From 6a40dead5a16fb66c30ac34747d34326faf41a36 Mon Sep 17 00:00:00 2001 From: Alexandru Munteanu <alexandru.munt@gmail.com> Date: Tue, 31 Jul 2018 17:27:36 +0300 Subject: [PATCH] feat(technical-checks): create token on submit --- packages/component-manuscript-manager/index.js | 1 + .../src/routes/fragments/post.js | 6 ++++-- .../src/routes/technicalChecks/patch.js | 2 ++ packages/xpub-faraday/config/validations.js | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/component-manuscript-manager/index.js b/packages/component-manuscript-manager/index.js index 63ee7dbde..d309d1a8e 100644 --- a/packages/component-manuscript-manager/index.js +++ b/packages/component-manuscript-manager/index.js @@ -2,5 +2,6 @@ module.exports = { backend: () => app => { require('./src/FragmentsRecommendations')(app) require('./src/Fragments')(app) + require('./src/TechnicalChecks')(app) }, } diff --git a/packages/component-manuscript-manager/src/routes/fragments/post.js b/packages/component-manuscript-manager/src/routes/fragments/post.js index 97ad23899..43c095365 100644 --- a/packages/component-manuscript-manager/src/routes/fragments/post.js +++ b/packages/component-manuscript-manager/src/routes/fragments/post.js @@ -1,5 +1,6 @@ +const { v4 } = require('uuid') const config = require('config') -const { get } = require('lodash') +const { get, set } = require('lodash') const { Email, Fragment, @@ -54,7 +55,8 @@ module.exports = models => async (req, res) => { }) email.setupManuscriptSubmittedEmail() - collection.status = 'submitted' + collection.status = 'technicalChecks' + set(collection, 'technicalChecks.token', v4()) collection.save() const { journal, xmlParser, ftp } = mtsConfig diff --git a/packages/component-manuscript-manager/src/routes/technicalChecks/patch.js b/packages/component-manuscript-manager/src/routes/technicalChecks/patch.js index e569f8a7a..f415d8e1e 100644 --- a/packages/component-manuscript-manager/src/routes/technicalChecks/patch.js +++ b/packages/component-manuscript-manager/src/routes/technicalChecks/patch.js @@ -38,6 +38,8 @@ module.exports = ({ Collection }) => async (req, res) => { collection.status = setNewStatus(step, agree) await collection.save() + // TODO: send email to EiC here + return res.status(200).json(collection) } catch (e) { const notFoundError = await services.handleNotFoundError(e, 'Item') diff --git a/packages/xpub-faraday/config/validations.js b/packages/xpub-faraday/config/validations.js index b376584a5..9a7f4c108 100644 --- a/packages/xpub-faraday/config/validations.js +++ b/packages/xpub-faraday/config/validations.js @@ -11,6 +11,9 @@ module.exports = { customId: Joi.string(), invitations: Joi.array(), handlingEditor: Joi.object(), + technicalChecks: Joi.object({ + token: Joi.string(), + }), }, fragment: [ { -- GitLab