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

add [GET] in-app-notification-settngs route

Shun Miyazawa 4 лет назад
Родитель
Сommit
7ac4b32385
1 измененных файлов с 32 добавлено и 0 удалено
  1. 32 0
      packages/app/src/server/routes/apiv3/personal-setting.js

+ 32 - 0
packages/app/src/server/routes/apiv3/personal-setting.js

@@ -507,5 +507,37 @@ module.exports = (crowi) => {
     }
   });
 
+  /**
+   * @swagger
+   *
+   *    /personal-setting/in-app-notification-settngs:
+   *      get:
+   *        tags: [in-app-notification-settngs]
+   *        operationId: getInAppNotificationSettngs
+   *        summary: /in-app-notification-settngs
+   *        description: Get in-app-notification-settngs
+   *        responses:
+   *          200:
+   *            description: params of in-app-notification-settngs
+   *            content:
+   *              application/json:
+   *                schema:
+   *                  properties:
+   *                    currentUser:
+   *                      type: object
+   *                      description: in-app-notification-settngs
+   */
+  router.get('/in-app-notification-settngs', accessTokenParser, loginRequiredStrictly, async(req, res) => {
+    try {
+      const query = { userId: req.user.id };
+      const response = await InAppNotificationSettngs.findOne(query);
+      return res.apiv3(response);
+    }
+    catch (err) {
+      logger.error(err);
+      return res.apiv3Err('getting-in-app-notification-settngs-failed');
+    }
+  });
+
   return router;
 };