Просмотр исходного кода

Merge branch 'feat/growi-bot' into imprv/5907-5931-replacement

itizawa 4 лет назад
Родитель
Сommit
3b43b8c23e
1 измененных файлов с 27 добавлено и 14 удалено
  1. 27 14
      src/server/routes/apiv3/slack-integration-settings.js

+ 27 - 14
src/server/routes/apiv3/slack-integration-settings.js

@@ -216,21 +216,21 @@ module.exports = (crowi) => {
   /**
    * @swagger
    *
-   *    /slack-integration-settings/custom-bot-without-proxy/:
+   *    /slack-integration-settings/bot-type/:
    *      put:
-   *        tags: [CustomBotWithoutProxy]
-   *        operationId: putCustomBotWithoutProxy
-   *        summary: /slack-integration/custom-bot-without-proxy
-   *        description: Put customBotWithoutProxy setting.
+   *        tags: [botType]
+   *        operationId: putBotType
+   *        summary: /slack-integration/bot-type
+   *        description: Put botType setting.
    *        requestBody:
    *          required: true
    *          content:
    *            application/json:
    *              schema:
-   *                $ref: '#/components/schemas/CustomBotWithoutProxy'
+   *                $ref: '#/components/schemas/botType'
    *        responses:
    *           200:
-   *             description: Succeeded to put CustomBotWithoutProxy setting.
+   *             description: Succeeded to put botType setting.
    */
   router.put('/bot-type', accessTokenParser, loginRequiredStrictly, adminRequired, csrf, validator.BotType, apiV3FormValidator, async(req, res) => {
     const { currentBotType } = req.body;
@@ -253,10 +253,24 @@ module.exports = (crowi) => {
     }
   });
 
-  /*
-    TODO: add swagger by GW-5930
-  */
-
+  /**
+   * @swagger
+   *
+   *    /slack-integration/bot-type/:
+   *      delete:
+   *        tags: [botType]
+   *        operationId: deleteBotType
+   *        summary: /slack-integration/bot-type
+   *        description: Delete botType setting.
+   *        requestBody:
+   *          content:
+   *            application/json:
+   *              schema:
+   *                $ref: '#/components/schemas/botType'
+   *        responses:
+   *           200:
+   *             description: Succeeded to delete botType setting.
+   */
   router.delete('/bot-type', accessTokenParser, loginRequiredStrictly, adminRequired, csrf, apiV3FormValidator, async(req, res) => {
 
     await resetAllBotSettings();
@@ -290,12 +304,13 @@ module.exports = (crowi) => {
    *           200:
    *             description: Succeeded to put CustomBotWithoutProxy setting.
    */
-  router.put('/without-proxy/update-settings', async(req, res) => {
+  router.put('/without-proxy/update-settings', loginRequiredStrictly, adminRequired, csrf, async(req, res) => {
     const currentBotType = crowi.configManager.getConfig('crowi', 'slackbot:currentBotType');
     if (currentBotType !== 'customBotWithoutProxy') {
       const msg = 'Not CustomBotWithoutProxy';
       return res.apiv3Err(new ErrorV3(msg, 'not-customBotWithoutProxy'), 400);
     }
+
     const { slackSigningSecret, slackBotToken } = req.body;
     const requestParams = {
       'slackbot:signingSecret': slackSigningSecret,
@@ -316,8 +331,6 @@ module.exports = (crowi) => {
       logger.error('Error', error);
       return res.apiv3Err(new ErrorV3(msg, 'update-CustomBotSetting-failed'), 500);
     }
-
-
   });