yusuketk 5 лет назад
Родитель
Сommit
30c862db6a
2 измененных файлов с 16 добавлено и 2 удалено
  1. 4 0
      src/server/models/page-archive.js
  2. 12 2
      src/server/routes/apiv3/page.js

+ 4 - 0
src/server/models/page-archive.js

@@ -6,6 +6,10 @@ module.exports = function(crowi) {
     filePath: { type: String, required: true },
     filePath: { type: String, required: true },
     creator: { type: ObjectId, ref: 'User', index: true },
     creator: { type: ObjectId, ref: 'User', index: true },
     basePagePath: { type: String, required: true },
     basePagePath: { type: String, required: true },
+    fileType: { type: String },
+    NumOfPages: { type: Number },
+    hasComment: { type: Boolean },
+    hasAttachment: { type: Boolean },
   }, {
   }, {
     timestamps: true,
     timestamps: true,
   });
   });

+ 12 - 2
src/server/routes/apiv3/page.js

@@ -216,6 +216,7 @@ module.exports = (crowi) => {
    *                  $ref: '#/components/schemas/Page'
    *                  $ref: '#/components/schemas/Page'
    */
    */
   router.post('/archive', accessTokenParser, loginRequired, csrf, validator.archive, apiV3FormValidator, async(req, res) => {
   router.post('/archive', accessTokenParser, loginRequired, csrf, validator.archive, apiV3FormValidator, async(req, res) => {
+
     const {
     const {
       basePagePath,
       basePagePath,
       isCommentDownload,
       isCommentDownload,
@@ -227,9 +228,18 @@ module.exports = (crowi) => {
     } = req.body;
     } = req.body;
     const PageArchive = crowi.model('PageArchive');
     const PageArchive = crowi.model('PageArchive');
 
 
-    const filePath = 'path'; // ファイル作成タスクにてアーカイブzipファイルのパスを入れる
+    const filePath = 'path'; // TODO ファイル作成タスクにてアーカイブzipファイルのパスを入れる
+    const NumOfPages = 1; // TODO 最終的なページ数を入れる
     const creator = req.user._id;
     const creator = req.user._id;
-    const archive = await PageArchive.create({ filePath, creator, basePagePath });
+
+    const archive = await PageArchive.create({
+      filePath,
+      creator,
+      fileType,
+      basePagePath,
+      NumOfPages,
+      hasComment: isCommentDownload,
+      hasAttachment: isAttachmentFileDownload});
   });
   });
 
 
   return router;
   return router;