2018-03-23 12:30:48 -04:00
|
|
|
ExportsHandler = require("./ExportsHandler")
|
|
|
|
AuthenticationController = require("../Authentication/AuthenticationController")
|
|
|
|
logger = require("logger-sharelatex")
|
|
|
|
|
|
|
|
module.exports =
|
|
|
|
|
|
|
|
exportProject: (req, res) ->
|
|
|
|
{project_id, brand_variation_id} = req.params
|
|
|
|
user_id = AuthenticationController.getLoggedInUserId(req)
|
2018-06-04 06:05:47 -04:00
|
|
|
export_params = {
|
|
|
|
project_id: project_id,
|
|
|
|
brand_variation_id: brand_variation_id,
|
|
|
|
user_id: user_id
|
|
|
|
}
|
|
|
|
|
|
|
|
if req.body && req.body.firstName && req.body.firstName
|
|
|
|
export_params.first_name = req.body.firstName
|
|
|
|
export_params.last_name = req.body.lastName
|
|
|
|
|
|
|
|
ExportsHandler.exportProject export_params, (err, export_data) ->
|
2018-05-18 10:08:33 -04:00
|
|
|
return next(err) if err?
|
2018-03-23 12:30:48 -04:00
|
|
|
logger.log
|
|
|
|
user_id:user_id
|
|
|
|
project_id: project_id
|
|
|
|
brand_variation_id:brand_variation_id
|
|
|
|
export_v1_id:export_data.v1_id
|
|
|
|
"exported project"
|
|
|
|
res.send export_v1_id: export_data.v1_id
|
|
|
|
|