From 0cf0f20f9d76fe711faaf7c4b245bf14f6e702ed Mon Sep 17 00:00:00 2001 From: Johannes May Date: Sat, 13 May 2017 22:56:26 +0200 Subject: Added /api/user/boards --- models/boards.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/models/boards.js b/models/boards.js index 879dde84..a0c0c8bf 100644 --- a/models/boards.js +++ b/models/boards.js @@ -556,6 +556,18 @@ if (Meteor.isServer) { //BOARDS REST API if (Meteor.isServer) { + JsonRoutes.add('GET', '/api/user/boards', function (req, res, next) { + // 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'], + }); + }); + JsonRoutes.add('GET', '/api/boards', function (req, res, next) { Authentication.checkUserId(req.userId); JsonRoutes.sendResult(res, { -- cgit v1.2.3-1-g7c22