Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add path to rest API to retrieve cards by swimlane id #1934

Closed
dcmcand opened this issue Oct 6, 2018 · 2 comments
Closed

Add path to rest API to retrieve cards by swimlane id #1934

dcmcand opened this issue Oct 6, 2018 · 2 comments

Comments

@dcmcand
Copy link
Contributor

dcmcand commented Oct 6, 2018

I need to be able to retrieve cards by swimlane. This could be accomplished by adding a route to the REST API. I haven't tested the following code, but it seems reasonable:

if (Meteor.isServer) {
    JsonRoutes.add('GET', '/api/boards/:boardId/swimlanes/:swimlaneId/cards', function (req, res) {
      const paramBoardId = req.params.boardId;
      const paramSwinlaneId = req.params.swimlaneId;
      Authentication.checkBoardAccess(req.userId, paramBoardId);
      JsonRoutes.sendResult(res, {
        code: 200,
        data: Cards.find({boardId: paramBoardId, swinlaneId: paramSwimlaneId, archived: false}).map(function (doc) {
          return {
            _id: doc._id,
            title: doc.title,
            description: doc.description,
            listId: doc.listId,
          };
        }),
      });
    });

If that solution isn't ideal for some reason, returning swimlane id from the existing REST API get cards call would work too.

@xet7
Copy link
Member

xet7 commented Oct 6, 2018

@dcmcand

Please test it. If you get it working, add PR to edge branch.

@dcmcand
Copy link
Contributor Author

dcmcand commented Oct 7, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants