@@ -26,3 +26,3 @@ var express = require('express'); | ||
| router.post("/messages/send", isLogin); | ||
| router.post("/replys/send", isLogin); | ||
| router.post("/replys/create", isLogin); | ||
@@ -29,0 +29,0 @@ router.post("/topics/create", isLogin); |
| var express = require('express'); | ||
| var router = express.Router(); | ||
| router.use("/",require("accessControl")); | ||
| router.use("/",require("./accessControl")); | ||
| router.use("/columns",require("./columnCtrl")); | ||
@@ -9,9 +9,4 @@ router.use("/topics",require("./topicCtrl")); | ||
| router.use("/users",require("./userCtrl")); | ||
| router.use("/infos",require("./infoCtrl")); | ||
| router.use("/replys",require("./replyCtrl")); | ||
| router.use(function(err,req,res,next){ | ||
| res.send("error"); | ||
| }) | ||
| module.exports = router; |
@@ -5,5 +5,18 @@ var express = require('express'); | ||
| router.post("/create",function(req,res){ | ||
| domain.repos.Reply.create(req.body,function(err,reply){ | ||
| res.send({error:err,replyId:reply._id}); | ||
| router.post("/create", function (req, res, next) { | ||
| domain.repos.Reply.create(req.body, function (err, reply) { | ||
| if (!reply) { | ||
| next(err); | ||
| } else { | ||
| res.send({reply: { | ||
| id: reply._id, | ||
| title: reply._title, | ||
| body: reply._body, | ||
| authorId: reply._authorId, | ||
| parentId: reply._parentId, | ||
| topicId: reply._topicId, | ||
| createTime: reply._createTime | ||
| }}); | ||
| } | ||
| }); | ||
@@ -10,0 +23,0 @@ }) |
@@ -5,5 +5,9 @@ var express = require('express'); | ||
| router.post("/create", function (req, res) { | ||
| router.post("/create", function (req, res,next) { | ||
| domain.repos.Topic.create(req.body, function (err, topic) { | ||
| res.send({error: err, topicId: topic._id}); | ||
| if(err){ | ||
| next(err); | ||
| }else{ | ||
| res.send({topicId: topic._id}); | ||
| } | ||
| }); | ||
@@ -42,3 +46,3 @@ }) | ||
| router.post("/:id/updateInfo", function (req, res) { | ||
| router.post("/:id/updateInfo", function (req, res,next) { | ||
| domain.call("Topic.updateInfo", req.params.id, [req.body.title, req.body.body, req.body.columnId]) | ||
@@ -49,3 +53,3 @@ .then(function () { | ||
| .fail(function (err) { | ||
| res.send({error: err}); | ||
| next(err); | ||
| }) | ||
@@ -52,0 +56,0 @@ }) |
@@ -51,2 +51,3 @@ var express = require('express'); | ||
| router.post("/:id/updateInfo", function (req, res) { | ||
| console.log(req.params.id,req.body); | ||
| domain.call("User.updateInfo", req.params.id, [req.body]) | ||
@@ -53,0 +54,0 @@ .then(function () { |
@@ -28,2 +28,5 @@ module.exports = wrap; | ||
| if (topic) { | ||
| topic.addReply(reply.parentId,reply.id); | ||
| var infoRepo = my.repos.Info; | ||
@@ -30,0 +33,0 @@ infoRepo.create({ |
+2
-1
@@ -25,3 +25,3 @@ var shortid = require("shortid"); | ||
| watchers: aggre.watchers, | ||
| fraction: aggre.fraction, | ||
| fraction: aggre._fraction, | ||
| isCustomLogo: aggre.isCustomLogo, | ||
@@ -125,2 +125,3 @@ des: aggre.des, | ||
| } else { | ||
| callback({error: 500}); // 500 表示内部未知错误 | ||
@@ -127,0 +128,0 @@ } |
+3
-1
@@ -71,2 +71,3 @@ var Node = require("tree-node"), | ||
| value:function(){ | ||
| console.log("xxxxxxxxxxxxx fine xxxxxxx") | ||
| if(!this._fine){ | ||
@@ -128,2 +129,3 @@ this._fine = true; | ||
| value: function (parentId, replyId) { | ||
| console.log(arguments); | ||
| var tree = this._replyTree; | ||
@@ -134,3 +136,3 @@ var parent = tree.getNode(parentId); | ||
| this._replyNum = tree.allChildIds.length; | ||
| my.publish("*.*.update", "Topic" , this._id, { replyNum: this._replyNum, replyTree: this._replyTree.toJSON()}) | ||
| my.publish("*.*.update", "Topic" , this._id, { replyNum: this._replyNum, replyTree: this._replyTree.toJSON(),updateTime:Date.now()}) | ||
| } | ||
@@ -137,0 +139,0 @@ } |
+17
-13
@@ -114,7 +114,3 @@ module.exports = wrap; | ||
| var watchers = user.watchers; | ||
| if (watchers.indexOf(self.id) === -1) { | ||
| watchers.push(self.id); | ||
| user._watchers = watchers; | ||
| } | ||
| user.addWatcher(self.id); | ||
@@ -142,14 +138,22 @@ my.publish("*.*.update", "User" ,self._id ,{ follows: self.follows, watchers: self.watchers}) | ||
| if (user) { | ||
| var watchers = user.watchers; | ||
| var windex = watchers.indexOf(self.id); | ||
| if (windex !== -1) { | ||
| watchers.splice(windex, 1); | ||
| user._watchers = watchers; | ||
| } | ||
| user.removeWatcher(self.id); | ||
| } | ||
| } | ||
| my.publish("*.*.update","User",self._id, { follows: self.follows, watchers: self.watchers}) | ||
| my.publish("*.*.update","User",self._id, { follows: self.follows}) | ||
| }) | ||
| } | ||
| }, | ||
| addWatcher:{value:function(uid){ | ||
| if (this._watchers.indexOf(uid) === -1) { | ||
| this._watchers.push(uid); | ||
| my.publish("*.*.update","User",this._id, { watchers: this._watchers}) | ||
| } | ||
| }}, | ||
| removeWatcher:{value:function(uid){ | ||
| var windex = this._watchers.indexOf(uid); | ||
| if (windex !== -1) { | ||
| this._watchers.splice(windex, 1); | ||
| my.publish("*.*.update","User",this._id, { watchers: this._watchers}) | ||
| } | ||
| }}, | ||
| plus: { | ||
@@ -156,0 +160,0 @@ value: function (num) { |
+1
-1
| module.exports = { | ||
| domain:require("./domian"), | ||
| domain:require("./domain"), | ||
| dbs:require("./application/dbs"), | ||
@@ -4,0 +4,0 @@ query:require("./application/query"), |
+1
-1
| { | ||
| "name": "forum", | ||
| "version": "0.1.8", | ||
| "version": "0.1.9", | ||
| "description": "init", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -56,4 +56,2 @@ var domain = require("../domain"); | ||
| it("#/create", function (done) { | ||
| agent | ||
@@ -66,3 +64,3 @@ .post("/create") | ||
| }).end(function (err, res) { | ||
| domain.repos.Reply.get(res.body.replyId).then(function (r) { | ||
| domain.repos.Reply.get(res.body.reply.id).then(function (r) { | ||
| should.exist(r); | ||
@@ -69,0 +67,0 @@ done(); |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
128570
0.49%2542
0.79%0
-100%