|
@@ -86,9 +86,39 @@ export default class InAppNotificationService {
|
|
|
],
|
|
],
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (err) {
|
|
|
|
|
+ throw new Error(err);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- console.log('pagenatedInAppNotifications', pagenatedInAppNotifications);
|
|
|
|
|
- return pagenatedInAppNotifications;
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * TODO: return results including notifications,hasPrev and hasNext by #78991
|
|
|
|
|
+ * refer to https://github.com/crowi/crowi/blob/eecf2bc821098d2516b58104fe88fae81497d3ea/lib/controllers/notification.ts
|
|
|
|
|
+ */
|
|
|
|
|
+ // Notification.findLatestNotificationsByUser(user._id, requestLimit, offset)
|
|
|
|
|
+ // .then(function (notifications) {
|
|
|
|
|
+ // let hasPrev = false
|
|
|
|
|
+ // if (offset > 0) {
|
|
|
|
|
+ // hasPrev = true
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ // let hasNext = false
|
|
|
|
|
+ // if (notifications.length > limit) {
|
|
|
|
|
+ // hasNext = true
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ // const result = {
|
|
|
|
|
+ // notifications: notifications.slice(0, limit),
|
|
|
|
|
+ // hasPrev: hasPrev,
|
|
|
|
|
+ // hasNext: hasNext,
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ // return res.json(ApiResponse.success(result))
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .catch(function (err) {
|
|
|
|
|
+ // return res.json(ApiResponse.error(err))
|
|
|
|
|
+ // })
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|