summaryrefslogtreecommitdiff
path: root/bucky/app/bucky.js
diff options
context:
space:
mode:
Diffstat (limited to 'bucky/app/bucky.js')
-rw-r--r--bucky/app/bucky.js31
1 files changed, 24 insertions, 7 deletions
diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js
index dbb980d..cd70790 100644
--- a/bucky/app/bucky.js
+++ b/bucky/app/bucky.js
@@ -94,9 +94,9 @@ var bucky = module.exports = {
next()
})
},
-
+
/* DETAILS */
-
+
ensureThread: function (req, res, next){
var id = req.params.id.replace(/\D/g, "")
if (! id) {
@@ -253,7 +253,7 @@ var bucky = module.exports = {
res.sendStatus(500)
})
},
-
+
/* KEYWORDS */
ensureKeyword: function (req, res, next){
@@ -296,7 +296,24 @@ var bucky = module.exports = {
next()
})
},
-
+ createKeyword: function (req, res, next){
+ if (! req.body.keyword || ! req.body.keyword.length) {
+ res.json({ error: "no keyword" })
+ return
+ }
+ var data = {
+ keyword: req.body.keyword,
+ owner: req.user.get('username'),
+ createdate: util.now(),
+ public: 1,
+ color: req.body.color || 'blue',
+ }
+ db.createKeyword(data).then(function(keyword){
+ res.keyword = keyword
+ next()
+ })
+ },
+
/* POSTING */
verifyFilesOrComment: function (req, res, next){
@@ -308,9 +325,9 @@ var bucky = module.exports = {
}
next()
},
-
+
/* COMMENTS */
-
+
ensureComment: function (req, res, next){
var id = req.params.id.replace(/\D/g, "")
if (! id) {
@@ -442,7 +459,7 @@ var bucky = module.exports = {
/* PROFILE / USER */
-
+
ensureUser: function (req, res, next){
var username = util.sanitizeName(req.params.username)
if (! username) {