From 108dcb3e611d833e82c2dc3b8f0ccf5552597bc1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 29 Oct 2018 21:06:23 +0900 Subject: 物理削除系の処理を削除 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit これらの処理はパフォーマンス的に現実的でないし、すべてのモデルの関係を把握している必要があり保守が困難 論理削除でなんとかする --- src/models/note-reaction.ts | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'src/models/note-reaction.ts') diff --git a/src/models/note-reaction.ts b/src/models/note-reaction.ts index 0df9b921a5..256ed8203f 100644 --- a/src/models/note-reaction.ts +++ b/src/models/note-reaction.ts @@ -33,33 +33,6 @@ export const validateReaction = $.str.or([ 'pudding' ]); -/** - * NoteReactionを物理削除します - */ -export async function deleteNoteReaction(noteReaction: string | mongo.ObjectID | INoteReaction) { - let n: INoteReaction; - - // Populate - if (isObjectId(noteReaction)) { - n = await NoteReaction.findOne({ - _id: noteReaction - }); - } else if (typeof noteReaction === 'string') { - n = await NoteReaction.findOne({ - _id: new mongo.ObjectID(noteReaction) - }); - } else { - n = noteReaction as INoteReaction; - } - - if (n == null) return; - - // このNoteReactionを削除 - await NoteReaction.remove({ - _id: n._id - }); -} - /** * Pack a reaction for API response */ -- cgit v1.2.3-freya