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

change the get method position

kaori 4 лет назад
Родитель
Сommit
846a3d15d6
1 измененных файлов с 9 добавлено и 9 удалено
  1. 9 9
      packages/app/src/server/routes/apiv3/in-app-notification.ts

+ 9 - 9
packages/app/src/server/routes/apiv3/in-app-notification.ts

@@ -49,12 +49,12 @@ module.exports = () => {
       });
   });
 
-  router.post('/read', (req, res) => {
+  router.get('/status', async(req, res) => {
     const user = req.user;
 
     try {
-      const notification = InAppNotification.read(user);
-      const result = { notification };
+      const count = await InAppNotification.getUnreadCountByUser(user._id);
+      const result = { count };
       return res.apiv3(result);
     }
     catch (err) {
@@ -62,12 +62,11 @@ module.exports = () => {
     }
   });
 
-  router.post('/open', async(req, res) => {
+  router.post('/read', (req, res) => {
     const user = req.user;
-    const id = req.body.id;
 
     try {
-      const notification = await InAppNotification.open(user, id);
+      const notification = InAppNotification.read(user);
       const result = { notification };
       return res.apiv3(result);
     }
@@ -76,12 +75,13 @@ module.exports = () => {
     }
   });
 
-  router.get('/status', async(req, res) => {
+  router.post('/open', async(req, res) => {
     const user = req.user;
+    const id = req.body.id;
 
     try {
-      const count = await InAppNotification.getUnreadCountByUser(user._id);
-      const result = { count };
+      const notification = await InAppNotification.open(user, id);
+      const result = { notification };
       return res.apiv3(result);
     }
     catch (err) {