|
|
@@ -37,6 +37,23 @@ module.exports = HttpController =
|
|
|
size += (line.length + 1)
|
|
|
return size
|
|
|
|
|
|
+ getProjectDocs: (req, res, next = (error) ->) ->
|
|
|
+ project_id = req.params.project_id
|
|
|
+ # filter is string of existing docs "id:version,id:version,..."
|
|
|
+ filterItems = req.query?.filter?.split(',') or []
|
|
|
+ logger.log project_id: project_id, filter: filterItems, "getting docs via http"
|
|
|
+ timer = new Metrics.Timer("http.getAllDocs")
|
|
|
+ excludeVersions = {}
|
|
|
+ for item in filterItems
|
|
|
+ [id,version] = item?.split(':')
|
|
|
+ excludeVersions[id] = version
|
|
|
+ logger.log {project_id: project_id, excludeVersions: excludeVersions}, "excluding versions"
|
|
|
+ ProjectManager.getProjectDocs project_id, excludeVersions, (error, result) ->
|
|
|
+ timer.done()
|
|
|
+ return next(error) if error?
|
|
|
+ logger.log project_id: project_id, result: result, "got docs via http"
|
|
|
+ res.send result
|
|
|
+
|
|
|
setDoc: (req, res, next = (error) ->) ->
|
|
|
doc_id = req.params.doc_id
|
|
|
project_id = req.params.project_id
|