|
|
@@ -84,41 +84,5 @@ module.exports = (crowi) => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- /**
|
|
|
- * @swagger
|
|
|
- *
|
|
|
- * /pages/export:
|
|
|
- * get:
|
|
|
- * tags: [Export]
|
|
|
- * description: create and return currently page file as md or pdf
|
|
|
- * responses:
|
|
|
- * 200:
|
|
|
- * description: Return currently page file path
|
|
|
- */
|
|
|
- router.get('/export', async(req, res) => {
|
|
|
- const Revision = crowi.model('Revision');
|
|
|
-
|
|
|
- try {
|
|
|
- const {
|
|
|
- revisionId, type,
|
|
|
- } = req.query;
|
|
|
- const revisions = await Revision.findRevisions([revisionId]);
|
|
|
- const markdown = revisions[0].body;
|
|
|
-
|
|
|
- const exportPageFile = markdown;
|
|
|
-
|
|
|
- if (type === 'pdf') {
|
|
|
- // TODO: convert markdown to pdf (GW-2757)
|
|
|
- }
|
|
|
-
|
|
|
- return res.apiv3({ exportPageFile });
|
|
|
- }
|
|
|
- catch (err) {
|
|
|
- res.code = 'unknown';
|
|
|
- logger.error('Failed to get markdown', err);
|
|
|
- return res.apiv3Err(err, 500);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
return router;
|
|
|
};
|