diff --git a/models/boards.js b/models/boards.js index 7ee28298e..cfe0e2524 100644 --- a/models/boards.js +++ b/models/boards.js @@ -1700,6 +1700,30 @@ if (Meteor.isServer) { } }); + /** + * @operation get_boards_count + * @summary Get public and private boards count + * + * @return_type {private: integer, public: integer} + */ + JsonRoutes.add('GET', '/api/boards_count', function(req, res) { + try { + Authentication.checkUserId(req.userId); + JsonRoutes.sendResult(res, { + code: 200, + data: { + private: Boards.find({ permission: 'private' }).count(), + public: Boards.find({ permission: 'public' }).count(), + }, + }); + } catch (error) { + JsonRoutes.sendResult(res, { + code: 200, + data: error, + }); + } + }); + /** * @operation get_board * @summary Get the board with that particular ID diff --git a/public/api/wekan.html b/public/api/wekan.html index 5df259e31..41ee6cd57 100644 --- a/public/api/wekan.html +++ b/public/api/wekan.html @@ -1570,7 +1570,12 @@ var n=this.pipeline.run(e.tokenizer(t)),r=new e.Vector,i=[],o=this._fields.reduc get_public_boards - + +
  • + get_boards_count + +
  • +
  • new_board diff --git a/public/api/wekan.yml b/public/api/wekan.yml index 48bed68d6..17dd30630 100644 --- a/public/api/wekan.yml +++ b/public/api/wekan.yml @@ -245,6 +245,27 @@ paths: type: string defaultSwimlaneId: type: string + /api/boards_count: + get: + operationId: get_boards_count + summary: Get boards count + tags: + - Boards + produces: + - application/json + security: + - UserSecurity: [] + responses: + '200': + description: |- + 200 response + schema: + type: object + properties: + private: + type: integer + public: + type: integer /api/boards/{board}: get: operationId: get_board