summaryrefslogtreecommitdiff
path: root/bucky/app/api.js
diff options
context:
space:
mode:
Diffstat (limited to 'bucky/app/api.js')
-rw-r--r--bucky/app/api.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/bucky/app/api.js b/bucky/app/api.js
index 5635ce9..ff17626 100644
--- a/bucky/app/api.js
+++ b/bucky/app/api.js
@@ -121,15 +121,16 @@ function route (app){
bucky.ensureFilesForThread,
bucky.destroyThread,
function(req, res){
- res.sendStatus(200)
+ res.send({ status: 'ok' })
})
/* comments */
-
+
+ // one endpoint handles comments + files
app.post("/api/thread/:id/comment",
middleware.ensureAuthenticated,
bucky.ensureThread,
- // ensure thread privacy
+ bucky.checkThreadPrivacy,
multer.array("files"),
bucky.verifyFilesOrComment,
bucky.createOptionalFiles,
@@ -164,7 +165,16 @@ function route (app){
bucky.checkCommentPrivacy,
bucky.destroyComment,
function(req, res){
- res.sendStatus(200)
+ res.send({ status: 'ok' })
+ })
+ // delete a file
+ app.delete("/api/file/:id",
+ middleware.ensureAuthenticated,
+ bucky.ensureFile,
+ bucky.checkFilePrivacy,
+ bucky.destroyFile,
+ function(req, res){
+ res.send({ status: 'ok' })
})
/* search */