@@ -10,30 +10,73 @@ import { MiFollowRequest } from './FollowRequest.js';
|
||||
import { MiAccessToken } from './AccessToken.js';
|
||||
|
||||
export type MiNotification = {
|
||||
type: 'note';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
notifierId: MiUser['id'];
|
||||
noteId: MiNote['id'];
|
||||
} | {
|
||||
type: 'follow';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
notifierId: MiUser['id'];
|
||||
} | {
|
||||
type: 'mention';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
notifierId: MiUser['id'];
|
||||
noteId: MiNote['id'];
|
||||
} | {
|
||||
type: 'reply';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
notifierId: MiUser['id'];
|
||||
noteId: MiNote['id'];
|
||||
} | {
|
||||
type: 'renote';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
notifierId: MiUser['id'];
|
||||
noteId: MiNote['id'];
|
||||
targetNoteId: MiNote['id'];
|
||||
} | {
|
||||
type: 'quote';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
notifierId: MiUser['id'];
|
||||
noteId: MiNote['id'];
|
||||
} | {
|
||||
type: 'reaction';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
notifierId: MiUser['id'];
|
||||
noteId: MiNote['id'];
|
||||
reaction: string;
|
||||
} | {
|
||||
type: 'pollEnded';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
notifierId: MiUser['id'];
|
||||
noteId: MiNote['id'];
|
||||
} | {
|
||||
type: 'receiveFollowRequest';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
notifierId: MiUser['id'];
|
||||
} | {
|
||||
type: 'followRequestAccepted';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
notifierId: MiUser['id'];
|
||||
} | {
|
||||
type: 'achievementEarned';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
achievement: string;
|
||||
} | {
|
||||
type: 'app';
|
||||
id: string;
|
||||
|
||||
// RedisのためDateではなくstring
|
||||
createdAt: string;
|
||||
|
||||
/**
|
||||
* 通知の送信者(initiator)
|
||||
*/
|
||||
notifierId: MiUser['id'] | null;
|
||||
|
||||
/**
|
||||
* 通知の種類。
|
||||
*/
|
||||
type: typeof notificationTypes[number];
|
||||
|
||||
noteId: MiNote['id'] | null;
|
||||
|
||||
followRequestId: MiFollowRequest['id'] | null;
|
||||
|
||||
reaction: string | null;
|
||||
|
||||
choice: number | null;
|
||||
|
||||
achievement: string | null;
|
||||
|
||||
/**
|
||||
* アプリ通知のbody
|
||||
@@ -56,4 +99,25 @@ export type MiNotification = {
|
||||
* アプリ通知のアプリ(のトークン)
|
||||
*/
|
||||
appAccessTokenId: MiAccessToken['id'] | null;
|
||||
}
|
||||
} | {
|
||||
type: 'test';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
};
|
||||
|
||||
export type MiGroupedNotification = MiNotification | {
|
||||
type: 'reaction:grouped';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
noteId: MiNote['id'];
|
||||
reactions: {
|
||||
userId: string;
|
||||
reaction: string;
|
||||
}[];
|
||||
} | {
|
||||
type: 'renote:grouped';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
noteId: MiNote['id'];
|
||||
userIds: string[];
|
||||
};
|
||||
|
@@ -12,7 +12,6 @@ export const packedNotificationSchema = {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
format: 'id',
|
||||
example: 'xxxxxxxxxx',
|
||||
},
|
||||
createdAt: {
|
||||
type: 'string',
|
||||
@@ -22,7 +21,7 @@ export const packedNotificationSchema = {
|
||||
type: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
enum: [...notificationTypes],
|
||||
enum: [...notificationTypes, 'reaction:grouped', 'renote:grouped'],
|
||||
},
|
||||
user: {
|
||||
type: 'object',
|
||||
@@ -63,5 +62,33 @@ export const packedNotificationSchema = {
|
||||
type: 'string',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
reactions: {
|
||||
type: 'array',
|
||||
optional: true, nullable: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
user: {
|
||||
type: 'object',
|
||||
ref: 'UserLite',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
reaction: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
required: ['user', 'reaction'],
|
||||
},
|
||||
},
|
||||
},
|
||||
users: {
|
||||
type: 'array',
|
||||
optional: true, nullable: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
ref: 'UserLite',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
Reference in New Issue
Block a user