Skip to content

Commit

Permalink
Notificationで不整合な場合でもとりあえずスキーマ通りに返すように
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Sep 17, 2020
1 parent 6b30322 commit 976c336
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/models/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ export const pack = async (notification: any) => {
// (データベースの不具合などで)投稿が見つからなかったら
if (_notification.note == null) {
dbLogger.warn(`[DAMAGED DB] (missing) pkg: notification -> note :: ${_notification.id} (note ${_notification.noteId})`);
return null;
_notification.type = '_missing_';
delete _notification.noteId;
delete _notification.note;
}
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/server/api/openapi/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export const schemas = {
},
type: {
type: 'string',
enum: ['follow', 'receiveFollowRequest', 'mention', 'reply', 'renote', 'quote', 'reaction', 'poll_vote', 'highlight'],
enum: ['follow', 'receiveFollowRequest', 'mention', 'reply', 'renote', 'quote', 'reaction', 'poll_vote', 'highlight', '_missing_'],
description: 'The type of the notification.'
},
},
Expand Down

0 comments on commit 976c336

Please sign in to comment.