Przeglądaj źródła

change the get method position

kaori 4 lat temu
rodzic
commit
846a3d15d6

+ 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;
     const user = req.user;
 
 
     try {
     try {
-      const notification = InAppNotification.read(user);
-      const result = { notification };
+      const count = await InAppNotification.getUnreadCountByUser(user._id);
+      const result = { count };
       return res.apiv3(result);
       return res.apiv3(result);
     }
     }
     catch (err) {
     catch (err) {
@@ -62,12 +62,11 @@ module.exports = () => {
     }
     }
   });
   });
 
 
-  router.post('/open', async(req, res) => {
+  router.post('/read', (req, res) => {
     const user = req.user;
     const user = req.user;
-    const id = req.body.id;
 
 
     try {
     try {
-      const notification = await InAppNotification.open(user, id);
+      const notification = InAppNotification.read(user);
       const result = { notification };
       const result = { notification };
       return res.apiv3(result);
       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 user = req.user;
+    const id = req.body.id;
 
 
     try {
     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);
       return res.apiv3(result);
     }
     }
     catch (err) {
     catch (err) {