Explorar o código

added all-share-link path

ryuichi-e %!s(int64=5) %!d(string=hai) anos
pai
achega
0cc221f53c
Modificáronse 1 ficheiros con 14 adicións e 0 borrados
  1. 14 0
      src/server/routes/apiv3/security-setting.js

+ 14 - 0
src/server/routes/apiv3/security-setting.js

@@ -290,6 +290,7 @@ module.exports = (crowi) => {
   const loginRequiredStrictly = require('../../middleware/login-required')(crowi);
   const adminRequired = require('../../middleware/admin-required')(crowi);
   const csrf = require('../../middleware/csrf')(crowi);
+  const ShareLink = crowi.model('ShareLink');
 
   const { ApiV3FormValidator } = crowi.middlewares;
 
@@ -547,6 +548,19 @@ module.exports = (crowi) => {
     }
   });
 
+  // write swagger
+  router.get('/all-share-links', loginRequiredStrictly, adminRequired, csrf, async(res) => {
+    try {
+      const shareLinksResult = await ShareLink.find();
+      return res.apiv3({ shareLinksResult });
+    }
+    catch (err) {
+      const msg = 'Error occured in get share link';
+      logger.error('Error', err);
+      return res.apiv3Err(new ErrorV3(msg, 'get-all-share-links-failed'));
+    }
+  });
+
   /**
    * @swagger
    *