summaryrefslogtreecommitdiff
path: root/packages/backend/src/models/Notification.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-09-20 11:33:36 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-09-20 11:33:36 +0900
commit053da10e94c2412f58215116a958c0922261a610 (patch)
treed608ce6350d5b209178390c3ab56c1fd0d30c438 /packages/backend/src/models/Notification.ts
parentfix (diff)
downloadmisskey-053da10e94c2412f58215116a958c0922261a610.tar.gz
misskey-053da10e94c2412f58215116a958c0922261a610.tar.bz2
misskey-053da10e94c2412f58215116a958c0922261a610.zip
refactor(backend): update directory structure for models
Diffstat (limited to 'packages/backend/src/models/Notification.ts')
-rw-r--r--packages/backend/src/models/Notification.ts71
1 files changed, 71 insertions, 0 deletions
diff --git a/packages/backend/src/models/Notification.ts b/packages/backend/src/models/Notification.ts
new file mode 100644
index 0000000000..fb7f67dfd8
--- /dev/null
+++ b/packages/backend/src/models/Notification.ts
@@ -0,0 +1,71 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and other misskey contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+import { notificationTypes } from '@/types.js';
+import { MiUser } from './User.js';
+import { MiNote } from './Note.js';
+import { MiFollowRequest } from './FollowRequest.js';
+import { MiAccessToken } from './AccessToken.js';
+
+export type MiNotification = {
+ id: string;
+
+ // RedisのためDateではなくstring
+ createdAt: string;
+
+ /**
+ * 通知の送信者(initiator)
+ */
+ notifierId: MiUser['id'] | null;
+
+ /**
+ * 通知の種類。
+ * follow - フォローされた
+ * mention - 投稿で自分が言及された
+ * reply - 投稿に返信された
+ * renote - 投稿がRenoteされた
+ * quote - 投稿が引用Renoteされた
+ * reaction - 投稿にリアクションされた
+ * pollEnded - 自分のアンケートもしくは自分が投票したアンケートが終了した
+ * receiveFollowRequest - フォローリクエストされた
+ * followRequestAccepted - 自分の送ったフォローリクエストが承認された
+ * achievementEarned - 実績を獲得
+ * app - アプリ通知
+ * test - テスト通知(サーバー側)
+ */
+ type: typeof notificationTypes[number];
+
+ noteId: MiNote['id'] | null;
+
+ followRequestId: MiFollowRequest['id'] | null;
+
+ reaction: string | null;
+
+ choice: number | null;
+
+ achievement: string | null;
+
+ /**
+ * アプリ通知のbody
+ */
+ customBody: string | null;
+
+ /**
+ * アプリ通知のheader
+ * (省略時はアプリ名で表示されることを期待)
+ */
+ customHeader: string | null;
+
+ /**
+ * アプリ通知のicon(URL)
+ * (省略時はアプリアイコンで表示されることを期待)
+ */
+ customIcon: string | null;
+
+ /**
+ * アプリ通知のアプリ(のトークン)
+ */
+ appAccessTokenId: MiAccessToken['id'] | null;
+}