summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormayjs <johannes.may@udo.edu>2017-05-15 18:20:51 +0200
committermayjs <johannes.may@udo.edu>2017-05-15 18:20:51 +0200
commita472986d0e763cbedf62a3b09fa9869bd00ba26a (patch)
tree2857c372baa879745056e4f1eec78316ecef76dd
parent5be30a2cd83ba15f88551314531ef45f4e05b352 (diff)
downloadwekan-a472986d0e763cbedf62a3b09fa9869bd00ba26a.tar.gz
wekan-a472986d0e763cbedf62a3b09fa9869bd00ba26a.tar.bz2
wekan-a472986d0e763cbedf62a3b09fa9869bd00ba26a.zip
Fixed the errors existing in /api/user/boards
-rw-r--r--models/boards.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/models/boards.js b/models/boards.js
index a0c0c8bf..6959d653 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -557,17 +557,25 @@ if (Meteor.isServer) {
//BOARDS REST API
if (Meteor.isServer) {
JsonRoutes.add('GET', '/api/user/boards', function (req, res, next) {
+ console.log("Running");
// TODO: This should be changed to be less restrictive!
Authentication.checkUserId(req.userId);
-
- return Boards.find({
- archived: false,
- 'members.userId': req.userId, // TODO: How does the current authentication system work? Can we rely on req.userId to be correct?
- }, {
- sort: ['title'],
+
+ let data = Boards.find({
+ archived: false,
+ 'members.userId': req.userId, // TODO: How does the current authentication system work? Can we rely on req.userId to be correct?
+ }, {
+ sort: ['title'],
+ }).map(function(board) {
+ return {
+ _id: board._id,
+ title: board._title
+ }
});
+
+ JsonRoutes.sendResult(res, {code: 200, data});
});
-
+
JsonRoutes.add('GET', '/api/boards', function (req, res, next) {
Authentication.checkUserId(req.userId);
JsonRoutes.sendResult(res, {
@@ -624,5 +632,4 @@ if (Meteor.isServer) {
},
});
});
-
}