浏览代码

added /deactivate and /reactivate endpoints as web will call those
also fixed acceptence test

Henry Oswald 11 年之前
父节点
当前提交
5765b59e0c

+ 5 - 0
services/docstore/app.coffee

@@ -22,6 +22,11 @@ app.get  '/project/:project_id/doc/:doc_id/raw', HttpController.getRawDoc
 app.post '/project/:project_id/doc/:doc_id', bodyParser.json(limit: "2mb"), HttpController.updateDoc
 app.del  '/project/:project_id/doc/:doc_id', HttpController.deleteDoc
 
+
+app.post  '/project/:project_id/deactivate', HttpController.archiveAllDocs
+app.post  '/project/:project_id/reactivate', HttpController.unArchiveAllDocs
+
+# can delete these two soon
 app.post  '/project/:project_id/archive', HttpController.archiveAllDocs
 app.post  '/project/:project_id/unarchive', HttpController.unArchiveAllDocs
 

+ 0 - 1
services/docstore/test/acceptance/coffee/ArchiveDocsTests.coffee

@@ -108,7 +108,6 @@ describe "Archiving all docs", ->
 			@timeout 1000 * 30
 			quarterMegInBytes = 250000
 			lines = require("crypto").randomBytes(quarterMegInBytes).toString("hex")
-			console.log @project_id, @docs[1]._id, "helllllo"
 			@docs[1].lines = [lines,lines,lines,lines]
 			DocstoreClient.updateDoc @project_id, @docs[1]._id, @docs[1].lines, =>
 				DocstoreClient.archiveAllDoc @project_id, (error, @res) =>

+ 7 - 2
services/docstore/test/acceptance/coffee/helpers/DocstoreClient.coffee

@@ -42,10 +42,15 @@ module.exports = DocstoreClient =
 		}, callback	
 		
 	archiveAllDoc: (project_id, callback = (error, res, body) ->) ->
-		request.get {
-			url: "http://localhost:#{settings.internal.docstore.port}/project/#{project_id}/archive"
+		request.post {
+			url: "http://localhost:#{settings.internal.docstore.port}/project/#{project_id}/deactivate"
 		}, callback	
 	
+	unArchiveAllDoc: (project_id, callback = (error, res, body) ->) ->
+		request.post {
+			url: "http://localhost:#{settings.internal.docstore.port}/project/#{project_id}/deactivate"
+		}, callback	
+
 	getS3Doc: (project_id, doc_id, callback = (error, res, body) ->) ->
 		options = DocArchiveManager.buildS3Options(true, project_id+"/"+doc_id)
 		request.get options, callback