Explorar o código

Added /api/user/boards

Johannes May %!s(int64=8) %!d(string=hai) anos
pai
achega
0cf0f20f9d
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  1. 12 0
      models/boards.js

+ 12 - 0
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, {