summaryrefslogtreecommitdiff
path: root/bucky/app/api.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-15 11:24:00 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-15 11:24:00 +0100
commit148bdaec5aaf66b885d7070894b81dfd76df2d5c (patch)
treed60aec3ac20db83fbda10632c92e0e3901fbdb52 /bucky/app/api.js
parent6c601a35b1d79bfe5b53c3c6177420c9d90fbba9 (diff)
delete files
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 */