added /deactivate and /reactivate endpoints as web will call those

also fixed acceptence test
This commit is contained in:
Henry Oswald 2015-08-18 13:31:26 +01:00
parent 599b9770f4
commit 5765b59e0c
3 changed files with 12 additions and 3 deletions

View file

@ -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

View file

@ -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) =>

View file

@ -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