Skip to content
Snippets Groups Projects
Commit 810ae8a6 authored by Sebastian Mihalache's avatar Sebastian Mihalache
Browse files

feat(component-manuscript-manager): handle submitted on

parent fc319951
No related branches found
No related tags found
1 merge request!8Sprint #10
const config = require('config')
const statuses = config.get('statuses')
const updateStatus = async (collection, newStatus) => {
collection.status = newStatus
collection.visibleStatus = statuses[collection.status].private
await collection.save()
}
module.exports = {
updateStatus,
}
const helpers = require('../../helpers/helpers') const helpers = require('../../helpers/helpers')
const authsomeHelper = require('../../helpers/authsome') const authsomeHelper = require('../../helpers/authsome')
const collectionHelper = require('../../helpers/Collection')
module.exports = models => async (req, res) => { module.exports = models => async (req, res) => {
const { collectionId, fragmentId, recommendationId } = req.params const { collectionId, fragmentId, recommendationId } = req.params
...@@ -32,6 +33,8 @@ module.exports = models => async (req, res) => { ...@@ -32,6 +33,8 @@ module.exports = models => async (req, res) => {
}) })
Object.assign(recommendation, req.body) Object.assign(recommendation, req.body)
recommendation.updatedOn = Date.now() recommendation.updatedOn = Date.now()
if (req.body.submittedOn !== undefined)
await collectionHelper.updateStatus(collection, 'reviewCompleted')
await fragment.save() await fragment.save()
return res.status(200).json(recommendation) return res.status(200).json(recommendation)
} catch (e) { } catch (e) {
......
...@@ -114,5 +114,9 @@ module.exports = { ...@@ -114,5 +114,9 @@ module.exports = {
public: 'Under Review', public: 'Under Review',
private: 'Under Review', private: 'Under Review',
}, },
reviewCompleted: {
public: 'Under Review',
private: 'Review Completed',
},
}, },
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment