|
@@ -6,15 +6,20 @@ module.exports =
|
|
|
getDocument: (req, res, next = (error) ->) ->
|
|
getDocument: (req, res, next = (error) ->) ->
|
|
|
project_id = req.params.Project_id
|
|
project_id = req.params.Project_id
|
|
|
doc_id = req.params.doc_id
|
|
doc_id = req.params.doc_id
|
|
|
|
|
+ plain = req?.query?.plain == 'true'
|
|
|
logger.log doc_id:doc_id, project_id:project_id, "receiving get document request from api (docupdater)"
|
|
logger.log doc_id:doc_id, project_id:project_id, "receiving get document request from api (docupdater)"
|
|
|
ProjectEntityHandler.getDoc project_id, doc_id, (error, lines, rev) ->
|
|
ProjectEntityHandler.getDoc project_id, doc_id, (error, lines, rev) ->
|
|
|
if error?
|
|
if error?
|
|
|
logger.err err:error, doc_id:doc_id, project_id:project_id, "error finding element for getDocument"
|
|
logger.err err:error, doc_id:doc_id, project_id:project_id, "error finding element for getDocument"
|
|
|
return next(error)
|
|
return next(error)
|
|
|
- res.type "json"
|
|
|
|
|
- res.send JSON.stringify {
|
|
|
|
|
- lines: lines
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if plain
|
|
|
|
|
+ res.type "text/plain"
|
|
|
|
|
+ res.send lines.join('\n')
|
|
|
|
|
+ else
|
|
|
|
|
+ res.type "json"
|
|
|
|
|
+ res.send JSON.stringify {
|
|
|
|
|
+ lines: lines
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
setDocument: (req, res, next = (error) ->) ->
|
|
setDocument: (req, res, next = (error) ->) ->
|
|
|
project_id = req.params.Project_id
|
|
project_id = req.params.Project_id
|