summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/notifications
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-11-02 13:47:44 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-11-02 13:47:44 +0900
commit174f8022eb5828db3e9af01afcf72fe7526c4c57 (patch)
tree3fab406b94f4244cf5330cf985a8eb518a1e027f /src/server/api/endpoints/notifications
parentBetter index (diff)
downloadsharkey-174f8022eb5828db3e9af01afcf72fe7526c4c57.tar.gz
sharkey-174f8022eb5828db3e9af01afcf72fe7526c4c57.tar.bz2
sharkey-174f8022eb5828db3e9af01afcf72fe7526c4c57.zip
Refactor
Diffstat (limited to 'src/server/api/endpoints/notifications')
-rw-r--r--src/server/api/endpoints/notifications/mark_all_as_read.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/server/api/endpoints/notifications/mark_all_as_read.ts b/src/server/api/endpoints/notifications/mark_all_as_read.ts
index 6487cd8b48..1b5208d447 100644
--- a/src/server/api/endpoints/notifications/mark_all_as_read.ts
+++ b/src/server/api/endpoints/notifications/mark_all_as_read.ts
@@ -1,6 +1,7 @@
import Notification from '../../../../models/notification';
import { publishMainStream } from '../../../../stream';
-import User, { ILocalUser } from '../../../../models/user';
+import User from '../../../../models/user';
+import define from '../../define';
export const meta = {
desc: {
@@ -13,10 +14,7 @@ export const meta = {
kind: 'notification-write'
};
-/**
- * Mark all notifications as read
- */
-export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
+export default define(meta, (ps, user) => new Promise(async (res, rej) => {
// Update documents
await Notification.update({
notifieeId: user._id,
@@ -41,4 +39,4 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
// 全ての通知を読みましたよというイベントを発行
publishMainStream(user._id, 'readAllNotifications');
-});
+}));