You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.7 KiB
28 lines
1.7 KiB
'use strict';
|
|
|
|
const book = require('../controllers/book');
|
|
|
|
module.exports = function (app, router, opts) {
|
|
const { middlewares: { auth } } = app;
|
|
|
|
// 书籍管理路由
|
|
router.get('/books', book.getBooks, { content: '获取书籍列表', visible: true });
|
|
router.post('/books', book.createBook, { content: '创建书籍', visible: true });
|
|
router.put('/books/:id', book.updateBook, { content: '更新书籍', visible: true });
|
|
router.delete('/books/:id', book.deleteBook, { content: '删除书籍', visible: true });
|
|
|
|
// 章节管理路由
|
|
router.get('/books/:bookId/chapters', book.getBookChapters, { content: '获取书籍章节树', visible: true });
|
|
router.post('/books/:bookId/chapters', book.createChapter, { content: '创建章节', visible: true });
|
|
router.put('/books/:bookId/chapters/:id', book.updateChapter, { content: '更新章节', visible: true });
|
|
router.delete('/books/:bookId/chapters/:id', book.deleteChapter, { content: '删除章节', visible: true });
|
|
|
|
// 内容生成路由
|
|
router.post('/books/:bookId/chapters/:id/generate', book.generateChapterContent, { content: '生成章节内容', visible: true });
|
|
router.get('/books/:bookId/chapters/:chapterId/contents', book.getChapterContent, { content: '获取章节内容', visible: true });
|
|
router.post('/books/:bookId/chapters/:chapterId/contents/save', book.saveChapterContent, { content: '保存章节内容', visible: true });
|
|
router.post('/books/:bookId/chapters/:chapterId/contents/:contentId/restore', book.restoreChapterVersion, { content: '回退章节内容', visible: true });
|
|
|
|
// 内容去AI化润色
|
|
router.post('/books/:bookId/chapters/:chapterId/polish', book.polishContent, { content: '去AI化润色', visible: true });
|
|
};
|