mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 16:00:13 +01:00
Fixed the errors existing in /api/user/boards
This commit is contained in:
parent
5be30a2cd8
commit
a472986d0e
1 changed files with 15 additions and 8 deletions
|
|
@ -557,15 +557,23 @@ if (Meteor.isServer) {
|
||||||
//BOARDS REST API
|
//BOARDS REST API
|
||||||
if (Meteor.isServer) {
|
if (Meteor.isServer) {
|
||||||
JsonRoutes.add('GET', '/api/user/boards', function (req, res, next) {
|
JsonRoutes.add('GET', '/api/user/boards', function (req, res, next) {
|
||||||
|
console.log("Running");
|
||||||
// TODO: This should be changed to be less restrictive!
|
// TODO: This should be changed to be less restrictive!
|
||||||
Authentication.checkUserId(req.userId);
|
Authentication.checkUserId(req.userId);
|
||||||
|
|
||||||
return Boards.find({
|
let data = Boards.find({
|
||||||
archived: false,
|
archived: false,
|
||||||
'members.userId': req.userId, // TODO: How does the current authentication system work? Can we rely on req.userId to be correct?
|
'members.userId': req.userId, // TODO: How does the current authentication system work? Can we rely on req.userId to be correct?
|
||||||
}, {
|
}, {
|
||||||
sort: ['title'],
|
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) {
|
JsonRoutes.add('GET', '/api/boards', function (req, res, next) {
|
||||||
|
|
@ -624,5 +632,4 @@ if (Meteor.isServer) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue