|
@@ -1563,82 +1563,5 @@ module.exports = function(crowi, app) {
|
|
|
return res.json(ApiResponse.success(result));
|
|
return res.json(ApiResponse.success(result));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @swagger
|
|
|
|
|
- *
|
|
|
|
|
- * /pages.recentCreated:
|
|
|
|
|
- * get:
|
|
|
|
|
- * tags: [Pages]
|
|
|
|
|
- * operationId: getRecentCreatedPages
|
|
|
|
|
- * summary: /pages.recentCreated
|
|
|
|
|
- * description: Get recent created page list
|
|
|
|
|
- * parameters:
|
|
|
|
|
- * - in: query
|
|
|
|
|
- * name: page_id
|
|
|
|
|
- * required: true
|
|
|
|
|
- * schema:
|
|
|
|
|
- * $ref: '#/components/schemas/Page/properties/_id'
|
|
|
|
|
- * - in: query
|
|
|
|
|
- * name: offset
|
|
|
|
|
- * schema:
|
|
|
|
|
- * $ref: '#/components/schemas/V1PaginateResult/properties/meta/properties/offset'
|
|
|
|
|
- * - in: query
|
|
|
|
|
- * name: limit
|
|
|
|
|
- * schema:
|
|
|
|
|
- * $ref: '#/components/schemas/V1PaginateResult/properties/meta/properties/limit'
|
|
|
|
|
- * responses:
|
|
|
|
|
- * 200:
|
|
|
|
|
- * description: Succeeded to get recent created page list.
|
|
|
|
|
- * content:
|
|
|
|
|
- * application/json:
|
|
|
|
|
- * schema:
|
|
|
|
|
- * properties:
|
|
|
|
|
- * ok:
|
|
|
|
|
- * $ref: '#/components/schemas/V1Response/properties/ok'
|
|
|
|
|
- * pages:
|
|
|
|
|
- * type: array
|
|
|
|
|
- * description: recent created page list
|
|
|
|
|
- * items:
|
|
|
|
|
- * $ref: '#/components/schemas/Page'
|
|
|
|
|
- * totalCount:
|
|
|
|
|
- * $ref: '#/components/schemas/V1PaginateResult/properties/meta/properties/total'
|
|
|
|
|
- * offset:
|
|
|
|
|
- * $ref: '#/components/schemas/V1PaginateResult/properties/meta/properties/offset'
|
|
|
|
|
- * limit:
|
|
|
|
|
- * $ref: '#/components/schemas/V1PaginateResult/properties/meta/properties/limit'
|
|
|
|
|
- * 403:
|
|
|
|
|
- * $ref: '#/components/responses/403'
|
|
|
|
|
- * 500:
|
|
|
|
|
- * $ref: '#/components/responses/500'
|
|
|
|
|
- */
|
|
|
|
|
- api.recentCreated = async function(req, res) {
|
|
|
|
|
- const pageId = req.query.page_id;
|
|
|
|
|
-
|
|
|
|
|
- if (pageId == null) {
|
|
|
|
|
- return res.json(ApiResponse.error('param \'pageId\' must not be null'));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const page = await Page.findById(pageId);
|
|
|
|
|
- if (page == null) {
|
|
|
|
|
- return res.json(ApiResponse.error(`Page (id='${pageId}') does not exist`));
|
|
|
|
|
- }
|
|
|
|
|
- if (!isUserPage(page.path)) {
|
|
|
|
|
- return res.json(ApiResponse.error(`Page (id='${pageId}') is not a user home`));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const limit = +req.query.limit || 50;
|
|
|
|
|
- const offset = +req.query.offset || 0;
|
|
|
|
|
- const queryOptions = { offset, limit };
|
|
|
|
|
-
|
|
|
|
|
- try {
|
|
|
|
|
- const result = await Page.findListByCreator(page.creator, req.user, queryOptions);
|
|
|
|
|
-
|
|
|
|
|
- return res.json(ApiResponse.success(result));
|
|
|
|
|
- }
|
|
|
|
|
- catch (err) {
|
|
|
|
|
- return res.json(ApiResponse.error(err));
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
return actions;
|
|
return actions;
|
|
|
};
|
|
};
|