|
|
@@ -122,69 +122,5 @@ module.exports = function(crowi, app) {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- /**
|
|
|
- * @swagger
|
|
|
- *
|
|
|
- * /revisions.ids:
|
|
|
- * get:
|
|
|
- * tags: [Revisions, CrowiCompatibles]
|
|
|
- * operationId: revisions.ids
|
|
|
- * summary: /revisions.ids
|
|
|
- * description: Get revision id list of the page
|
|
|
- * parameters:
|
|
|
- * - in: query
|
|
|
- * name: page_id
|
|
|
- * schema:
|
|
|
- * $ref: '#/components/schemas/Page/properties/_id'
|
|
|
- * required: true
|
|
|
- * responses:
|
|
|
- * 200:
|
|
|
- * description: Succeeded to get revision id list of the page.
|
|
|
- * content:
|
|
|
- * application/json:
|
|
|
- * schema:
|
|
|
- * properties:
|
|
|
- * ok:
|
|
|
- * $ref: '#/components/schemas/V1Response/properties/ok'
|
|
|
- * revisions:
|
|
|
- * type: array
|
|
|
- * items:
|
|
|
- * $ref: '#/components/schemas/Revision'
|
|
|
- * 403:
|
|
|
- * $ref: '#/components/responses/403'
|
|
|
- * 500:
|
|
|
- * $ref: '#/components/responses/500'
|
|
|
- */
|
|
|
- /**
|
|
|
- * @api {get} /revisions.ids Get revision id list of the page
|
|
|
- * @apiName ids
|
|
|
- * @apiGroup Revision
|
|
|
- *
|
|
|
- * @apiParam {String} page_id Page Id.
|
|
|
- */
|
|
|
- actions.api.ids = async function(req, res) {
|
|
|
- const pageId = req.query.page_id;
|
|
|
- const { isSharedPage } = req;
|
|
|
-
|
|
|
- if (pageId == null) {
|
|
|
- return res.json(ApiResponse.error('Parameter page_id is required.'));
|
|
|
- }
|
|
|
-
|
|
|
- // check whether accessible
|
|
|
- if (!isSharedPage && !(await Page.isAccessiblePageByViewer(pageId, req.user))) {
|
|
|
- return res.json(ApiResponse.error('Current user is not accessible to this page.'));
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- const page = await Page.findOne({ _id: pageId });
|
|
|
- const revisions = await Revision.findRevisionIdList(page.path);
|
|
|
- return res.json(ApiResponse.success({ revisions }));
|
|
|
- }
|
|
|
- catch (err) {
|
|
|
- logger.error('Error revisios.ids', err);
|
|
|
- return res.json(ApiResponse.error(err));
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
return actions;
|
|
|
};
|