ryuichi-e пре 5 година
родитељ
комит
6decb3d18f
1 измењених фајлова са 5 додато и 5 уклоњено
  1. 5 5
      src/server/routes/apiv3/share-links.js

+ 5 - 5
src/server/routes/apiv3/share-links.js

@@ -36,10 +36,10 @@ module.exports = (crowi) => {
 
   validator.shareLinkStatus = [
     // validate the page id is null
-    body('pageId').not().isEmpty().withMessage('Page Id is null'),
+    body('relatedPage').not().isEmpty().withMessage('Page Id is null'),
 
     // validate expireation date is not empty, is not before today and is date.
-    body('expiration').isAfter(today.toString()).withMessage('Your Selected date is past'),
+    body('expiredAt').isAfter(today.toString()).withMessage('Your Selected date is past'),
 
     // validate the length of description is max 100.
     body('description').isLength({ min: 0, max: 100 }).withMessage('Max length is 100'),
@@ -76,12 +76,12 @@ module.exports = (crowi) => {
    *            description: Succeeded to create one share link
    */
 
-  router.post('/', loginRequired, csrf, validator.shareLinkStatus, ApiV3FormValidator, async(req, res) => {
-    const { pageId, expiration, description } = req.body;
+  router.post('/', /* loginRequired, csrf, */ validator.shareLinkStatus, ApiV3FormValidator, async(req, res) => {
+    const { relatedPage, expiredAt, description } = req.body;
     const ShareLink = crowi.model('ShareLink');
 
     try {
-      const postedShareLink = await ShareLink.create({ relatedPage: pageId, expiredAt: expiration, desc: description });
+      const postedShareLink = await ShareLink.create({ relatedPage, expiredAt, description });
       return res.apiv3(postedShareLink);
     }
     catch (err) {